本文整理匯總了C#中WebService.venuesEntities.AddTotbl_sys_authority方法的典型用法代碼示例。如果您正苦於以下問題:C# venuesEntities.AddTotbl_sys_authority方法的具體用法?C# venuesEntities.AddTotbl_sys_authority怎麽用?C# venuesEntities.AddTotbl_sys_authority使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WebService.venuesEntities
的用法示例。
在下文中一共展示了venuesEntities.AddTotbl_sys_authority方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AddAuthority
/// <summary>
/// 初始化用戶權限
/// </summary>
/// <param name="addUserId"></param>
public static void AddAuthority(int addUserId)
{
using (venuesEntities db = new venuesEntities())
{
tbl_sys_authority au = new tbl_sys_authority();
au.AT_UserId = addUserId;
au.AT_MenuId = 1;
db.AddTotbl_sys_authority(au);
db.SaveChanges();
}
}
示例2: EditAuthorityByUserId
/// <summary>
/// 編輯用戶對應的菜單列表,多對多關係
/// </summary>
/// <param name="curUserID"></param>
/// <param name="editUserID"></param>
/// <param name="menusList"></param>
/// <returns></returns>
public static string EditAuthorityByUserId(int curUserID, int editUserID, String menusList, int userTypeId, string loginUserInfo)
{
//throw new NotImplementedException();
string returnStr = "";
try
{
using (venuesEntities db = new venuesEntities())
{
//先刪除用戶權限關聯關係表中,該用戶的所有關聯關係
String deleteReturn = AuthorityManager.deleteAllAuthoriyByUserID(editUserID, userTypeId, loginUserInfo);
if (deleteReturn == "成功!")
{
List<string> mlist = new List<string>(menusList.Split(','));
foreach (String auMenuId in mlist)
{
if (auMenuId != "")
{
tbl_sys_authority au = new tbl_sys_authority();
au.AT_UserId = editUserID;
au.AT_MenuId = int.Parse(auMenuId);
au.AT_UserTypeId = userTypeId;
db.AddTotbl_sys_authority(au);
}
}
}
if (db.SaveChanges() != 0)
{
returnStr = "成功!";
LogManager.addLog(KeyManager.LogTypeId_Option, KeyManager.MENUS.Menu_Authority, "編輯用戶權限菜單,userID=" + editUserID, loginUserInfo);
}
else
returnStr = "不成功!";
}
}
catch (Exception e)
{
returnStr = "不成功!";
LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_Authority, "編輯用戶權限菜單,userID=" + editUserID + ",錯誤信息:" + e.Message, loginUserInfo);
}
return returnStr;
}