public List <Sys_RolePurview> SaveRole(string roleID) { string[] strList = hid_Save.Value.Split('|'); List <Sys_RolePurview> list = new List <Sys_RolePurview>(); if (strList.Length > 0) { foreach (string str in strList) { if (str != "") { string[] roleInfo = str.Split('_'); string s = roleInfo[0]; List <Sys_RolePurview> rl = dalUserRole.GetList(p => p.RolePurview_RoleID == roleID && p.RolePurview_MenuCode == s).ToList(); Sys_RolePurview model = new Sys_RolePurview(); if (rl.Count > 0) { model = rl[0]; } model.RolePurviewID = Guid.NewGuid().ToString(); model.RolePurview_RoleID = roleID; model.RolePurview_MenuCode = roleInfo[0]; model.RolePurview_OperatePurview = roleInfo[1]; list.Add(model); } } } return(list); }
/// <summary> /// 保存部门查看范围 /// </summary> /// <param name="context"></param> public string SaveDep(HttpContext context) { string st = "0"; string codes = context.Request.QueryString["code"]; string roleId = context.Request.QueryString["roleId"]; string menucode = context.Request.QueryString["menucode"]; string seeCharge = context.Request.QueryString["seeCharge"]; string seeType = context.Request.QueryString["type"]; string showType = context.Request.QueryString["showType"]; string see = ""; if (!string.IsNullOrEmpty(seeCharge)) { var ds = seeCharge.Split(','); for (int i = 0; i < ds.Count(); i++) { if (ds[i].Contains("_")) { see += ds[i].Split('_')[0] + "_"; //Sys_SeeCharge ses = bllSee.Find(ds[i].Split('_')[1]); string ids = ds[i].Split('_')[1]; Sys_SeeCharge ses = bllSee.Get(p => p.SeeChargeID == ids); if (ses != null) { see += ses.SeeCharge_Name + ","; } } else { // see += ds[i].Split('_')[0] + "_"; //Sys_SeeCharge ses = bllSee.Find(ds[i]); string ids = ds[i]; Sys_SeeCharge ses = bllSee.Get(p => p.SeeChargeID == ids); if (ses != null) { see += ses.SeeCharge_Name + ","; } } } } if (see.Length > 0) { see = see.Substring(0, see.Length - 1); var da = codes.Split(','); string str = ""; for (int i = 0; i < da.Count(); i++) { str += "'" + da[i] + "',"; } if (str.Length > 0) { string msg = string.Empty; str = str.Substring(0, str.Length - 1); Sys_RolePurviewBLL bllRP = new BLL.Sys_RolePurviewBLL(); //List<Sys_RolePurview> list = bllRP.FindWhere(" RolePurview_RoleID ='" + roleId + "' and RolePurview_MenuCode='" + menucode + "'"); List <Sys_RolePurview> list = bllRP.GetList(p => p.RolePurview_RoleID == roleId && p.RolePurview_MenuCode == menucode).ToList(); if (list.Count == 1) { Sys_RolePurview p = list[0]; p.RolePurview_SeeDepCode = str; p.RolePurview_SeeCharge = see; p.RolePurview_SeeType = seeType; if (bllRP.Update(p)) { st = "1"; } } else { Sys_RolePurview p = new Sys_RolePurview(); p.RolePurviewID = Guid.NewGuid().ToString(); p.RolePurview_RoleID = roleId; p.RolePurview_MenuCode = menucode; p.RolePurview_SeeDepCode = str; p.RolePurview_SeeCharge = see; p.RolePurview_SeeType = seeType; if (bllRP.Add(p)) { st = "1"; } } } } else { st = "0"; } return(st); }