private int GetCustomPerms(string menuCode, T_HR_EMPLOYEE emp) { int perm = 99; return(perm); //暂时未实现 //过滤自定义的权限 //emp = //if (!emp.T_HR_EMPLOYEEPOST.IsLoaded) //{ // emp.T_HR_EMPLOYEEPOST.Load(); //} if (emp != null) { foreach (T_HR_EMPLOYEEPOST ep in emp.T_HR_EMPLOYEEPOST) { if (!ep.T_HR_POSTReference.IsLoaded) { ep.T_HR_POSTReference.Load(); } if (ep.T_HR_POST != null && ep.T_HR_POST.T_HR_DEPARTMENTReference.IsLoaded == false) { ep.T_HR_POST.T_HR_DEPARTMENTReference.Load(); } if (ep.T_HR_POST != null && ep.T_HR_POST.T_HR_DEPARTMENT != null && ep.T_HR_POST.T_HR_DEPARTMENT.T_HR_COMPANYReference.IsLoaded == false) { ep.T_HR_POST.T_HR_DEPARTMENT.T_HR_COMPANYReference.Load(); } IQueryable <T_SYS_ENTITYMENUCUSTOMPERM> custPerms; //查看有没有岗位的特别权限 EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL(); custPerms = bll.GetCustomPostMenuPerms(menuCode, ep.T_HR_POST.POSTID); if (custPerms != null && custPerms.Count() > 0) { perm = Convert.ToInt32(AssignObjectType.Post); } //查看有没有部门的特别权限 custPerms = bll.GetCustomDepartMenuPerms(menuCode, ep.T_HR_POST.T_HR_DEPARTMENT.DEPARTMENTID); if (custPerms != null && custPerms.Count() > 0) { perm = Convert.ToInt32(AssignObjectType.Department); } //查看有没有公司的特别权限 custPerms = bll.GetCustomCompanyMenuPerms(menuCode, ep.T_HR_POST.T_HR_DEPARTMENT.T_HR_COMPANY.COMPANYID); if (custPerms != null && custPerms.Count() > 0) { perm = Convert.ToInt32(AssignObjectType.Company); } } } return(perm); }
public T_SYS_ENTITYMENUCUSTOMPERM GetCustomerPermissionByUserIDAndEntityCode(string StrUserId, string StrEntityCode) { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { return(bll.GetCustomerPermissionByUserIDAndEntityCode(StrUserId, StrEntityCode)); } }
public T_SYS_ENTITYMENUCUSTOMPERM GetCustomerPermissionByUserIDAndEntityCode(string StrUserId, string StrEntityCode) { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { return bll.GetCustomerPermissionByUserIDAndEntityCode(StrUserId, StrEntityCode); } }
public List<T_SYS_ENTITYMENUCUSTOMPERM> GetCustomCompanyMenuPerms(string menuCode, string companyID) { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { #region List<T_SYS_ENTITYMENUCUSTOMPERM> perms; string keyString = "GetCustomCompanyMenuPerms" + menuCode + companyID; if (WCFCache.Current[keyString] == null) { IQueryable<T_SYS_ENTITYMENUCUSTOMPERM> IQList = bll.GetCustomCompanyMenuPerms(menuCode, companyID); perms = IQList == null ? null : IQList.ToList(); WCFCache.Current.Insert(keyString, perms, DateTime.Now.AddMinutes(15)); } else { perms = (List<T_SYS_ENTITYMENUCUSTOMPERM>)WCFCache.Current[keyString]; } #endregion return perms.Count() > 0 ? perms : null; } }
public void EntityMenuCustomPermDelete(string id) { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { bll.EntityMenuCustomPermDelete(id); } }
public void EntityMenuCustomPermUpdate(T_SYS_ENTITYMENUCUSTOMPERM obj) { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { bll.EntityMenuCustomPermUpdate(obj); } }
public T_SYS_ENTITYMENUCUSTOMPERM GetEntityMenuCustomPermByID(string id) { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { return bll.GetEntityMenuCustomPermByID(id); } }
public List<T_SYS_ENTITYMENUCUSTOMPERM> GetEntityMenuCustomPermByType(string systemType) { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { IQueryable<T_SYS_ENTITYMENUCUSTOMPERM> menuList = bll.GetEntityMenuCustomPermByType(systemType); return menuList.Count() > 0 ? menuList.ToList() : null; } }
public static string GetCustomerPermissionJson(string roleId) { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { IQueryable<T_SYS_ENTITYMENUCUSTOMPERM> cuspers = bll.GetCustomPermByRoleID(roleId); var q = from ent in cuspers group ent by new { ent.T_SYS_ENTITYMENU.ENTITYMENUID, ent.T_SYS_PERMISSION.PERMISSIONID } into g select new { MenuId = g.Key.ENTITYMENUID, PermissionId = g.Key.PERMISSIONID, g }; CustomerPermission obj = new CustomerPermission(); obj.EntityMenuId = q.FirstOrDefault().MenuId; obj.PermissionValue = new List<PermissionValue>(); foreach (var menus in q) { PermissionValue menuP = new PermissionValue(); menuP.Permission = menus.PermissionId; menuP.OrgObjects = new List<OrgObject>(); foreach (var item in menus.g) { OrgObject orgobj = new OrgObject(); if (!string.IsNullOrWhiteSpace(item.COMPANYID)) { orgobj.OrgID = item.COMPANYID; orgobj.OrgType = "0"; } if (!string.IsNullOrWhiteSpace(item.DEPARTMENTID)) { orgobj.OrgID = item.DEPARTMENTID; orgobj.OrgType = "1"; } if (!string.IsNullOrWhiteSpace(item.POSTID)) { orgobj.OrgID = item.POSTID; orgobj.OrgType = "2"; } menuP.OrgObjects.Add(orgobj); } obj.PermissionValue.Add(menuP); } //objs.PermissionValue = p; return JsonHelper.GetJson<CustomerPermission>(obj); } }
public bool UpdateCutomterPermissionObj(string RoleID, List<CustomerPermission> objs, ref string strResult) { try { //using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) //{ EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL(); if (string.IsNullOrWhiteSpace(RoleID)) { return false; } return bll.UpdateCustomerPermissionnew(RoleID, objs, ref strResult); //} } catch (Exception ex) { strResult = ex.Message; return false; } }
public void SetCutomterPermissionObj(string RoleID, List<CustomerPermission> objs, ref string strResult) { try { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { if (string.IsNullOrWhiteSpace(RoleID)) { return; } RoleEntityMenuBLL roleEmBll = new RoleEntityMenuBLL(); roleEmBll.UpdateRoleInfo(RoleID, strResult);//修改信息 strResult = string.Empty; IQueryable<T_SYS_ENTITYMENUCUSTOMPERM> cuspers = bll.GetCustomPermByRoleID(RoleID); //if (cuspers != null) //{ // if (cuspers.Count() > 0) // { // foreach (T_SYS_ENTITYMENUCUSTOMPERM item in cuspers) // { // string strId = item.ENTITYMENUCUSTOMPERMID; // EntityMenuCustomPermDelete(strId); // } // } //} SysPermissionBLL bllPer = new SysPermissionBLL(); T_SYS_ROLE entRole = GetSysRoleSingleInfoById(RoleID);//获取角色ID实体对象 foreach (var Menus in objs) { if (Menus.PermissionValue == null) { continue; } if (Menus.PermissionValue.Count() == 0) { continue; } T_SYS_ENTITYMENU entMenu = GetSysMenuByID(Menus.EntityMenuId); foreach (var Perms in Menus.PermissionValue) { if (Perms.OrgObjects == null) { continue; } if (Perms.OrgObjects.Count() == 0) { continue; } T_SYS_PERMISSION entPer = bllPer.GetAttachSysPermissionByID(Perms.Permission);//获取权限实体对象 foreach (var OrgIns in Perms.OrgObjects) { T_SYS_ENTITYMENUCUSTOMPERM customerPer = new T_SYS_ENTITYMENUCUSTOMPERM(); customerPer.ENTITYMENUCUSTOMPERMID = Guid.NewGuid().ToString(); customerPer.T_SYS_ROLEReference.EntityKey = entRole.EntityKey; customerPer.T_SYS_ROLE = entRole; //customerPer.T_SYS_ENTITYMENU = entMenu; customerPer.T_SYS_ENTITYMENUReference.EntityKey = entMenu.EntityKey; customerPer.T_SYS_ENTITYMENU = entMenu; //customerPer.T_SYS_PERMISSION = entPer; customerPer.T_SYS_PERMISSIONReference.EntityKey = entPer.EntityKey; customerPer.T_SYS_PERMISSION = entPer; switch (OrgIns.OrgType) { //公司 case "0": customerPer.COMPANYID = OrgIns.OrgID; break; case "1"://部门 customerPer.DEPARTMENTID = OrgIns.OrgID; break; case "2"://岗位 customerPer.POSTID = OrgIns.OrgID; break; } customerPer.CREATEDATE = DateTime.Now; customerPer.UPDATEDATE = DateTime.Now; EntityMenuCustomPermAdd(customerPer); } } } } } catch (Exception ex) { strResult = ex.Message; } }
public List<CustomerPermission> GetCutomterPermissionObj(string RoleID) { //EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL(); //IQueryable<T_SYS_ENTITYMENUCUSTOMPERM> CusPermissions = bll.GetCustomPermByRoleID(RoleID); try { SMT.Foundation.Log.Tracer.Debug("开始获取自定义角色222:" + RoleID + " " + System.DateTime.Now.ToString()); using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { IQueryable<V_EntityMenuCustomperm> cuspers = bll.GetCustomPermByRoleIDNew(RoleID); List<CustomerPermission> CusPers = new List<CustomerPermission>(); if (cuspers != null) { //var entiyMenuPs = from ent in cuspers // where ent.T_SYS_ROLE.ROLEID == RoleID // select ent; SMT.Foundation.Log.Tracer.Debug("开始获取自定义角色记录数:" + cuspers.Count().ToString() + " " + System.DateTime.Now.ToString()); if (cuspers.Count() > 0) { //遍历取菜单 foreach (var menus in cuspers) { CustomerPermission obj = new CustomerPermission(); obj.EntityMenuId = menus.ENTITYMENUID; obj.PermissionValue = new List<PermissionValue>(); if (cuspers.Count() > 0) { var ent1 = from ent in CusPers where ent.EntityMenuId == obj.EntityMenuId select ent; if (ent1.Count() > 0) continue; } //遍历取权限 var Perms = from ent in cuspers where ent.ENTITYMENUID == menus.ENTITYMENUID select ent; foreach (var Perm in Perms) { PermissionValue menuP = new PermissionValue(); menuP.Permission = Perm.PERMISSIONID; menuP.OrgObjects = new List<OrgObject>(); //遍历组织架构 var orgObj = from ent in cuspers where ent.ENTITYMENUID == menus.ENTITYMENUID && ent.PERMISSIONID == Perm.PERMISSIONID select ent; foreach (var item in orgObj) { OrgObject orgobj = new OrgObject(); if (!string.IsNullOrWhiteSpace(item.COMPANYID)) { orgobj.OrgID = item.COMPANYID; orgobj.OrgType = "0"; } if (!string.IsNullOrWhiteSpace(item.DEPARTMENTID)) { orgobj.OrgID = item.DEPARTMENTID; orgobj.OrgType = "1"; } if (!string.IsNullOrWhiteSpace(item.POSTID)) { orgobj.OrgID = item.POSTID; orgobj.OrgType = "2"; } menuP.OrgObjects.Add(orgobj); } obj.PermissionValue.Add(menuP); } CusPers.Add(obj); } } } return CusPers; } } catch (Exception ex) { SMT.Foundation.Log.Tracer.Debug("GetCutomterPermissionObj:" + ex.Message.ToString()); return null; } }
public List<T_SYS_ENTITYMENUCUSTOMPERM> GetCustomPostMenuPerms(string menuCode, string postID) { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { #region 龙康才新增 IQueryable<T_SYS_ENTITYMENUCUSTOMPERM> perms; string keyString = "GetCustomPostMenuPerms" + menuCode + postID; if (WCFCache.Current[keyString] == null) { perms = bll.GetCustomPostMenuPerms(menuCode, postID); WCFCache.Current.Insert(keyString, perms, DateTime.Now.AddMinutes(15)); } else { perms = (IQueryable<T_SYS_ENTITYMENUCUSTOMPERM>)WCFCache.Current[keyString]; } #endregion return perms.Count() > 0 ? perms.ToList() : null; } }
public List<T_SYS_ENTITYMENUCUSTOMPERM> GetCustomCompanyMenuPerms(string menuCode, string companyID) { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { List<T_SYS_ENTITYMENUCUSTOMPERM> perms; IQueryable<T_SYS_ENTITYMENUCUSTOMPERM> IQList = bll.GetCustomCompanyMenuPerms(menuCode, companyID); perms = IQList == null ? null : IQList.ToList(); return perms.Count() > 0 ? perms : null; } }
public List<T_SYS_ENTITYMENUCUSTOMPERM> GetCustomPostMenuPerms(string menuCode, string postID) { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { IQueryable<T_SYS_ENTITYMENUCUSTOMPERM> perms; perms = bll.GetCustomPostMenuPerms(menuCode, postID); return perms.Count() > 0 ? perms.ToList() : null; } }