/// <summary> /// 查询 /// </summary> /// <param name="userInfo"></param> /// <param name="userId"></param> /// <param name="categoryCode"></param> /// <param name="searchValue"></param> /// <param name="enabled"></param> /// <param name="deletionStateCode"></param> /// <returns></returns> public DataTable Search(BaseUserInfo userInfo, string userId, string categoryCode, string searchValue, bool?enabled, bool?deletionStateCode) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = new DataTable(BaseWorkFlowBillTemplateEntity.TableName); using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { dbHelper.Open(WorkFlowDbConnection); BaseWorkFlowBillTemplateManager templateManager = new BaseWorkFlowBillTemplateManager(dbHelper, userInfo); dataTable = templateManager.Search(userId, categoryCode, searchValue, enabled, deletionStateCode); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(dataTable); }
/// <summary> /// 批量删除 /// </summary> /// <param name="userInfo">用户</param> /// <param name="ids">主键数组</param> /// <returns>影响行数</returns> public int BatchDeleteConstraint(BaseUserInfo userInfo, string[] ids) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif int returnValue = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BasePermissionScopeManager manager = new BasePermissionScopeManager(dbHelper, userInfo); returnValue = manager.SetDeleted(ids); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.TableColumnsService_BatchDeleteConstraint, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 操作权限主健数组 /// </summary> /// <param name="userInfo">用户</param> /// <param name="moduleId">模块主键</param> /// <returns>主键数组</returns> public string[] GetIdsByModule(BaseUserInfo userInfo, string moduleId) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif string[] returnValue = null; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BasePermissionModuleManager modulePermissionManager = new BasePermissionModuleManager(dbHelper, userInfo); returnValue = modulePermissionManager.GetPermissionIds(moduleId); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionItemService_GetIdsByModule, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 某个用户是否超级管理员 /// </summary> /// <param name="userInfo"></param> /// <param name="userId"></param> /// <returns>是超级管理员</returns> public bool IsAdministratorByUser(BaseUserInfo userInfo, string userId) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif bool returnValue = false; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); returnValue = userManager.IsAdministrator(userId); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_IsAdministratorByUser, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 移动数据 /// </summary> /// <param name="userInfo">用户</param> /// <param name="organizeId">组织机构</param> /// <param name="parentId">父主键</param> /// <returns>影响行数</returns> public int MoveTo(BaseUserInfo userInfo, string organizeId, string parentId) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif int returnValue = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseOrganizeManager organizeManager = new BaseOrganizeManager(dbHelper, userInfo); returnValue = organizeManager.MoveTo(organizeId, parentId); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.OrganizeService_MoveTo, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 按用户获取日志 /// </summary> /// <param name="userInfo">用户</param> /// <param name="userId">用户主键</param> /// <param name="beginDate">开始时间</param> /// <param name="endDate">结束时间</param> /// <returns>数据表</returns> public DataTable GetDataTableByUser(BaseUserInfo userInfo, string userId, string beginDate, string endDate) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = new DataTable(BaseLogEntity.TableName); using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseLogManager logManager = new BaseLogManager(dbHelper, userInfo); dataTable = logManager.GetDataTableByDate(BaseLogEntity.FieldUserId, userId, beginDate, endDate); dataTable.TableName = BaseLogEntity.TableName; BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.LogService_GetDataTableByUser, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(dataTable); }
/// <summary> /// 批量发送站内信息 /// </summary> /// <param name="userInfo">用户</param> /// <param name="receiverIds">接受者主键数组</param> /// <param name="organizeIds">组织机构主键数组</param> /// <param name="roleIds">角色主键数组</param> /// <param name="messageEntity">消息内容</param> /// <returns>影响行数</returns> public int BatchSend(BaseUserInfo userInfo, string[] receiverIds, string[] organizeIds, string[] roleIds, BaseMessageEntity messageEntity) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif int returnValue = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseMessageManager messageManager = new BaseMessageManager(dbHelper, userInfo); returnValue = messageManager.BatchSend(receiverIds, organizeIds, roleIds, messageEntity, true); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.MessageService_BatchSend, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 设置用户的默认角色 /// </summary> /// <param name="userInfo">用户</param> /// <param name="userId">用户主键</param> /// <param name="roleId">角色主键</param> /// <returns>影响的行数</returns> public int SetDefaultRole(BaseUserInfo userInfo, string userId, string roleId) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif int returnValue = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); returnValue = userManager.SetProperty(userId, new KeyValuePair <string, object>(BaseUserEntity.FieldRoleId, roleId)); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.UserService_SetDefaultRole, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(0); }
/// <summary> /// 获取用户实体 /// </summary> /// <param name="userInfo">用户</param> /// <param name="id">主键</param> /// <returns>实体</returns> public BaseUserEntity GetEntity(BaseUserInfo userInfo, string id) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif BaseUserEntity userEntity = null; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); userEntity = userManager.GetEntity(id); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.UserService_GetEntity, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(userEntity); }
/// <summary> /// 批量保存 /// </summary> /// <param name="userInfo">用户</param> /// <param name="dataTable">数据表</param> /// <returns>影响行数</returns> public int BatchSave(BaseUserInfo userInfo, DataTable dataTable) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif int returnValue = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); returnValue = userManager.BatchSave(dataTable); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 获取约束条件 /// </summary> /// <param name="userInfo">用户</param> /// <param name="resourceCategory">资源类别</param> /// <param name="resourceId">资源主键</param> /// <param name="tableName">表名</param> /// <returns>约束条件</returns> public string GetConstraint(BaseUserInfo userInfo, string resourceCategory, string resourceId, string tableName) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif string returnValue = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseTableColumnsManager manager = new BaseTableColumnsManager(dbHelper, userInfo); returnValue = manager.GetConstraint(resourceCategory, resourceId, tableName); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.TableColumnsService_SetConstraint, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 替换工作审核者 /// </summary> /// <param name="userInfo">用户</param> /// <param name="oldCode">原来的工号</param> /// <param name="newCode">新的工号</param> /// <returns>影响行数</returns> public int Replace(BaseUserInfo userInfo, string oldCode, string newCode) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif int returnValue = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { dbHelper.Open(WorkFlowDbConnection); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); returnValue = workFlowCurrentManager.ReplaceUser(oldCode, newCode); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 上传文件 /// </summary> /// <param name="userInfo">用户</param> /// <param name="folderId">文件夹主键</param> /// <param name="fileName">文件名</param> /// <param name="file">文件</param> /// <param name="enabled">有效</param> /// <returns>主键</returns> public string Upload(BaseUserInfo userInfo, string folderId, string fileName, byte[] file, bool enabled) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif string returnValue = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseFileManager fileManager = new BaseFileManager(dbHelper, userInfo); returnValue = fileManager.Upload(folderId, fileName, file, enabled); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.FileService_Upload, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 获取参数值 /// </summary> /// <param name="userInfo">用户</param> /// <param name="categoryId">分类主键</param> /// <param name="parameterId">参数主键</param> /// <param name="parameterCode">参数编号</param> /// <returns>参数值</returns> public string GetParameter(BaseUserInfo userInfo, string categoryId, string parameterId, string parameterCode) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 // #if (!DEBUG) // LogOnService.UserIsLogOn(userInfo); // #endif string returnValue = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseParameterManager parameterManager = new BaseParameterManager(dbHelper, userInfo); returnValue = parameterManager.GetParameter(categoryId, parameterId, parameterCode); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.ParameterService_GetParameter, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 添加用户 /// </summary> /// <param name="userInfo">用户信息</param> /// <param name="userEntity">用户实体</param> /// <param name="statusCode">状态码</param> /// <param name="statusMessage">状态信息</param> /// <returns>主键</returns> public string AddUser(BaseUserInfo userInfo, BaseUserEntity userEntity, out string statusCode, out string statusMessage) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) BaseSystemInfo.IsAuthorized(userInfo); #endif string returnValue = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); returnValue = AddUser(dbHelper, userInfo, userEntity, out statusCode, out statusMessage); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.UserService_AddUser, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 用户名是否重复 /// </summary> /// <param name="userInfo">用户</param> /// <param name="parameters">字段名,字段值</param> /// <returns>已存在</returns> public bool Exists(BaseUserInfo userInfo, List <KeyValuePair <string, object> > parameters) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif bool returnValue = false; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseUserManager userManager = new BaseUserManager(dbHelper); returnValue = userManager.Exists(parameters); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 获取序列号 /// </summary> /// <param name="userInfo">用户</param> /// <param name="fullName">序列名称</param> /// <param name="count">个数</param> /// <returns>序列号</returns> public string[] GetBatchSequence(BaseUserInfo userInfo, string fullName, int count) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif string[] returnValue = new string[0]; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); returnValue = this.GetBatchSequence(dbHelper, userInfo, fullName, count); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 工作日志添加 /// </summary> /// <param name="userInfo">用户</param> /// <param name="dataTable">数据表</param> /// <param name="statusCode">返回状态码</param> /// <param name="statusMessage">返回状态信息</param> /// <returns>主键</returns> public string Add(BaseUserInfo userInfo, DataTable dataTable, out string statusCode, out string statusMessage) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif statusCode = string.Empty; statusMessage = string.Empty; string returnValue = string.Empty; IDbHelper dbHelper = DbHelperFactory.GetHelper(); try { dbHelper.Open(UserCenterDbConnection); BaseWorkReportEntity WorkReportEntity = new BaseWorkReportEntity(dataTable); BaseWorkReportManager workReportManager = new BaseWorkReportManager(dbHelper, userInfo); returnValue = workReportManager.Add(WorkReportEntity, out statusCode); // 获得状态消息 statusMessage = workReportManager.GetStateMessage(statusCode); // 写入日志 BaseLogManager.Instance.Add(dbHelper, userInfo, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
///////////////////////////////////////////////////////////////////////////////////////////////////////// /// 测试权限用的 ///////////////////////////////////////////////////////////////////////////////////////////////////////// #region public string AddPermission(BaseUserInfo userInfo, string permissionCode) /// <summary> /// 添加操作权限 /// </summary> /// <param name="userInfo">用户</param> /// <param name="permissionCode">权限编号</param> /// <returns>主键</returns> public string AddPermission(BaseUserInfo userInfo, string permissionCode) { // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif string returnValue = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BasePermissionItemManager permissionItemManager = new BasePermissionItemManager(dbHelper, userInfo); string statusCode = string.Empty; BasePermissionItemEntity permissionItemEntity = new BasePermissionItemEntity(); permissionItemEntity.Code = permissionCode; permissionItemEntity.Enabled = 1; permissionItemEntity.AllowDelete = 1; permissionItemEntity.AllowEdit = 1; permissionItemEntity.IsScope = 0; returnValue = permissionItemManager.Add(permissionItemEntity, out statusCode); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.MSG0091, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } return(returnValue); }
/// <summary> /// 全部清除日志(业务) /// </summary> /// <param name="userInfo">用户</param> /// <returns>数据表</returns> public void TruncateApplication(BaseUserInfo userInfo) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(BusinessDbConnection); BaseLogManager logManager = new BaseLogManager(dbHelper, userInfo); logManager.Truncate(); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.LogService_TruncateApplication, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif }
/// <summary> /// 获取主键 /// </summary> /// <param name="userInfo">用户</param> /// <param name="name">查询的参数</param> /// <param name="value">参数值</param> /// <returns>影响行数</returns> public string GetId(BaseUserInfo userInfo, string name, object value) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif string returnValue = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseStaffManager staffManager = new BaseStaffManager(dbHelper); returnValue = staffManager.GetId(new KeyValuePair <string, object>(name, value)); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 用户现在 /// </summary> /// <param name="userInfo">用户</param> /// <param name="onLineState">用户在线状态</param> public void OnLine(BaseUserInfo userInfo, int onLineState = 1) { // 写入调试信息 #if (DEBUG) // int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); // BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.LogOnService_OnLine, MethodBase.GetCurrentMethod()); BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); userManager.OnLine(userInfo.Id, onLineState); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) // BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart, ConsoleColor.Green); #endif }
/// <summary> /// 撤销角色权限 /// </summary> /// <param name="userInfo">用户</param> /// <param name="roleName">角色名</param> /// <param name="permissionItemCode">权限编号</param> /// <returns>主键</returns> public int RevokeRolePermission(BaseUserInfo userInfo, string roleName, string permissionItemCode) { // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif int returnValue = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseRoleManager roleManager = new BaseRoleManager(dbHelper, userInfo); string roleId = roleManager.GetId(new KeyValuePair <string, object>(BaseRoleEntity.FieldRealName, roleName)); BasePermissionItemManager permissionItemManager = new BasePermissionItemManager(dbHelper, userInfo); string permissionItemId = permissionItemManager.GetId(new KeyValuePair <string, object>(BasePermissionItemEntity.FieldCode, permissionItemCode)); if (!String.IsNullOrEmpty(roleId) && !String.IsNullOrEmpty(permissionItemId)) { BaseRolePermissionManager rolePermissionManager = new BaseRolePermissionManager(dbHelper, userInfo); returnValue = rolePermissionManager.Revoke(roleId, permissionItemId); } } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } return(returnValue); }
/// <summary> /// 获得用户有访问权限的模块 /// </summary> /// <param name="userInfo">用户</param> /// <param name="userId">用户主键</param> /// <returns>数据表</returns> public DataTable GetModuleDTByUser(BaseUserInfo userInfo, string userId) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = new DataTable(BaseModuleEntity.TableName); using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); string tableName = BaseModuleEntity.TableName; if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode)) { tableName = BaseSystemInfo.SystemCode + "Module"; } BaseModuleManager moduleManager = new BaseModuleManager(dbHelper, userInfo, tableName); if (userInfo.IsAdministrator) { List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>(BaseModuleEntity.FieldEnabled, 1)); parameters.Add(new KeyValuePair <string, object>(BaseModuleEntity.FieldDeletionStateCode, 0)); // 有效的,未被删除的显示出来 dataTable = moduleManager.GetDataTable(parameters, BaseModuleEntity.FieldSortCode); } else { dataTable = moduleManager.GetDataTableByUser(userId); } // 若不是员工,有些菜单可以去掉的功能,加在这里 if (string.IsNullOrEmpty(userInfo.StaffId)) { BaseBusinessLogic.Delete(dataTable, BaseModuleEntity.FieldCode, "FrmStaffAddressEdit"); dataTable.AcceptChanges(); } dataTable.TableName = BaseModuleEntity.TableName; BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_GetModuleDTByUser, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(dataTable); }
/// <summary> /// 检查是否是步骤流 /// </summary> /// <param name="userInfo">用户信息</param> /// <param name="currentFlowIds">主键组</param> /// <param name="returnStatusCode">返回代码</param> /// <param name="returnStatusMessage">返回信息</param> /// <returns></returns> public bool CheckIsAutoWorkFlow(BaseUserInfo userInfo, string[] currentFlowIds, out string returnStatusCode, out string returnStatusMessage) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif returnStatusCode = string.Empty; returnStatusMessage = string.Empty; bool returnValue = false; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { // 打开数据库 dbHelper.Open(WorkFlowDbConnection); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); string processId = string.Empty; for (int i = 0; i < currentFlowIds.Length; i++) { BaseWorkFlowCurrentEntity workFlowCurrentEntity = workFlowCurrentManager.GetEntity(currentFlowIds[i]); if ((workFlowCurrentEntity != null) && (!string.IsNullOrEmpty(workFlowCurrentEntity.Id))) { if (workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.StartAudit.ToString()) || workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.AuditPass.ToString()) || workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.WaitForAudit.ToString()) || workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.AuditReject.ToString())) { // 不为空的话是步骤流 if (workFlowCurrentEntity.WorkFlowId != null) { returnValue = true; } else { // 判断是否是批量审核,只有自由流才限制批量审批 if (i > 0) { returnStatusMessage = "你选中的记录里包含自由审批流程所以不能批量审批。"; } return(false); } } else { returnStatusMessage = "你选中的记录里包含状态不明确的记录。"; return(false); } } else { returnStatusMessage = "你选中的记录里可能已被删除。"; return(false); } } BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 获得某个用户的所有权限列表 /// </summary> /// <param name="userInfo">用户</param> /// <param name="userId">用户主键</param> /// <returns>数据表</returns> public DataTable GetPermissionDTByUser(BaseUserInfo userInfo, string userId) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = new DataTable(BasePermissionItemEntity.TableName); using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); string tableName = BasePermissionItemEntity.TableName; if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode)) { tableName = BaseSystemInfo.SystemCode + "PermissionItem"; } // 是否超级管理员 BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); BasePermissionItemManager permissionItemManager = new BasePermissionItemManager(dbHelper, userInfo, tableName); if (userManager.IsAdministrator(userId)) { dataTable = permissionItemManager.GetDataTable(); } else { tableName = BasePermissionEntity.TableName; if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode)) { tableName = BaseSystemInfo.SystemCode + "Permission"; } BasePermissionManager permissionManager = new BasePermissionManager(dbHelper, userInfo, tableName); string[] ids = permissionManager.GetPermissionIdsByUser(userId); // 若是以前赋予的权限,后来有些权限设置为无效了,那就不应该再获取哪些无效的权限才对。 // bug修正:没有赋值DataTable,导致返回值空 dataTable = permissionItemManager.GetDataTable( new KeyValuePair <string, object>(BasePermissionItemEntity.FieldId, ids) , new KeyValuePair <string, object>(BasePermissionItemEntity.FieldEnabled, 1) , new KeyValuePair <string, object>(BasePermissionItemEntity.FieldDeletionStateCode, 0)); } dataTable.TableName = tableName; BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_GetPermissionDTByUser, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(dataTable); }
/// <summary> /// 批量打删除标志 /// </summary> /// <param name="userInfo">用户</param> /// <param name="ids">主键数组</param> /// <returns>影响行数</returns> public int SetDeleted(BaseUserInfo userInfo, string[] ids) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif int returnValue = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseOrganizeManager organizeManager = new BaseOrganizeManager(dbHelper, userInfo); for (int i = 0; i < ids.Length; i++) { // 设置部门为删除状态 returnValue += organizeManager.SetDeleted(ids[i]); // 相应的用户也需要处理 BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldCompanyId, null)); parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldCompanyName, null)); userManager.SetProperty(new KeyValuePair <string, object>(BaseUserEntity.FieldCompanyId, ids[i]), parameters); parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldSubCompanyId, null)); parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldSubCompanyName, null)); userManager.SetProperty(new KeyValuePair <string, object>(BaseUserEntity.FieldSubCompanyId, ids[i]), parameters); parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldDepartmentId, null)); parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldDepartmentName, null)); userManager.SetProperty(new KeyValuePair <string, object>(BaseUserEntity.FieldDepartmentId, ids[i]), parameters); parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldWorkgroupId, null)); parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldWorkgroupName, null)); userManager.SetProperty(new KeyValuePair <string, object>(BaseUserEntity.FieldWorkgroupId, ids[i]), parameters); // 相应的员工也需要处理 BaseStaffManager staffManager = new BaseStaffManager(dbHelper, userInfo); staffManager.SetProperty(new KeyValuePair <string, object>(BaseStaffEntity.FieldCompanyId, ids[i]), new KeyValuePair <string, object>(BaseStaffEntity.FieldCompanyId, null)); staffManager.SetProperty(new KeyValuePair <string, object>(BaseStaffEntity.FieldSubCompanyId, ids[i]), new KeyValuePair <string, object>(BaseStaffEntity.FieldSubCompanyId, null)); staffManager.SetProperty(new KeyValuePair <string, object>(BaseStaffEntity.FieldDepartmentId, ids[i]), new KeyValuePair <string, object>(BaseStaffEntity.FieldDepartmentId, null)); staffManager.SetProperty(new KeyValuePair <string, object>(BaseStaffEntity.FieldWorkgroupId, ids[i]), new KeyValuePair <string, object>(BaseStaffEntity.FieldWorkgroupId, null)); } BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.OrganizeService_SetDeleted, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 获取在线用户列表 /// </summary> /// <param name="userInfo">用户</param> /// <returns>数据表</returns> public DataTable GetOnLineState(BaseUserInfo userInfo) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 是否需要获取用户状态 bool getOnLine = false; // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif lock (locker) { using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); // 设置为在线状态 userManager.OnLine(userInfo.Id); if (MessageService.LaseOnLineStateCheck == DateTime.MinValue) { getOnLine = true; } else { // 2008.01.23 JiRiGaLa 修正错误 TimeSpan timeSpan = DateTime.Now - MessageService.LaseOnLineStateCheck; if ((timeSpan.Minutes * 60 + timeSpan.Seconds) >= BaseSystemInfo.OnLineCheck) { getOnLine = true; } } if (OnLineStateDT == null || getOnLine) { // 检查用户在线状态(服务器专用) userManager.CheckOnLine(); // 获取在线状态列表 OnLineStateDT = userManager.GetOnLineStateDT(); OnLineStateDT.TableName = BaseUserEntity.TableName; MessageService.LaseOnLineStateCheck = DateTime.Now; } // BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } } // 写入调试信息 #if (DEBUG) if (getOnLine) { BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); } #endif return(OnLineStateDT); }
/// <summary> /// 获取内部组织机构 /// </summary> /// <param name="userInfo">用户</param> /// <returns>数据表</returns> public DataTable GetInnerOrganizeDT(BaseUserInfo userInfo) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif // 是否需要获取用户状态 bool getOnLine = false; lock (locker) { using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseOrganizeManager organizeManager = new BaseOrganizeManager(dbHelper, userInfo); if (MessageService.LaseInnerOrganizeCheck == DateTime.MinValue) { getOnLine = true; } else { // 2008.01.23 JiRiGaLa 修正错误 TimeSpan timeSpan = DateTime.Now - MessageService.LaseInnerOrganizeCheck; if ((timeSpan.Minutes * 60 + timeSpan.Seconds) >= BaseSystemInfo.OnLineCheck * 100) { getOnLine = true; } } if (OnLineStateDT == null || getOnLine) { string commandText = " SELECT * " + " FROM " + BaseOrganizeEntity.TableName + " WHERE " + BaseOrganizeEntity.FieldDeletionStateCode + " = 0 " + " AND " + BaseOrganizeEntity.FieldIsInnerOrganize + " = 1 " + " AND " + BaseOrganizeEntity.FieldEnabled + " = 1 " + " ORDER BY " + BaseOrganizeEntity.FieldSortCode; InnerOrganizeDT = organizeManager.Fill(commandText); InnerOrganizeDT.TableName = BaseOrganizeEntity.TableName; MessageService.LaseInnerOrganizeCheck = DateTime.Now; } // BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } } // 写入调试信息 #if (DEBUG) if (getOnLine) { BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); } #endif return(InnerOrganizeDT); }
/// <summary> /// 按角色获取用户列表 /// </summary> /// <param name="userInfo">用户</param> /// <param name="roleId">角色主键</param> /// <returns>数据表</returns> public DataTable GetUserDTByRole(BaseUserInfo userInfo, string roleId) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = new DataTable(BaseUserEntity.TableName); using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); string sqlQuery = " SELECT " + BaseUserEntity.TableName + "." + BaseUserEntity.FieldId + "," + BaseUserEntity.TableName + "." + BaseUserEntity.FieldRealName + "," + BaseUserEntity.TableName + "." + BaseUserEntity.FieldUserOnLine + " FROM " + BaseUserEntity.TableName; sqlQuery += " WHERE (" + BaseUserEntity.TableName + "." + BaseUserEntity.FieldDeletionStateCode + " = 0 " + " AND " + BaseUserEntity.TableName + "." + BaseUserEntity.FieldEnabled + " = 1 " + " AND " + BaseUserEntity.TableName + "." + BaseUserEntity.FieldIsVisible + " = 1 ) "; if (!String.IsNullOrEmpty(roleId)) { // 从用户默认橘色 sqlQuery += " AND (" + BaseUserEntity.TableName + "." + BaseUserEntity.FieldRoleId + " = '" + roleId + "') "; // 从兼职表读取用户 sqlQuery += " OR " + BaseUserEntity.FieldId + " IN (" + " SELECT " + BaseUserRoleEntity.FieldUserId + " FROM " + BaseUserRoleEntity.TableName + " WHERE " + BaseUserRoleEntity.TableName + "." + BaseUserRoleEntity.FieldDeletionStateCode + " = 0 " + " AND " + BaseUserRoleEntity.TableName + "." + BaseUserRoleEntity.FieldEnabled + " = 1 " + " AND " + BaseUserRoleEntity.TableName + "." + BaseUserRoleEntity.FieldRoleId + " = '" + roleId + "') "; } sqlQuery += " ORDER BY " + BaseUserEntity.TableName + "." + BaseUserEntity.FieldSortCode; dataTable = userManager.Fill(sqlQuery); dataTable.TableName = BaseUserEntity.TableName; BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.MessageService_GetUserDTByDepartment, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(dataTable); }