コード例 #1
0
 /// <summary>
 /// 角色授权
 /// </summary>
 /// <param name="roleId"></param>
 /// <param name="moduleId"></param>
 /// <param name="operaIds"></param>
 public void RolePermission(int roleId, int moduleId, string[] operaIds)
 {
     using (DBContainer db = new DBContainer())
     {
         db.P_Sys_DeleteRoleModuleOpera(roleId, moduleId);
         foreach (var operaId in operaIds)
         {
             if (!String.IsNullOrWhiteSpace(operaId))
             {
                 //int operationId=Convert.ToInt32(operaId);
                 //SysOperations operaModel = db.SysOperations.SingleOrDefault(model => model.Id == operationId);
                 //if (operaModel.Code == "Browser")
                 //{
                 //    AddRoleModuleOpera(roleId, moduleId, Convert.ToInt32(operaId), db);
                 //}
                 //else
                 //{
                 db.P_Sys_RolePermSet(roleId, moduleId, Convert.ToInt32(operaId));
                 //}
             }
         }
         db.SaveChanges();
     }
 }