/// <summary> /// 修改 /// </summary> public void Update(int roleID, string roleName, string roleDescribe, HttpContext context) { var currentRoleTypeID = Convert.ToInt32(Common.GetRequest("currentRoleTypeID")); var roleType = Convert.ToInt32(Common.GetRequest("roleType")); List <int> roleFunBefore = MgrServices.FunctionService.GetRoleFun(roleID); var ordinaryFunction = new List <int> { 83, 84, 153, 154, 104, 105, 112, 149 }; if (currentRoleTypeID == 2 && roleType == 3) { MgrServices.FunctionService.Deletes(roleFunBefore, roleID); if (ordinaryFunction.Count() != 0) { DataTable dt = new DataTable(); dt.TableName = "RoleAndFunction"; dt.Columns.Add("RoleID", typeof(Int32)); dt.Columns.Add("FunID", typeof(Int32)); for (int i = 0; i < ordinaryFunction.Count; i++) { DataRow dr = dt.NewRow(); dr["RoleID"] = roleID; dr["FunID"] = ordinaryFunction[i]; dt.Rows.Add(dr); } try { if (roleFunBefore.Count != 0) { MgrServices.FunctionService.AddRoleFun(dt); } } catch (Exception) { } } } if (currentRoleTypeID == 3 && roleType == 2) { MgrServices.FunctionService.Deletes(ordinaryFunction, roleID); } RoleService.RoleEntity rs = new RoleService.RoleEntity(); rs.Role_ID = roleID; rs.Role_Name = roleName.Replace(" ", ""); rs.Role_Describe = roleDescribe; rs.Role_EditTime = DateTime.Now; rs.Role_Type = roleType; rs.Role_EditPerson = Common.GetSessionValue("UserID", context); if (rs.Role_EditPerson == null) { return; } context.Response.Write(MgrServices.RoleService.Update(rs)); }
public void Update(int roleID, string roleName, string roleDescribe, HttpContext context) { RoleService.RoleEntity rs = new RoleService.RoleEntity(); rs.Role_ID = roleID; rs.Role_Name = roleName.Replace(" ", ""); rs.Role_Describe = roleDescribe; rs.Role_EditTime = DateTime.Now; rs.Role_Type = Convert.ToInt32(Common.GetRequest("roleType")); rs.Role_EditPerson = Common.GetSessionValue("UserID", context); if (rs.Role_EditPerson == null) { return; } context.Response.Write(MgrServices.RoleService.Update(rs)); }
/// <summary> /// 获取开启功能 /// </summary> /// <param name="LoginName"></param> /// <returns></returns> public string GetIsOpen(string LoginName) { GetRoleModel model = new GetRoleModel(); try { WebPages.RoleService.RoleServiceClient brc = new WebPages.RoleService.RoleServiceClient(); RoleService.RoleEntity ds = brc.GetIsOpen(LoginName); if (ds.Role_Type != null) { model.Role_Name = ds.Role_Name; } model.IsOpen = ds.Role_ID; string json = JsonConvert.SerializeObject(model); return(json); } catch { string json = JsonConvert.SerializeObject(model); return(json); } }