/// <summary> /// 构造列表 /// </summary> /// <param name="dr"></param> /// <returns></returns> public List<RoleMenuEntity> MakeRoleMenuList(IDataReader dr) { List<RoleMenuEntity> list = new List<RoleMenuEntity>(); while (dr.Read()) { RoleMenuEntity roleMenuEntity = new RoleMenuEntity(); roleMenuEntity.MapID = (Int64)dr["MapID"]; roleMenuEntity.JournalID = (Int64)dr["JournalID"]; roleMenuEntity.RoleID = Convert.IsDBNull(dr["RoleID"]) ? null : (Int64?)dr["RoleID"]; roleMenuEntity.MenuID = Convert.IsDBNull(dr["MenuID"]) ? null : (Int64?)dr["MenuID"]; roleMenuEntity.AddDate = (DateTime)dr["AddDate"]; list.Add(roleMenuEntity); } dr.Close(); return list; }
public ActionResult SetMenuRight(long RoleID, long[] IDAarry) { ExecResult execResult = new ExecResult(); if (IDAarry != null && IDAarry.Length > 0) { List<RoleMenuEntity> menuRoleList = new List<RoleMenuEntity>(); RoleMenuEntity roleMenuEntity = null; foreach (long MenuID in IDAarry) { roleMenuEntity = new RoleMenuEntity(); roleMenuEntity.JournalID = JournalID; roleMenuEntity.RoleID = RoleID; roleMenuEntity.MenuID = MenuID; roleMenuEntity.AddDate = DateTime.Now; menuRoleList.Add(roleMenuEntity); } ISiteSystemFacadeService siteSystemService = ServiceContainer.Instance.Container.Resolve<ISiteSystemFacadeService>(); execResult = siteSystemService.SetMenuRight(menuRoleList); } else { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "请选择要赋权的菜单"; } return Content(JsonConvert.SerializeObject(execResult)); }