public string GetSystemTypeByUserID(string UserID, ref string StrResult) { //using (SysUserRoleBLL RoleBll = new SysUserRoleBLL()) //{ // return RoleBll.GetSystemTypeByUserID(UserID, ref StrResult); //} SysUserRoleBLL RoleBll = new SysUserRoleBLL(); return(RoleBll.GetSystemTypeByUserID(UserID, ref StrResult)); }
public void GetTreeList(string userName) { SysUserRoleBLL sysUserRoleBLL = new SysUserRoleBLL(); SysPermissionBLL sysPermissionBLL = new SysPermissionBLL(); List <SysUserRoleModel> userRoleModelList = sysUserRoleBLL.GetByUserId(userName); List <SysPermissionModel> permissionList = new List <SysPermissionModel>(); foreach (var a in userRoleModelList) { permissionList.AddRange(sysPermissionBLL.GetByRoleId(a.RoleId)); } GetTree(permissionList); }
//修改用户角色 public void UserRoleUpdateInfo(T_SYS_USERROLE UserRoleObj) { using (SysUserRoleBLL UserRoleBll = new SysUserRoleBLL()) { UserRoleBll.SysUserRoleUpdate(UserRoleObj); } }
public bool BatchAddUserRole(List<T_SYS_USERROLE> RoleObj, ref string IsResult) { using (SysUserRoleBLL UserRoleBll = new SysUserRoleBLL()) { return UserRoleBll.BatchAddUserRoleInfoByUserRoleList(RoleObj, ref IsResult); } }
//添加用户角色 public bool UserRoleBatchAddInfos(T_SYS_ROLE[] RoleList, T_SYS_USER userobj, string StrUserName, DateTime AddDate) { using (SysUserRoleBLL UserRoleBll = new SysUserRoleBLL()) { //先清缓存GetSysUserRoleByUser string keyString = "GetSysUserRoleByUser" + userobj.SYSUSERID; WCFCache.Current[keyString] = null; return UserRoleBll.BatchAddUserRoleInfo(userobj, RoleList, StrUserName, AddDate); } }
public List<T_SYS_USER> GetSysUserByRoleToEmployeeLeave(string roleID) { using (SysUserRoleBLL bll = new SysUserRoleBLL()) { List<T_SYS_USER> userList; IQueryable<T_SYS_USER> IQList = bll.GetSysUserByRole(roleID); userList = IQList == null ? null : IQList.ToList(); return userList != null ? userList : null; } }
/// <summary> /// 根据用户系统ID获取用户所拥有的系统模块目录信息。 /// </summary> /// <param name="userSysID">用户系统ID</param> /// <returns>生成后的模块集合</returns> public List<ModuleInfo> GetModuleCatalogByUser(string userSysID) { Tracer.Debug("GetModuleCatalogByUser Start,! userSysID:" + userSysID); DateTime dtstart = DateTime.Now; try { string result = string.Empty; SysUserRoleBLL RoleBll = new SysUserRoleBLL(); string syscodes = RoleBll.GetSystemTypeByUserID(userSysID, ref result); string[] codelist = syscodes.Split(','); List<ModuleInfo> moduleinfos = GetModulesBySystemCode(codelist); List<ModuleInfo> tempModules = new List<ModuleInfo>(); SysEntityMenuBLL pmbll = new SysEntityMenuBLL(); List<V_UserMenuPermission> pmList = pmbll.GetSysLeftMenuFilterPermissionToNewFrame(userSysID); var menuList = from ent in pmList orderby ent.SYSTEMTYPE, ent.ORDERNUMBER select ent; foreach (var item in menuList) { var childs = menuList.Where(mm => mm.EntityMenuFatherID == item.ENTITYMENUID); if (item.ENTITYMENUID == "9b58888d-cf4e-40cf-bab6-de4ee00d0ceb") { Tracer.Debug("!已获取到(新)流程定义"); } if (item.ENTITYMENUID == "709D9380-5405-4429-B047-20100401D255") { Tracer.Debug("!已获取到系统科目字典维护"); } else { Tracer.Debug("已获取到菜单:" + item.MENUNAME); } ModuleInfo parentModule = moduleinfos.FirstOrDefault(e => (e.ModuleCode == item.SYSTEMTYPE)); ModuleInfo module = new ModuleInfo() { ModuleCode = item.MENUCODE, ModuleIcon = item.MENUICONPATH, ModuleName = item.ENTITYMENUID, ParentModuleID = item.EntityMenuFatherID, ModuleID = item.ENTITYMENUID, SystemType = item.SYSTEMTYPE, ClientID = item.CHILDSYSTEMNAME, ModuleType = item.URLADDRESS, Description = item.MENUNAME, UseState = "0" }; if ((childs.Count() > 0)) { module.ParentModuleID = item.SYSTEMTYPE; } //配置菜单的依赖系统关系 module.DependsOn = new System.Collections.ObjectModel.Collection<string>(); if (parentModule != null) { module.DependsOn.Add(parentModule.ModuleName); if (item.CHILDSYSTEMNAME != null) { //SMT.FBAnalysis.UI if (parentModule.ModuleName != item.CHILDSYSTEMNAME && parentModule.ModuleName != "SMT.SaaS.LM.UI") { module.DependsOn.Add(item.CHILDSYSTEMNAME); //Debug.WriteLine(parentModule.ModuleName+" => "+item.CHILDSYSTEMNAME); } } } if (item.URLADDRESS != null) { if (item.URLADDRESS.IndexOf("[mvc]") >= 0) module.ModuleType = item.URLADDRESS; //增加平台兼容地址获取 else RefreshModuleType(parentModule, module, item.CHILDSYSTEMNAME, item.URLADDRESS); } tempModules.Add(module); } moduleinfos.AddRange(tempModules); return moduleinfos; } catch (Exception ex) { Tracer.Debug("Dal GetModuleCatalogByUser 异常:" + ex.ToString()); //throw ex; return new List<ModuleInfo>(); } finally { TimeSpan ts = DateTime.Now.Subtract(dtstart); Tracer.Debug("GetModuleCatalogByUser completed !耗时:" + ts.TotalSeconds + "s userSysID:" + userSysID); } }
public string GetSystemTypeByUserID(string UserID, ref string StrResult) { using (SysUserRoleBLL RoleBll = new SysUserRoleBLL()) { return RoleBll.GetSystemTypeByUserID(UserID, ref StrResult); //InstantMessagingServices instang = new InstantMessagingServices(); //instang.EmployeeLogin("zhangwei", "5D5CF0D006578902A0D50FF33ABC2D6F"); //return null; } }
public List<V_Permission> GetUserPermissionByUser(string userID) { using (SysUserBLL bll = new SysUserBLL()) { SysUserRoleBLL RoleBll = new SysUserRoleBLL(); string StrResult = ""; RoleBll.GetSystemTypeByUserID(userID, ref StrResult); #region List<V_Permission> plist; string keyString = "GetUserPermissionByUser" + userID; if (WCFCache.Current[keyString] == null) { IQueryable<V_Permission> IQList = bll.GetUserPermissionByUser(userID); plist = IQList == null ? null : IQList.ToList(); WCFCache.Current.Insert(keyString, plist, DateTime.Now.AddMinutes(15)); } else { plist = (List<V_Permission>)WCFCache.Current[keyString]; } #endregion return plist.Count() > 0 ? plist : null; } }
public List<T_SYS_USERROLE> GetSysUserRoleByType(string systemType) { using (SysUserRoleBLL bll = new SysUserRoleBLL()) { #region List<T_SYS_USERROLE> menuList; string keyString = "GetSysUserRoleByType" + systemType; if (WCFCache.Current[keyString] == null) { IQueryable<T_SYS_USERROLE> IQList = bll.GetSysUserRoleByType(systemType); menuList = IQList == null ? null : IQList.ToList(); WCFCache.Current.Insert(keyString, menuList, DateTime.Now.AddMinutes(15)); } else { menuList = (List<T_SYS_USERROLE>)WCFCache.Current[keyString]; } #endregion return menuList.Count() > 0 ? menuList : null; } }
/// <summary> /// 根据用户系统ID获取用户所拥有的系统模块目录信息。 /// </summary> /// <param name="userSysID">用户系统ID</param> /// <returns>生成后的模块集合</returns> public List <ModuleInfo> GetModuleCatalogByUser(string userSysID) { Tracer.Debug("GetModuleCatalogByUser Start,! userSysID:" + userSysID); DateTime dtstart = DateTime.Now; try { string result = string.Empty; SysUserRoleBLL RoleBll = new SysUserRoleBLL(); string syscodes = RoleBll.GetSystemTypeByUserID(userSysID, ref result); string[] codelist = syscodes.Split(','); List <ModuleInfo> moduleinfos = GetModulesBySystemCode(codelist); List <ModuleInfo> tempModules = new List <ModuleInfo>(); SysEntityMenuBLL pmbll = new SysEntityMenuBLL(); List <V_UserMenuPermission> pmList = pmbll.GetSysLeftMenuFilterPermissionToNewFrame(userSysID); var menuList = from ent in pmList orderby ent.SYSTEMTYPE, ent.ORDERNUMBER select ent; foreach (var item in menuList) { var childs = menuList.Where(mm => mm.EntityMenuFatherID == item.ENTITYMENUID); if (item.ENTITYMENUID == "9b58888d-cf4e-40cf-bab6-de4ee00d0ceb") { Tracer.Debug("!已获取到(新)流程定义"); } if (item.ENTITYMENUID == "709D9380-5405-4429-B047-20100401D255") { Tracer.Debug("!已获取到系统科目字典维护"); } else { Tracer.Debug("已获取到菜单:" + item.MENUNAME); } ModuleInfo parentModule = moduleinfos.FirstOrDefault(e => (e.ModuleCode == item.SYSTEMTYPE)); ModuleInfo module = new ModuleInfo() { ModuleCode = item.MENUCODE, ModuleIcon = item.MENUICONPATH, ModuleName = item.ENTITYMENUID, ParentModuleID = item.EntityMenuFatherID, ModuleID = item.ENTITYMENUID, SystemType = item.SYSTEMTYPE, ClientID = item.CHILDSYSTEMNAME, ModuleType = item.URLADDRESS, Description = item.MENUNAME, UseState = "0" }; if ((childs.Count() > 0)) { module.ParentModuleID = item.SYSTEMTYPE; } //配置菜单的依赖系统关系 module.DependsOn = new System.Collections.ObjectModel.Collection <string>(); if (parentModule != null) { module.DependsOn.Add(parentModule.ModuleName); if (item.CHILDSYSTEMNAME != null) { //SMT.FBAnalysis.UI if (parentModule.ModuleName != item.CHILDSYSTEMNAME && parentModule.ModuleName != "SMT.SaaS.LM.UI") { module.DependsOn.Add(item.CHILDSYSTEMNAME); //Debug.WriteLine(parentModule.ModuleName+" => "+item.CHILDSYSTEMNAME); } } } if (item.URLADDRESS != null) { if (item.URLADDRESS.IndexOf("[mvc]") >= 0) { module.ModuleType = item.URLADDRESS; //增加平台兼容地址获取 } else { RefreshModuleType(parentModule, module, item.CHILDSYSTEMNAME, item.URLADDRESS); } } tempModules.Add(module); } moduleinfos.AddRange(tempModules); return(moduleinfos); } catch (Exception ex) { Tracer.Debug("Dal GetModuleCatalogByUser 异常:" + ex.ToString()); //throw ex; return(new List <ModuleInfo>()); } finally { TimeSpan ts = DateTime.Now.Subtract(dtstart); Tracer.Debug("GetModuleCatalogByUser completed !耗时:" + ts.TotalSeconds + "s userSysID:" + userSysID); } }
/// <summary> /// 更新离职申请记录 /// </summary> /// <param name="entity">离职申请记录实体</param> public void LeftOfficeUpdate(T_HR_LEFTOFFICE entity, ref string strMsg) { try { //SMT.SaaS.BLLCommonServices.PermissionWS.PermissionServiceClient perclient = new SMT.SaaS.BLLCommonServices.PermissionWS.PermissionServiceClient(); string employeeId = entity.T_HR_EMPLOYEE.EMPLOYEEID; T_SYS_USER sysuser = new T_SYS_USER();//perclient.GetUserByEmployeeID(employeeId); using (SysUserBLL bll = new SysUserBLL()) { sysuser = bll.GetUserByEmployeeID(employeeId); } var tmp = from c in dal.GetObjects() where c.T_HR_EMPLOYEE.EMPLOYEEID == entity.T_HR_EMPLOYEE.EMPLOYEEID && (c.CHECKSTATE == "0" || c.CHECKSTATE == "1") && c.T_HR_EMPLOYEEPOST.EMPLOYEEPOSTID == entity.T_HR_EMPLOYEEPOST.EMPLOYEEPOSTID && c.DIMISSIONID != entity.DIMISSIONID select c; if (tmp.Count() > 0) { //throw new Exception("LEFTOFFICESUBMITTED"); strMsg = "LEFTOFFICESUBMITTED"; return; } T_HR_LEFTOFFICE ent = dal.GetTable().FirstOrDefault(s => s.DIMISSIONID == entity.DIMISSIONID); if (ent != null) { if (entity.CHECKSTATE == Convert.ToInt32(CheckStates.Approved).ToString()) { //如果是代理岗位 就将代理岗设为无效 并添加异动记录 EmployeePostBLL epbll = new EmployeePostBLL(); T_HR_EMPLOYEEPOST epost = dal.GetObjects <T_HR_EMPLOYEEPOST>().Include("T_HR_POST").FirstOrDefault(ep => ep.EMPLOYEEPOSTID == entity.T_HR_EMPLOYEEPOST.EMPLOYEEPOSTID); if (epost != null && epost.ISAGENCY == "1") { epost.EDITSTATE = "0"; epbll.EmployeePostUpdate(epost); //删除岗位 #region 添加异动记录 var tmpInfo = from c in dal.GetObjects <T_HR_POST>() join b in dal.GetObjects <T_HR_DEPARTMENT>() on c.T_HR_DEPARTMENT.DEPARTMENTID equals b.DEPARTMENTID where c.POSTID == epost.T_HR_POST.POSTID select new { c.POSTID, b.DEPARTMENTID, b.T_HR_COMPANY.COMPANYID }; EmployeePostChangeBLL epchangeBLL = new EmployeePostChangeBLL(); T_HR_EMPLOYEEPOSTCHANGE postChange = new T_HR_EMPLOYEEPOSTCHANGE(); postChange = new T_HR_EMPLOYEEPOSTCHANGE(); postChange.T_HR_EMPLOYEE = new T_HR_EMPLOYEE(); postChange.T_HR_EMPLOYEE.EMPLOYEEID = entity.T_HR_EMPLOYEE.EMPLOYEEID; postChange.EMPLOYEECODE = entity.T_HR_EMPLOYEE.EMPLOYEECODE; postChange.EMPLOYEENAME = entity.T_HR_EMPLOYEE.EMPLOYEECNAME; postChange.POSTCHANGEID = Guid.NewGuid().ToString(); postChange.CHECKSTATE = Convert.ToInt32(CheckStates.Approved).ToString(); postChange.ISAGENCY = "1"; if (tmpInfo.Count() > 0) { postChange.FROMCOMPANYID = tmpInfo.FirstOrDefault().COMPANYID; postChange.FROMDEPARTMENTID = tmpInfo.FirstOrDefault().DEPARTMENTID; postChange.FROMPOSTID = tmpInfo.FirstOrDefault().POSTID; postChange.OWNERCOMPANYID = tmpInfo.FirstOrDefault().COMPANYID; postChange.OWNERDEPARTMENTID = tmpInfo.FirstOrDefault().DEPARTMENTID; postChange.OWNERPOSTID = tmpInfo.FirstOrDefault().POSTID; } postChange.OWNERID = entity.T_HR_EMPLOYEE.EMPLOYEEID; postChange.POSTCHANGREASON = entity.LEFTOFFICEREASON; postChange.CHANGEDATE = entity.LEFTOFFICEDATE.ToString(); postChange.CREATEUSERID = entity.CREATEUSERID; postChange.POSTCHANGCATEGORY = "3"; string Msg = string.Empty; epchangeBLL.EmployeePostChangeAdd(postChange, ref Msg); #endregion //通知及时通讯 DelImstantMember(entity.T_HR_EMPLOYEE.EMPLOYEEID, epost.T_HR_POST.POSTID); } else { //员工状态修改为离职中 string tmpstr = ""; var employeetmps = from c in dal.GetObjects <T_HR_EMPLOYEE>() where c.EMPLOYEEID == entity.T_HR_EMPLOYEE.EMPLOYEEID select c; if (employeetmps.Count() > 0) { EmployeeBLL bll = new EmployeeBLL(); var employeetmp = employeetmps.FirstOrDefault(); if (employeetmp.EMPLOYEESTATE != "2") //已离职,如果已经离职则不要再改为离职中 { employeetmp.EMPLOYEESTATE = "3"; //离职中 } bll.EmployeeUpdate(employeetmp, ref tmpstr); } } #region 员工离职通知流程管理员进行修改相应的流程 try { SMT.Foundation.Log.Tracer.Debug(System.DateTime.Now.ToString() + " 员工离职审核通过通知流程管理员进行修改相应的流程"); StringBuilder sb = new StringBuilder(); sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); sb.Append("<Root>"); //查出用户的所有角色 List <T_SYS_USERROLE> roleUserList = new List <T_SYS_USERROLE>(); //perclient.GetSysUserRoleByUser(sysuser.SYSUSERID).ToList(); using (SysUserRoleBLL bll = new SysUserRoleBLL()) { roleUserList = bll.GetSysUserRoleByUser(sysuser.SYSUSERID).ToList(); } if (roleUserList != null && roleUserList.Any()) { bool hasRole = false; sb.Append("<Roles>"); foreach (var roleUser in roleUserList) { //查出改用户所在的角色,还有没有其它用户,如果没有则调流程 string roleId = roleUser.T_SYS_ROLE.ROLEID; List <T_SYS_USER> roleUserIncludeSource = new List <T_SYS_USER>();// perclient.GetSysUserByRoleToEmployeeLeave(roleId); using (SysUserRoleBLL bll = new SysUserRoleBLL()) { roleUserIncludeSource = bll.GetSysUserByRole(roleId).ToList(); } if (roleUserIncludeSource == null) { hasRole = true; sb.Append("<Role RoleID=\"" + roleUser.T_SYS_ROLE.ROLEID + "\" RoleName=\"" + roleUser.T_SYS_ROLE.ROLENAME + "\" />"); } else { var roleUserInclude = roleUserIncludeSource.Where(t => t.EMPLOYEEID != employeeId).ToList(); if (roleUserInclude.Count == 0) { hasRole = true; sb.Append("<Role RoleID=\"" + roleUser.T_SYS_ROLE.ROLEID + "\" RoleName=\"" + roleUser.T_SYS_ROLE.ROLENAME + "\" />"); } } } sb.Append("</Roles>"); //如果存在角色 if (hasRole) { var empInfo = from c in dal.GetObjects <T_HR_POST>() join b in dal.GetObjects <T_HR_DEPARTMENT>() on c.T_HR_DEPARTMENT.DEPARTMENTID equals b.DEPARTMENTID join d in dal.GetObjects <T_HR_COMPANY>() on b.T_HR_COMPANY.COMPANYID equals d.COMPANYID where c.POSTID == entity.T_HR_EMPLOYEE.OWNERPOSTID select new { c.T_HR_DEPARTMENT.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME, b.T_HR_COMPANY.BRIEFNAME, c.T_HR_POSTDICTIONARY.POSTNAME }; string companyName = ""; string deptName = ""; string postName = ""; if (empInfo != null) { companyName = empInfo.FirstOrDefault().BRIEFNAME; deptName = empInfo.FirstOrDefault().DEPARTMENTNAME; postName = empInfo.FirstOrDefault().POSTNAME; } sb.Append(" <User UserID=\"" + entity.T_HR_EMPLOYEE.EMPLOYEEID + "\" UserName=\"" + entity.T_HR_EMPLOYEE.EMPLOYEECNAME + "\" CompanyID=\"" + entity.T_HR_EMPLOYEE.OWNERCOMPANYID + "\" CompanyName=\"" + companyName + "\" DeparmentID=\"" + entity.T_HR_EMPLOYEE.OWNERDEPARTMENTID + "\" DeparmentName=\"" + deptName + "\" PostID=\"" + entity.T_HR_EMPLOYEE.OWNERPOSTID + "\" PostName=\"" + postName + "\" />"); bool hasManagerEmail = false; List <T_SYS_USER> flowManagers; //perclient.GetFlowManagers(new string[] { entity.T_HR_EMPLOYEE.OWNERCOMPANYID }); using (SysPermissionBLL bll = new SysPermissionBLL()) { flowManagers = bll.GetFlowManagers(new List <string> { entity.T_HR_EMPLOYEE.OWNERCOMPANYID }); } if (flowManagers != null) { sb.Append("<Admins>"); foreach (var mangers in flowManagers) { string email = ""; var employee = from c in dal.GetObjects <T_HR_EMPLOYEE>() where c.EMPLOYEEID == mangers.EMPLOYEEID select c; if (employee != null) { email = employee.FirstOrDefault().EMAIL; } if (!string.IsNullOrEmpty(email)) { hasManagerEmail = true; sb.Append("<Admin ID=\"" + mangers.EMPLOYEEID + "\" Name=\"" + mangers.EMPLOYEENAME + "\" Email=\"" + email + "\" />"); } } sb.Append("</Admins>"); } sb.Append("</Root>"); if (hasManagerEmail) { //SMT.Foundation.Log.Tracer.Debug(System.DateTime.Now.ToString() + "调用CheckFlowByRole:" + sb.ToString()); //SMT.SaaS.BLLCommonServices.WFPlatformWS.OutInterfaceClient outClient = new SaaS.BLLCommonServices.WFPlatformWS.OutInterfaceClient(); //outClient.CheckFlowByRole(sb.ToString()); } else { SMT.Foundation.Log.Tracer.Debug(System.DateTime.Now.ToString() + "流程管理员没有设置邮箱,不调用CheckFlowByRole"); } } else { SMT.Foundation.Log.Tracer.Debug(System.DateTime.Now.ToString() + "当前用户id:(" + employeeId + ")所在角色还有用户,不调用CheckFlowByRole"); } } else { SMT.Foundation.Log.Tracer.Debug(System.DateTime.Now.ToString() + "没有找到用户的角色"); } } catch (Exception ex) { SMT.Foundation.Log.Tracer.Debug(System.DateTime.Now.ToString() + "调用员工离职审核通过通知流程管理员进行修改相应的流程异常:" + ex.Message.ToString()); } #endregion } Utility.CloneEntity <T_HR_LEFTOFFICE>(entity, ent); if (entity.T_HR_EMPLOYEE != null) { ent.T_HR_EMPLOYEEReference.EntityKey = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_EMPLOYEE", "EMPLOYEEID", entity.T_HR_EMPLOYEE.EMPLOYEEID); } if (entity.T_HR_EMPLOYEEPOST != null) { ent.T_HR_EMPLOYEEPOSTReference.EntityKey = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_EMPLOYEEPOST", "EMPLOYEEPOSTID", entity.T_HR_EMPLOYEEPOST.EMPLOYEEPOSTID); } //dal.Update(ent); Update(ent, ent.CREATEUSERID); } } catch (Exception ex) { strMsg = ex.Message; SMT.Foundation.Log.Tracer.Debug(System.DateTime.Now.ToString() + " LeftOfficeUpdate:" + ex.Message); throw ex; } }
public List<T_SYS_DICTIONARY> GetSystemTypeListByUserID(string StrUserId) { using (SysUserRoleBLL RoleBll = new SysUserRoleBLL()) { return RoleBll.GetSystemTypeListByUserID(StrUserId); //return null; } }
public List<T_SYS_USERROLE> GetSysUserRoleByUser(string UserID) { using (SysUserRoleBLL bll = new SysUserRoleBLL()) { List<T_SYS_USERROLE> userRoleList = bll.GetSysUserRoleByUser(UserID).ToList(); return userRoleList; } }
public string GetSystemTypeByUserID(string UserID, ref string StrResult) { //using (SysUserRoleBLL RoleBll = new SysUserRoleBLL()) //{ // return RoleBll.GetSystemTypeByUserID(UserID, ref StrResult); //} SysUserRoleBLL RoleBll = new SysUserRoleBLL(); return RoleBll.GetSystemTypeByUserID(UserID, ref StrResult); }
public void SysUserRoleUpdate(T_SYS_USERROLE obj) { using (SysUserRoleBLL bll = new SysUserRoleBLL()) { bll.SysUserRoleUpdate(obj); } }
public void SysUserRoleDelete(string userroleid) { using (SysUserRoleBLL bll = new SysUserRoleBLL()) { T_SYS_USERROLE role = new T_SYS_USERROLE(); role = bll.GetSysUserRoleByID(userroleid); if (role != null) { string keyString = "GetSysUserRoleByUser" + role.T_SYS_USER.SYSUSERID; WCFCache.Current[keyString] = null; } bll.SysUserRoleDelete(userroleid); } }
public T_SYS_USERROLE GetSysUserRoleByID(string menuID) { using (SysUserRoleBLL bll = new SysUserRoleBLL()) { return bll.GetSysUserRoleByID(menuID); } }
public bool EmployeeEntryAddDefaultRole(T_SYS_USER user, string companyID, string compayName, string deptID, string postID, string employeeID, string employeePostID) { using (SysUserRoleBLL UserBll = new SysUserRoleBLL()) { return UserBll.EmployeeEntryAddDefaultRole( user, companyID, compayName, deptID, postID, employeeID, employeePostID); } }
public List<T_SYS_USERROLE> GetSysUserRoleByUser(string UserID) { using (SysUserRoleBLL bll = new SysUserRoleBLL()) { #region List<T_SYS_USERROLE> userRoleList; string keyString = "GetSysUserRoleByUser" + UserID; if (WCFCache.Current[keyString] == null) { IQueryable<T_SYS_USERROLE> IQList = bll.GetSysUserRoleByUser(UserID); userRoleList = IQList == null ? null : IQList.ToList(); //WCFCache.Current.Insert(keyString, userRoleList, DateTime.Now.AddMinutes(15)); WCFCache.Current.Insert(keyString, userRoleList, DateTime.Now.AddSeconds(5)); } else { userRoleList = (List<T_SYS_USERROLE>)WCFCache.Current[keyString]; } #endregion return userRoleList; } }
/// <summary> /// 启动与工作流程相同类型流程,查询对应节点用户 /// </summary> /// <param name="CompanyID">公司ID</param> /// <param name="ModelCode">模块代码</param> /// <param name="FlowGUID">待审批流GUID,新增时为空或者为StartFlow</param> /// <returns></returns> public DataResult GetAppUser( string CompanyID, string ModelCode, string FlowGUID, string xml) { Tracer.Debug("GetAppUser 启动与工作流程相同类型流程,查询对应节点用户 ModelCode=" + ModelCode + " FlowGUID=" + FlowGUID + " CompanyID=" + CompanyID); FlowUser user = SUser; DataResult GetAppUserResult = new DataResult(); try { string StateName = null; if (FlowGUID == "" || FlowGUID == "StartFlow") { StateName = "StartFlow"; } else { //根据待审批流程GUID,检索待审批状态节点代码 List<SMT.Workflow.Common.Model.FLOW_FLOWRECORDDETAIL_T> FlowRecord = FlowBLL.GetFlowInfo( "", FlowGUID, "", "", "", "", "", null); if (FlowRecord == null) { GetAppUserResult.Err = "没有待处理的审核"; GetAppUserResult.UserInfo = null; return GetAppUserResult; } StateName = FlowRecord[0].STATECODE; } //根据公司ID,模块代码获取配置的流程 WorkflowInstance instance = null; Tracer.Debug("根据公司ID,模块代码获取配置的流程FlowBLL.GetFlowByModelName:OgrType='0'"); List<SMT.Workflow.Common.Model.FLOW_MODELFLOWRELATION_T> MODELFLOWRELATION = FlowBLL.GetFlowByModelName( CompanyID, "", ModelCode, "0", ref user); if (MODELFLOWRELATION == null || MODELFLOWRELATION.Count == 0) { GetAppUserResult.Err = "没有可使用的流程"; GetAppUserResult.UserInfo = null; return GetAppUserResult; } SMT.Workflow.Common.Model.FLOW_FLOWDEFINE_T Xoml = MODELFLOWRELATION[0].FLOW_FLOWDEFINE_T; XmlReader readerxoml, readerule; StringReader strXoml = new StringReader(Xoml.LAYOUT); StringReader strRules = new StringReader(Xoml.RULES == null ? "" : Xoml.RULES); readerxoml = XmlReader.Create(strXoml); readerule = XmlReader.Create(strRules); WorkflowRuntime workflowRuntime = new WorkflowRuntime(); workflowRuntime.StartRuntime(); FlowEvent ExternalEvent = new FlowEvent(); //ExternalDataExchangeService objService = new ExternalDataExchangeService(); //workflowRuntime.AddService(objService); //objService.AddService(ExternalEvent); //TypeProvider typeProvider = new TypeProvider(null); //workflowRuntime.AddService(typeProvider); ////XmlReader readerxoml = XmlReader.Create(HttpContext.Current.Server.MapPath ("TestFlow.xml")); //// instance = workflowRuntime.CreateWorkflow(readerxoml); //if (Xoml.RULES == null) // instance = workflowRuntime.CreateWorkflow(readerxoml); //else // instance = workflowRuntime.CreateWorkflow(readerxoml, readerule, null); //// instance = workflowRuntime.CreateWorkflow(typeof(TestFlow)); //instance.Start(); //StateMachineWorkflowInstance workflowinstance = new StateMachineWorkflowInstance(workflowRuntime, instance.InstanceId); ////从实例中获取定义 //if (1 == 2) //{ // System.Workflow.Activities.StateMachineWorkflowActivity smworkflow = new StateMachineWorkflowActivity(); // smworkflow = workflowinstance.StateMachineWorkflow; // RuleDefinitions ruleDefinitions = smworkflow.GetValue(RuleDefinitions.RuleDefinitionsProperty) as RuleDefinitions; // WorkflowMarkupSerializer markupSerializer = new WorkflowMarkupSerializer(); // StringBuilder xoml = new StringBuilder(); // StringBuilder rule = new StringBuilder(); // XmlWriter xmlWriter = XmlWriter.Create(xoml); // XmlWriter ruleWriter = XmlWriter.Create(rule); // markupSerializer.Serialize(xmlWriter, smworkflow); // markupSerializer.Serialize(ruleWriter, ruleDefinitions); // xmlWriter.Close(); // ruleWriter.Close(); // StringReader readxoml = new StringReader(xoml.ToString()); // StringReader readrule = new StringReader(rule.ToString()); // XmlReader readerxoml2 = XmlReader.Create(readxoml); // XmlReader readerrule2 = XmlReader.Create(readrule); // WorkflowInstance instance1 = workflowRuntime.CreateWorkflow(readerxoml2, readerrule2, null); // instance1.Start(); // StateMachineWorkflowInstance workflowinstance1 = new StateMachineWorkflowInstance(workflowRuntime, instance1.InstanceId); // workflowinstance1.SetState(StateName); //} //从实例中获取定义并启动新实例 //跳转到节点StateName //workflowinstance.SetState(StateName); FlowDataType.FlowData FlowData = new FlowDataType.FlowData(); FlowData.xml = xml; // FlowData.Flow_FlowRecord_T = null; //ExternalEvent.OnDoFlow(instance.InstanceId, FlowData);//激发流程引擎流转到下一状态 System.Threading.Thread.Sleep(1000); //PermissionServiceClient WcfPermissionService = new PermissionServiceClient(); string CurrentStateName = ""; //workflowinstance.CurrentStateName == null ? "End" : //workflowinstance.CurrentStateName; //取得当前状态 List<UserInfo> listUser = new List<UserInfo>(); if (CurrentStateName != "End") { if (CurrentStateName.Substring(0, 5) == "State") { CurrentStateName = CurrentStateName.Substring(5); } string roleID = new Guid(CurrentStateName).ToString("D"); List<T_SYS_USER> User = new List<T_SYS_USER>(); //WcfPermissionService.GetSysUserByRole(WFCurrentStateName); //检索本状态(角色)对应用户 using (SysUserRoleBLL bll = new SysUserRoleBLL()) { IQueryable<T_SYS_USER> IQList = bll.GetSysUserByRole(roleID); User = IQList == null ? null : IQList.ToList(); } if (User != null) for (int i = 0; i < User.Count(); i++) { UserInfo tmp = new UserInfo(); tmp.UserID = User[i].EMPLOYEEID; tmp.UserName = User[i].EMPLOYEENAME; listUser.Add(tmp); } } else { //已经到流程结束状态 UserInfo tmp = new UserInfo(); tmp.UserID = "End"; tmp.UserName = "******"; listUser.Add(tmp); } GetAppUserResult.UserInfo = listUser.Count > 0 ? listUser : null; if (GetAppUserResult.UserInfo == null) GetAppUserResult.Err = "没有找到用户"; return GetAppUserResult; // return listUser; //return workflowinstance.CurrentStateName == null ? "End" : workflowinstance.CurrentStateName; } catch (Exception ex) { GetAppUserResult.Err = ex.Message; GetAppUserResult.UserInfo = null; return GetAppUserResult; } }
public List<T_SYS_USER> GetSysUserByRole(string roleID) { using (SysUserRoleBLL bll = new SysUserRoleBLL()) { #region List<T_SYS_USER> userList; string keyString = "GetSysUserByRole" + roleID; if (WCFCache.Current[keyString] == null) { IQueryable<T_SYS_USER> IQList = bll.GetSysUserByRole(roleID); userList = IQList == null ? null : IQList.ToList(); WCFCache.Current.Insert(keyString, userList, DateTime.Now.AddMinutes(15)); } else { userList = (List<T_SYS_USER>)WCFCache.Current[keyString]; } #endregion return userList != null ? userList : null; } }