public ActionResult EditModule(string Id) { Module mt = CommonSrv.LoadObjectById(typeof(Module), Id) as Module; ModuleDTO mdto = new ModuleDTO(); mdto.Id = mt.Id; mdto.ModuleTypeId = mt.ModuleType.Id; mdto.ModuleUrl = mt.ModuleUrl; mdto.Name = mt.Name; mdto.OrderId = mt.OrderId; mdto.Remark = mt.Remark; mdto.Tag = mt.Tag; //获取 syscode - rights SysCodeType sct = SysCodeTypeSrv.GetSysCodeTypeByTag("rights"); if (sct != null) { foreach (SysCode sc in sct.SysCodes) { if (mt.ModuleRights.ContainsKey(sc.Tag)) { mdto.ModuleRights.Add(sc.Name + "|" + sc.Tag + "|" + sc.Id + "|√"); } else { mdto.ModuleRights.Add(sc.Name + "|" + sc.Tag + "|" + sc.Id); } } } return(View("ModuleInfo", mdto)); }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); try { if (Request.QueryString["mode"] == "new") { divTitleMess.InnerText = "新增系统代码分类"; } else if (Request.QueryString["mode"] == "edit") { divTitleMess.InnerText = "编辑系统代码分类"; string id = Request.QueryString["id"]; if (id != null) { SysCodeType sct = CommonSrv.LoadObjectById(typeof(SysCodeType), id) as SysCodeType; txtSysCodeTypeTag.Value = sct.Tag; txtSysCodeTypeName.Value = sct.Name; txtSysCodeTypeOrderId.Value = sct.OrderId.ToString(); txtaSysCodeTypeRemark.Value = sct.Remark; } } } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(this.GetType(), "error", "<script type=\"text/javascript\">error=true;</script>"); log.Error(null, ex); } }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); try { if (Request.QueryString["mode"] == "new") { divTitleMess.InnerText = "新增部门"; } else if (Request.QueryString["mode"] == "edit") { divTitleMess.InnerText = "编辑部门"; string id = Request.QueryString["id"]; if (id != null) { Department d = CommonSrv.LoadObjectById(typeof(Department), id) as Department; txtName.Value = d.Name; txtOrderId.Value = d.OrderId.ToString(); txtPhone.Value = d.Phone; txtExtNumber.Value = d.ExtNumber; txtFax.Value = d.Fax; txtaRemark.Value = d.Remark; } } } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(this.GetType(), "error", "<script type=\"text/javascript\">error=true;</script>"); log.Error(null, ex); } }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); try { //当前职员。 string staffId = Request.QueryString["id"]; Staff staff = CommonSrv.LoadObjectById(typeof(Staff), staffId) as Staff; //权限。 SysCodeType sct = SysCodeTypeSrv.GetSysCodeTypeByTag("rights"); //生成树节点。 IList topModuleTypes = ModuleTypeSrv.GetAllTopModuleType(); foreach (ModuleType mt in topModuleTypes) { Microsoft.Web.UI.WebControls.TreeNode node = new Microsoft.Web.UI.WebControls.TreeNode(); tvRights.Nodes.Add(node); node.Type = "moduletype"; node.Text = mt.Name; AddSubNodes(node, mt, staff, sct); node.Expanded = true; } } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(this.GetType(), "error", "<script type=\"text/javascript\">error=true;</script>"); log.Error(null, ex); } }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); try { selectUserSex.Items.Add(new ListItem("", "-1")); selectUserSex.Items.Add(new ListItem("男", "0")); selectUserSex.Items.Add(new ListItem("女", "1")); if (Request.QueryString["mode"] == "new") { divTitleMess.InnerText = "新增用户"; } else if (Request.QueryString["mode"] == "edit") { divTitleMess.InnerText = "编辑用户"; string id = Request.QueryString["id"]; if (id != null) { User u = CommonSrv.LoadObjectById(typeof(User), id) as User; txtUserLoginId.Value = u.LoginId; txtUserName.Value = u.Name; cbUserDisabled.Checked = (u.Disabled == 1); txtUserIdCard.Value = u.IdCard; if (u.Sex.HasValue) { ListItem liSex = selectUserSex.Items.FindByValue(u.Sex.Value.ToString()); if (liSex != null) { liSex.Selected = true; } } if (u.Birthday.HasValue) { txtUserBirthday.Value = u.Birthday.Value.ToString("yyyy-MM-dd"); } txtUserOfficePhone.Value = u.OfficePhone; txtUserCellPhone.Value = u.CellPhone; txtUserFamilyPhone.Value = u.FamilyPhone; txtUserEmail.Value = u.Email; txtUserZipCode.Value = u.ZipCode; txtaUserRemark.Value = u.Remark; txtaUserAddress.Value = u.Address; } } } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(this.GetType(), "error", "<script type=\"text/javascript\">error=true;</script>"); log.Error(null, ex); } }
/// <summary> /// 获取权限代码 json /// </summary> /// <param name="Id"></param> /// <returns></returns> public JsonResult GetSysCodeInfoJson(string Id) { SysCode sc = CommonSrv.LoadObjectById(typeof(SysCode), Id) as SysCode; SysCodeDTO sysDTO = new SysCodeDTO(); sysDTO.Id = sc.Id; sysDTO.Name = sc.Name; sysDTO.OrderId = sc.OrderId; sysDTO.Remark = sc.Remark; sysDTO.Tag = sc.Tag; return(Json(sysDTO, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 编辑syscodetype /// </summary> /// <param name="Id"></param> /// <returns></returns> public ActionResult SysCodeTypeEdit(string Id) { SysCodeType sct = CommonSrv.LoadObjectById(typeof(SysCodeType), Id) as SysCodeType; SysCodeTypeDTO sysCodeTypeDTO = new SysCodeTypeDTO(); sysCodeTypeDTO.Id = sct.Id; sysCodeTypeDTO.Name = sct.Name; sysCodeTypeDTO.OrderId = sct.OrderId; sysCodeTypeDTO.Remark = sct.Remark; sysCodeTypeDTO.Tag = sct.Tag; return(View("SysCodeTypeInfo", sysCodeTypeDTO)); }
/// <summary> /// 编辑角色 /// </summary> /// <param name="Id">RoleId</param> /// <returns></returns> public ActionResult EditRole(string Id) { Role role = CommonSrv.LoadObjectById(typeof(Role), Id) as Role; RoleDTO rdto = new RoleDTO(); rdto.Id = role.Id; rdto.Name = role.Name; rdto.OrderId = role.OrderId; rdto.Remark = role.Remark; rdto.RoleTypeId = role.RoleType != null ? role.RoleType.Id : ""; return(View("RoleInfo", rdto)); }
/// <summary> /// 编辑Roletype /// </summary> /// <param name="Id"></param> /// <returns></returns> public ActionResult EditRoleType(string Id) { RoleType roletype = CommonSrv.LoadObjectById(typeof(RoleType), Id) as RoleType; RoleTypeDTO dto = new RoleTypeDTO(); dto.Id = roletype.Id; dto.Name = roletype.Name; dto.OrderId = roletype.OrderId; dto.Remark = roletype.Remark; dto.ParentRoleTypeId = roletype.ParentRoleType == null ? "" : roletype.ParentRoleType.Id; return(View("RoleTypeInfo", dto)); }
/// <summary> /// 编辑moduletype /// </summary> /// <param name="Id"></param> /// <returns></returns> public ActionResult EditModuleType(string Id) { ModuleType mt = CommonSrv.LoadObjectById(typeof(ModuleType), Id) as ModuleType; ModuleTypeDTO modultTypeDTO = new ModuleTypeDTO(); modultTypeDTO.Id = mt.Id; modultTypeDTO.Name = mt.Name; modultTypeDTO.OrderId = mt.OrderId; modultTypeDTO.Remark = mt.Remark; modultTypeDTO.ParentModuleTypeId = mt.ParentModuleType == null ? "" : mt.ParentModuleType.Id; return(View("ModuleTypeInfo", modultTypeDTO)); }
/// <summary> /// 在Session中保存当前登录职员对于当前模块拥有的所有肯定授权标示。 /// <remarks> /// 在每一个模块的主界面初始化时被调用,用于在Session中保存当前登录职员对于当前模块拥有的所有肯定授权标示。 /// 以后模块在每次需要做授权判断时只需依据Session中保存的授权标示判断即可,不用再次读数据库。 /// 注意:如果是内置职员登录系统,则此函数将不会被调用,同时在以后的任何操作时也不会调用HasGrantPermission函数来做授权判断。 /// </remarks> /// </summary> public static void SaveGrantPermissionsToSession() { StaffSession ss = SessionUtil.GetStaffSession(); string moduleTag = SessionUtil.GetModuleTag(); Staff staff = CommonSrv.LoadObjectById(typeof(Staff), ss.LoginId) as Staff; Module module = ModuleSrv.GetModuleByTag(moduleTag); ArrayList alGrantPermissions = staff.GetGrantPermissions(module); SessionUtil.SavaGrantPermissions(alGrantPermissions); }
/// <summary> /// 获取权限代码Type json /// </summary> /// <param name="Id"></param> /// <returns></returns> public JsonResult GetDepartMentInfoJson(string Id) { var departmentDomain = CommonSrv.LoadObjectById(typeof(Department), Id) as Gecko.Security.Domain.Department; DepartmentDTO departMentDTO = new DepartmentDTO(); departMentDTO.Id = departmentDomain.Id; departMentDTO.Name = departmentDomain.Name; departMentDTO.OrderId = departmentDomain.OrderId; departMentDTO.Phone = departmentDomain.Phone; departMentDTO.Remark = departmentDomain.Remark; departMentDTO.Fax = departmentDomain.Fax; departMentDTO.ExtNumber = departmentDomain.ExtNumber; return(Json(departMentDTO, JsonRequestBehavior.AllowGet)); }
public ActionResult DepartMentEdit(string Id) { var departmentDomain = CommonSrv.LoadObjectById(typeof(Department), Id) as Gecko.Security.Domain.Department; DepartmentDTO departmentDTO = new DepartmentDTO(); departmentDTO.Id = departmentDomain.Id; departmentDTO.Name = departmentDomain.Name; departmentDTO.OrderId = departmentDomain.OrderId; departmentDTO.Phone = departmentDomain.Phone; departmentDTO.ExtNumber = departmentDomain.ExtNumber; departmentDTO.Fax = departmentDomain.Fax; departmentDTO.Remark = departmentDomain.Remark; departmentDTO.ParentDepartmentId = departmentDomain.ParentDepartment != null ? departmentDomain.ParentDepartment.Id : null; return(View("DepartMentInfo", departmentDTO)); }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); try { string LoginId = Request.QueryString["id"]; Staff s = CommonSrv.LoadObjectById(typeof(Staff), LoginId) as Staff; LoadRoleTree(s); } catch (Exception ex) { log.Error(null, ex); throw; } }
public JsonResult ModuleInfo(string Id) { JsonResult jresult = new JsonResult(); jresult.JsonRequestBehavior = JsonRequestBehavior.AllowGet; try { Module mt = CommonSrv.LoadObjectById(typeof(Module), Id) as Module; ModuleDTO mdto = new ModuleDTO(); mdto.Id = mt.Id; mdto.ModuleTypeId = mt.ModuleType.Id; mdto.ModuleUrl = mt.ModuleUrl; mdto.Name = mt.Name; mdto.OrderId = mt.OrderId; mdto.Remark = mt.Remark; mdto.Tag = mt.Tag; mdto.Disabled = mt.Disabled == 1 ? true : false; //获取 syscode - rights SysCodeType sct = SysCodeTypeSrv.GetSysCodeTypeByTag("rights"); if (sct != null) { foreach (SysCode sc in sct.SysCodes) { if (mt.ModuleRights.ContainsKey(sc.Tag)) { mdto.ModuleRights.Add(sc.Name + "|√"); } else { mdto.ModuleRights.Add(sc.Name); } } } jresult.Data = mdto; } catch { //TODO js 异常判断 jresult.Data = "[{result:-1}]"; } return(jresult); }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); try { string id = Request.QueryString["id"]; if (id != null) { User u = CommonSrv.LoadObjectById(typeof(User), id) as User; txtUserLoginId.Value = u.LoginId; txtUserName.Value = u.Name; txtUserDisabled.Value = ((u.Disabled == 1) ? "已禁用" : "未禁用"); txtUserIdCard.Value = u.IdCard; if (u.Sex.HasValue) { txtUserSex.Value = ((u.Sex.Value.ToString() == "0") ? "男" : "女"); } if (u.Birthday.HasValue) { txtUserBirthday.Value = u.Birthday.Value.ToString("yyyy-MM-dd"); } txtUserOfficePhone.Value = u.OfficePhone; txtUserCellPhone.Value = u.CellPhone; txtUserFamilyPhone.Value = u.FamilyPhone; txtUserEmail.Value = u.Email; txtUserZipCode.Value = u.ZipCode; txtaUserRemark.Value = u.Remark; txtaUserAddress.Value = u.Address; txtUserRegisterDate.Value = u.RegisterDate.ToString("yyyy-MM-dd HH:mm:ss"); } } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(this.GetType(), "error", "<script type=\"text/javascript\">window.returnValue = false;window.close();</script>"); log.Error(null, ex); } }
/// <summary> /// 获取moduletype 详情,返回json 数据 /// </summary> /// <param name="Id"></param> /// <returns></returns> public JsonResult ModuleTypeInfo(string Id) { JsonResult jresult = new JsonResult(); jresult.JsonRequestBehavior = JsonRequestBehavior.AllowGet; try { ModuleType mt = CommonSrv.LoadObjectById(typeof(ModuleType), Id) as ModuleType; ModuleTypeDTO modultTypeDTO = new ModuleTypeDTO(); modultTypeDTO.Id = mt.Id; modultTypeDTO.Name = mt.Name; modultTypeDTO.OrderId = mt.OrderId; modultTypeDTO.Remark = mt.Remark; jresult.Data = modultTypeDTO; } catch { //TODO js 异常判断 jresult.Data = "[{result:-1}]"; } return(jresult); }
/// <summary> /// 获取角色的详细信息 页面右侧展示信息 /// </summary> /// <param name="Id">RoleId</param> /// <returns></returns> public JsonResult RoleInfo(string Id) { JsonResult jresult = new JsonResult(); jresult.JsonRequestBehavior = JsonRequestBehavior.AllowGet; try { Role role = CommonSrv.LoadObjectById(typeof(Role), Id) as Role; RoleDTO rdto = new RoleDTO(); rdto.Id = role.Id; rdto.Name = role.Name; rdto.OrderId = role.OrderId; rdto.Remark = role.Remark; jresult.Data = rdto; } catch { //TODO js 异常判断 jresult.Data = "[{result:-1}]"; } return(jresult); }
/// <summary> /// 获取Roletype 详情,返回json 数据 /// </summary> /// <param name="Id"></param> /// <returns></returns> public JsonResult RoleTypeInfo(string Id) { JsonResult jresult = new JsonResult(); jresult.JsonRequestBehavior = JsonRequestBehavior.AllowGet; try { RoleType domain = CommonSrv.LoadObjectById(typeof(RoleType), Id) as RoleType; RoleTypeDTO dto = new RoleTypeDTO(); dto.Id = domain.Id; dto.Name = domain.Name; dto.OrderId = domain.OrderId; dto.Remark = domain.Remark; jresult.Data = dto; } catch { //TODO js 异常判断 jresult.Data = "[{result:-1}]"; } return(jresult); }
public ActionResult RolesTree(string Id) { IList ilRoleType = RoleTypeSrv.GetAllTopRoleType(); Staff staff = CommonSrv.LoadObjectById(typeof(Staff), Id) as Staff; NodeType ntype = new NodeType(); ntype.id = "0"; ntype.text = "角色分类"; ntype.ntype = "root"; var ilNodeType = GetModulePermissionList(ilRoleType, staff); ntype.children = ilNodeType; var rNodeType = new List <NodeType>(); rNodeType.Add(ntype); string jsonResult = JsonConvert.SerializeObject(rNodeType, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); return(Content(jsonResult, "application/json")); }
private void LoadModuleTree() { //获取当前登录的职员信息。 StaffSession ss = SessionUtil.GetStaffSession(); Staff s = CommonSrv.LoadObjectById(typeof(Staff), ss.LoginId) as Staff; //获取所有顶层模块。 IList ilModuleType = ModuleTypeSrv.GetAllTopModuleType(); //增加模块分类和模块。 foreach (ModuleType mt in ilModuleType) { Microsoft.Web.UI.WebControls.TreeNode node = new Microsoft.Web.UI.WebControls.TreeNode(); tvModules.Nodes.Add(node); node.Type = "moduletype"; node.Text = mt.Name; AddSubNodes(node, mt, s); node.Expanded = true; } //删除不必要的模块分类节点。 RemoveNeedlessModuleType(null); }
public ActionResult PermissionsTree(string Id) { Staff role = CommonSrv.LoadObjectById(typeof(Staff), Id) as Staff; //权限。 SysCodeType sct = SysCodeTypeSrv.GetSysCodeTypeByTag("rights"); NodeType ntype = new NodeType(); ntype.id = "0"; ntype.text = "模块分类"; ntype.ntype = "root"; IList ilModuleType = ModuleTypeSrv.GetAllTopModuleType(); var ilNodeType = GetModulePermissionList(ilModuleType, sct, role); ntype.children = ilNodeType; var rNodeType = new List <NodeType>(); rNodeType.Add(ntype); string jsonResult = JsonConvert.SerializeObject(rNodeType, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); return(Content(jsonResult, "application/json")); }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); try { //填充下拉框。 FillSelects(); if (Request.QueryString["mode"] == "new") { divTitleMess.InnerText = "新增职员"; } else if (Request.QueryString["mode"] == "edit") { divTitleMess.InnerText = "编辑职员"; string id = Request.QueryString["id"]; if (id != null) { Staff s = CommonSrv.LoadObjectById(typeof(Staff), id) as Staff; txtStaffLoginId.Value = s.LoginId; txtStaffName.Value = s.Name; cbStaffDisabled.Checked = (s.Disabled == 1); txtStaffOrderId.Value = s.OrderId.ToString(); txtStaffIdCard.Value = s.IdCard; txtStaffCode.Value = s.Code; if (s.DegreeTag != null && s.DegreeTag.Length > 0) { ListItem liDegree = selectStaffDegree.Items.FindByValue(s.DegreeTag); if (liDegree != null) { liDegree.Selected = true; } } if (s.Sex.HasValue) { ListItem liSex = selectStaffSex.Items.FindByValue(s.Sex.Value.ToString()); if (liSex != null) { liSex.Selected = true; } } if (s.PoliticalAppearanceTag != null && s.PoliticalAppearanceTag.Length > 0) { ListItem liPolitical = selectStaffPolitical.Items.FindByValue(s.PoliticalAppearanceTag); if (liPolitical != null) { liPolitical.Selected = true; } } if (s.Married.HasValue) { ListItem liMarried = selectStaffMarried.Items.FindByValue(s.Married.Value.ToString()); if (liMarried != null) { liMarried.Selected = true; } } if (s.Birthday.HasValue) { txtStaffBirthday.Value = s.Birthday.Value.ToString("yyyy-MM-dd"); } if (s.CountryTag != null && s.CountryTag.Length > 0) { ListItem liCountry = selectStaffCountry.Items.FindByValue(s.CountryTag); if (liCountry != null) { liCountry.Selected = true; } } if (s.EntersDay.HasValue) { txtStaffEntersDay.Value = s.EntersDay.Value.ToString("yyyy-MM-dd"); } if (s.NationTag != null && s.NationTag.Length > 0) { ListItem liNation = selectStaffNation.Items.FindByValue(s.NationTag); if (liNation != null) { liNation.Selected = true; } } if (s.LeavesDay.HasValue) { txtStaffLeavesDay.Value = s.LeavesDay.Value.ToString("yyyy-MM-dd"); } if (s.PositionTag != null && s.PositionTag.Length > 0) { ListItem liPosition = selectStaffPosition.Items.FindByValue(s.PositionTag); if (liPosition != null) { liPosition.Selected = true; } } txtStaffOfficePhone.Value = s.OfficePhone; if (s.TitleTag != null && s.TitleTag.Length > 0) { ListItem liTitle = selectStaffTitle.Items.FindByValue(s.TitleTag); if (liTitle != null) { liTitle.Selected = true; } } txtStaffExtNumber.Value = s.ExtNumber; txtStaffCellPhone.Value = s.CellPhone; txtStaffFamilyPhone.Value = s.FamilyPhone; txtStaffEmail.Value = s.Email; txtStaffZipCode.Value = s.ZipCode; txtaStaffRemark.Value = s.Remark; txtaStaffAddress.Value = s.Address; } } } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(this.GetType(), "error", "<script type=\"text/javascript\">error=true;</script>"); log.Error(null, ex); } }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); try { //模块权限。 SysCodeType sct = SysCodeTypeSrv.GetSysCodeTypeByTag("rights"); StringBuilder sb = new StringBuilder(); if (Request.QueryString["mode"] == "new") { divTitleMess.InnerText = "新增模块"; if (sct != null) { for (int i = 0; i < sct.SysCodes.Count; i++) { SysCode sc = sct.SysCodes[i] as SysCode; sb.Append("<div><input type=checkbox id='" + sc.Tag + "' />" + sc.Name + "</div>"); } divRights.InnerHtml = sb.ToString(); } } else if (Request.QueryString["mode"] == "edit") { divTitleMess.InnerText = "编辑模块"; string id = Request.QueryString["id"]; if (id != null) { Module m = CommonSrv.LoadObjectById(typeof(Module), id) as Module; txtModuleTag.Value = m.Tag; txtModuleName.Value = m.Name; txtModuleOrderId.Value = m.OrderId.ToString(); txtaModuleRemark.Value = m.Remark; txtModuleModuleUrl.Value = m.ModuleUrl; cbModuleDisabled.Checked = (m.Disabled == 1); if (sct != null) { for (int i = 0; i < sct.SysCodes.Count; i++) { SysCode sc = sct.SysCodes[i] as SysCode; if (m.ModuleRights.Contains(sc.Tag)) { sb.Append("<div><input type=checkbox checked id='" + sc.Tag + "' />" + sc.Name + "</div>"); } else { sb.Append("<div><input type=checkbox id='" + sc.Tag + "' />" + sc.Name + "</div>"); } } divRights.InnerHtml = sb.ToString(); } } } } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(this.GetType(), "error", "<script type=\"text/javascript\">error=true;</script>"); log.Error(null, ex); } }