本文整理匯總了C#中WebService.venuesEntities.AddTotbl_module方法的典型用法代碼示例。如果您正苦於以下問題:C# venuesEntities.AddTotbl_module方法的具體用法?C# venuesEntities.AddTotbl_module怎麽用?C# venuesEntities.AddTotbl_module使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WebService.venuesEntities
的用法示例。
在下文中一共展示了venuesEntities.AddTotbl_module方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SaveModule
public static string SaveModule(int templateID, string mInfo, string loginUserInfo)
{
string returnStr = "";
JObject objVenue = JObject.Parse(mInfo);
try
{
using (venuesEntities db = new venuesEntities())
{
tbl_module tbm = new tbl_module();
tbm.ModuleCreatetime=DateTime.Now;
tbm.ModuleType=int.Parse(objVenue["moduleTypeID"].ToString());
tbm.ModuleX = int.Parse(objVenue["moduleX"].ToString());
tbm.ModuleY = int.Parse(objVenue["moduleY"].ToString());
tbm.ModuleWidth = int.Parse(objVenue["moduleWidth"].ToString());
tbm.ModuleHeight = int.Parse(objVenue["moduleHeight"].ToString());
tbm.ModuleImage = objVenue["moduleImage"].ToString();
tbm.ModuleDepth = int.Parse(objVenue["moduleDepth"].ToString());
tbm.TextPrompt = objVenue["modulePrompt"].ToString();
tbm.TemplateID = int.Parse(templateID.ToString());
db.AddTotbl_module(tbm);
if (db.SaveChanges() != 0)
{
returnStr = KeyManager.RetrunSucceed;
if (objVenue["moduleAttributeInfo"].ToString() != "[]")//判斷是否有模塊的其他屬性,若有則保存模塊其他屬性
{
string strSql = "SELECT MAX(s.ID) as max FROM tbl_module AS s";
int newModuleID = 0;
ObjectQuery<DbDataRecord> resultm = db.CreateQuery<DbDataRecord>(strSql);
foreach (var item in resultm)
{
newModuleID = int.Parse(item["max"].ToString());//獲取當前新增模塊的id
}
DeleteModuleAttributeByModuleID(newModuleID, loginUserInfo);//先刪除與該模塊有關的其他模塊屬性
JArray attModules = JArray.Parse(objVenue["moduleAttributeInfo"].ToString());
foreach (JObject objAttModule in attModules)
{
returnStr = AddModuleAttribute(newModuleID, objAttModule.ToString(), loginUserInfo);//新增模塊屬性
}
}
}
else
{
returnStr = KeyManager.RetrunUnSucceed;
}
}
}
catch (Exception e)
{
returnStr = e.Message;
LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_ModulesManager, "新增模塊,mInfo=" + mInfo + ";錯誤信息:" + e.Message, loginUserInfo);
}
return returnStr;
}