本文整理汇总了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;
}