/// <summary> /// 获取授权范围 /// </summary> /// <param name="userInfo">用户</param> /// <param name="userId">用户主键</param> /// <returns>数据表</returns> public DataTable GetLicensedDT(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"; } BasePermissionItemManager permissionAdminManager = new BasePermissionItemManager(dbHelper, userInfo, tableName); string permissionItemId = permissionAdminManager.GetId(new KeyValuePair <string, object>(BasePermissionItemEntity.FieldDeletionStateCode, 0), new KeyValuePair <string, object>(BasePermissionItemEntity.FieldCode, "Resource.ManagePermission")); dataTable = permissionAdminManager.GetDataTableByUser(userId, permissionItemId); dataTable.TableName = BasePermissionItemEntity.TableName; BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionItemService_GetLicensedDT, 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); }
////////////////////////////////////////////////////////////////////////////////////////////////////// /// 用户权限判断相关(需要实现对外调用) ////////////////////////////////////////////////////////////////////////////////////////////////////// #region public bool IsInRole(BaseUserInfo userInfo, string userId, string roleName) /// <summary> /// 用户是否在指定的角色里 /// </summary> /// <param name="userInfo">用户</param> /// <param name="UserId">用户主键</param> /// <param name="roleName">角色名称</param> /// <returns>在角色里</returns> public bool IsInRole(BaseUserInfo userInfo, string userId, string roleName) { // 写入调试信息 #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); // 先获得角色主键 BaseRoleManager roleManager = new BaseRoleManager(dbHelper, userInfo); string roleCode = roleManager.GetProperty(new KeyValuePair <string, object>(BaseRoleEntity.FieldRealName, roleName), BaseRoleEntity.FieldCode); // 判断用户的默认角色 if (!string.IsNullOrEmpty(roleCode)) { BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); returnValue = userManager.IsInRoleByCode(userId, roleCode); } BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_IsInRole, 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="tableName">目标表</param> /// <param name="parentId">父级主键</param> /// <returns>数据表</returns> public DataTable GetDataTableByParent(BaseUserInfo userInfo, string parentId) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = new DataTable(BaseItemsEntity.TableName); using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); string tableName = BaseItemsEntity.TableName; if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode)) { tableName = BaseSystemInfo.SystemCode + "Items"; } BaseItemsManager itemsManager = new BaseItemsManager(dbHelper, userInfo, tableName); dataTable = itemsManager.GetDataTableByParent(parentId); dataTable.TableName = tableName; // 添加日志 BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.ItemsService_GetDataTableByParent, 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="userId">用户主键</param> /// <param name="categoryCode">分类代码</param> /// <param name="categorybillFullName">单据分类名称</param> /// <param name="searchValue">查询字符串</param> /// <returns></returns> public DataTable GetWaitForAudit(BaseUserInfo userInfo, string userId = null, string categoryCode = null, string categorybillFullName = null, string searchValue = null) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = null; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { // 这个是获取用户的角色信息 dbHelper.Open(UserCenterDbConnection); BaseUserManager userManager = new BaseUserManager(dbHelper); string[] roleIds = userManager.GetAllRoleIds(userInfo.Id); dbHelper.Close(); // 这里是获取待审核信息 dbHelper.Open(WorkFlowDbConnection); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); dataTable = workFlowCurrentManager.GetWaitForAudit(userId, categoryCode, categorybillFullName, searchValue); dataTable.TableName = BaseWorkFlowCurrentEntity.TableName; 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="userId">用户主键</param> /// <param name="moduleCode">模块编号</param> /// <returns>是否有权限</returns> public bool IsModuleAuthorizedByUser(BaseUserInfo userInfo, string userId, string moduleCode, string permissionItemCode) { // 写入调试信息 #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); if (returnValue) { return(returnValue); } BasePermissionScopeManager permissionScopeManager = new BasePermissionScopeManager(dbHelper); returnValue = permissionScopeManager.IsModuleAuthorized(userId, moduleCode, permissionItemCode); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_IsModuleAuthorizedByUser, 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 string[] GetModuleIdsByUser(BaseUserInfo userInfo, string userId) { // 写入调试信息 #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); BaseModuleManager moduleManager = new BaseModuleManager(dbHelper, userInfo); if (userInfo.IsAdministrator) { // 有效的,未被删除的显示出来 returnValue = moduleManager.GetIds(new KeyValuePair <string, object>(BaseModuleEntity.FieldDeletionStateCode, 0), new KeyValuePair <string, object>(BaseModuleEntity.FieldEnabled, 1)); } else { returnValue = moduleManager.GetIdsByUser(userId); } 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(returnValue); }
// #region public DataTable GetLogGeneralForOnlineUser(BaseUserInfo userInfo) 获取用户访问情况日志 // /// <summary> // /// 获取用户访问情况日志 // /// </summary> // /// <param name="userInfo">用户</param> // /// <returns>数据表</returns> // public DataTable GetLogGeneralForOnlineUser(BaseUserInfo userInfo, bool UserOnLine) // { // // 写入调试信息 // #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)) // { // BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); // try // { // dbHelper.Open(UserCenterDbConnection); // if (userInfo.IsAdministrator) // { // dataTable = userManager.GetDataTable(); // } // else // { // BasePermissionScopeManager permissionScopeManager = new BasePermissionScopeManager(dbHelper, userInfo); // string[] userIds = permissionScopeManager.GetUserIds(userInfo.Id, "Resource.ManagePermission"); // dataTable = userManager.GetDataTableByIds(userIds,UserOnLine); // } // dataTable.TableName = BaseLogEntity.TableName; // BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.LogService_GetLogGeneral, 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; // } // #endregion #region public DataTable ResetVisitInfo(BaseUserInfo userInfo, string[] ids) 重置用户访问情况 /// <summary> /// 重置用户访问情况 /// </summary> /// <param name="userInfo">用户</param> /// <param name="ids">日志主键</param> /// <returns>数据表</returns> public DataTable ResetVisitInfo(BaseUserInfo userInfo, string[] ids) { // 写入调试信息 #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); dbHelper.BeginTransaction(); BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); // 重置访问情况 userManager.ResetVisitInfo(ids); // 获取列表 dataTable = userManager.GetDataTable(); dataTable.TableName = BaseLogEntity.TableName; BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.LogService_ResetVisitInfo, MethodBase.GetCurrentMethod()); dbHelper.CommitTransaction(); } catch (Exception ex) { dbHelper.RollbackTransaction(); 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="folderId">文件夹主键</param> /// <param name="fileName">文件名</param> /// <returns>存在</returns> public bool Exists(BaseUserInfo userInfo, string folderId, string fileName) { // 写入调试信息 #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); BaseFileManager fileManager = new BaseFileManager(dbHelper, userInfo); //returnValue = fileManager.Exists(new KeyValuePair<string, object>(BaseFileEntity.FieldFolderId, folderId), new KeyValuePair<string, object>(BaseFileEntity.FieldFileName, fileName)); //加入删除状态为0的条件 List <KeyValuePair <string, object> > parametersList = new List <KeyValuePair <string, object> >(); parametersList.Add(new KeyValuePair <string, object>(BaseFileEntity.FieldFolderId, folderId)); parametersList.Add(new KeyValuePair <string, object>(BaseFileEntity.FieldFileName, fileName)); parametersList.Add(new KeyValuePair <string, object>(BaseFileEntity.FieldDeletionStateCode, 0)); returnValue = fileManager.Exists(parametersList); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.FileService_Exists, 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="workFlowId">工作流主键</param> /// <returns>数据表</returns> public DataTable GetDataTable(BaseUserInfo userInfo, string workFlowId) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataTable dataTable = new DataTable(BaseWorkFlowProcessEntity.TableName); using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { dbHelper.Open(WorkFlowDbConnection); BaseWorkFlowActivityManager workFlowActivityManager = new BaseWorkFlowActivityManager(dbHelper, userInfo); List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldWorkFlowId, workFlowId)); parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldEnabled, 1)); parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowStepEntity.FieldDeletionStateCode, 0)); dataTable = workFlowActivityManager.GetDataTable(parameters, BaseWorkFlowActivityEntity.FieldSortCode); dataTable.TableName = BaseWorkFlowActivityEntity.TableName; } 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="parentId">父结点主键</param> /// <returns>数据表</returns> public DataTable GetDataTableByParent(BaseUserInfo userInfo, string parentId) { // 写入调试信息 #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); dataTable = moduleManager.GetDataTable(new KeyValuePair <string, object>(BaseModuleEntity.FieldDeletionStateCode, 0), new KeyValuePair <string, object>(BaseModuleEntity.FieldParentId, parentId)); dataTable.DefaultView.Sort = BaseModuleEntity.FieldSortCode; dataTable.TableName = BaseModuleEntity.TableName; BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.ModuleService_GetDataTableByParent, 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="userId">用户主键</param> /// <param name="permissionItemCode">数据权限编号</param> /// <returns>主键数组</returns> public string[] GetUserIdsByPermissionScope(BaseUserInfo userInfo, string userId, string permissionItemCode) { // 写入调试信息 #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); // 若权限是空的,直接返回所有数据 if (String.IsNullOrEmpty(permissionItemCode)) { return(returnValue); } // 获得用户主键数组 BasePermissionScopeManager permissionScopeManager = new BasePermissionScopeManager(dbHelper, userInfo); returnValue = permissionScopeManager.GetUserIds(userId, permissionItemCode); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_GetUserIdsByPermission, 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="permissionItemId">操作权限主键</param> /// <returns>主键数组</returns> public string[] GetOrganizeIdsByPermission(BaseUserInfo userInfo, string permissionItemId) { // 写入调试信息 #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); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); string tableName = BasePermissionEntity.TableName; if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode)) { tableName = BaseSystemInfo.SystemCode + "Permission"; } BaseOrganizePermissionManager organizePermissionManager = new BaseOrganizePermissionManager(dbHelper, userInfo, tableName); returnValue = organizePermissionManager.GetOrganizeIds(permissionItemId); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_GetOrganizeIdsByPermission, 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="roleId">角色主键</param> /// <param name="userIds">用户主键</param> /// <returns>影响行数</returns> public int RemoveUserFromRole(BaseUserInfo userInfo, string roleId, string[] userIds) { // 写入调试信息 #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); dbHelper.BeginTransaction(); BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); if (userIds != null) { returnValue += userManager.RemoveFormRole(userIds, roleId); } BaseLogManager.Instance.Add(dbHelper, userInfo, serviceName, AppMessage.RoleService_RemoveUserFromRole, MethodBase.GetCurrentMethod()); dbHelper.CommitTransaction(); } catch (Exception ex) { dbHelper.RollbackTransaction(); 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="codes">编号数组</param> /// <returns>数据权限合</returns> public DataSet GetDSByCodes(BaseUserInfo userInfo, string[] codes) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif DataSet dataSet = new DataSet(); using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); for (int i = 0; i < codes.Length; i++) { DataTable dataTable = this.GetDataTableByCode(dbHelper, userInfo, codes[i]); dataTable.TableName = codes[i]; dataSet.Tables.Add(dataTable); } // 添加日志 BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.ItemDetailsService_GetDSByCodes, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(dataSet); }
/// <summary> /// 移除权限范围 /// </summary> /// <param name="userInfo">用户</param> /// <param name="resourceCategory">资源分类</param> /// <param name="resourceIds">资源主键</param> /// <param name="targetCategory">目标分类</param> /// <param name="revokeTargetId">目标主键</param> /// <param name="permissionItemId">操作权限项</param> /// <returns>影响行数</returns> public int RevokePermissionScopeTarget(BaseUserInfo userInfo, string resourceCategory, string[] resourceIds, string targetCategory, string revokeTargetId, string permissionItemId) { // 写入调试信息 #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); string tableName = BasePermissionScopeEntity.TableName; if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode)) { tableName = BaseSystemInfo.SystemCode + "PermissionScope"; } BasePermissionScopeManager permissionScopeManager = new BasePermissionScopeManager(dbHelper, userInfo, tableName); returnValue = permissionScopeManager.RevokeResourcePermissionScopeTarget(resourceCategory, resourceIds, targetCategory, revokeTargetId, permissionItemId); 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="staffEntites">实体</param> /// <returns>影响行数</returns> public int BatchUpdateAddress(BaseUserInfo userInfo, List <BaseStaffEntity> staffEntites, out string statusCode, out string statusMessage) { // 写入调试信息 #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); statusCode = string.Empty; BaseStaffManager staffManager = new BaseStaffManager(dbHelper, userInfo); for (int i = 0; i < staffEntites.Count; i++) { returnValue += staffManager.UpdateAddress(staffEntites[i], out statusCode); } statusMessage = staffManager.GetStateMessage(statusCode); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.StaffService_BatchUpdateAddress, 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="id">主键</param> /// <returns>数据表</returns> public int Delete(BaseUserInfo userInfo, string id) { // 写入调试信息 #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); string tableName = BaseRoleEntity.TableName; if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode)) { tableName = BaseSystemInfo.SystemCode + "Role"; } BaseRoleManager roleManager = new BaseRoleManager(dbHelper, userInfo, tableName); returnValue = roleManager.Delete(id); BaseLogManager.Instance.Add(dbHelper, userInfo, serviceName, AppMessage.RoleService_Delete, 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="password">新密码</param> /// <param name="returnStatusCode">返回状态码</param> /// <param name="returnStatusMessage">返回状消息</param> /// <returns>影响行数</returns> public int SetPassword(BaseUserInfo userInfo, string[] userIds, string password, 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; int returnValue = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.LogOnService_SetPassword, MethodBase.GetCurrentMethod()); BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); returnValue = userManager.BatchSetPassword(userIds, password); returnStatusCode = userManager.ReturnStatusCode; // 获得状态消息 returnStatusMessage = userManager.GetStateMessage(returnStatusCode); } 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 moduleId, 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); string tableName = BaseModuleEntity.TableName; if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode)) { tableName = BaseSystemInfo.SystemCode + "Module"; } BaseModuleManager moduleManager = new BaseModuleManager(dbHelper, userInfo, tableName); returnValue = moduleManager.SetProperty(moduleId, new KeyValuePair <string, object>(BaseModuleEntity.FieldParentId, parentId)); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.ModuleService_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="sequenceEntity">序列实体</param> /// <param name="statusCode">状态码</param> /// <param name="statusMessage">状态信息</param> /// <returns>影响行数</returns> public int Update(BaseUserInfo userInfo, BaseSequenceEntity sequenceEntity, out string statusCode, out string statusMessage) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif statusCode = string.Empty; statusMessage = string.Empty; int returnValue = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseSequenceManager sequenceManager = new BaseSequenceManager(dbHelper, userInfo); // 编辑数据 returnValue = sequenceManager.Update(sequenceEntity, out statusCode); // returnValue = businessCardManager.Update(businessCardEntity, out statusCode); statusMessage = sequenceManager.GetStateMessage(statusCode); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.SequenceService_Update, 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> /// <param name="lastChekDate">最后检查日期</param> /// <returns>消息状态数组</returns> public string[] MessageChek(BaseUserInfo userInfo, int onLineState, string lastChekDate) { // 写入调试信息 #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); // 设置为在线状态 BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo); userManager.OnLine(userInfo.Id, onLineState); // 读取信息状态 BaseMessageManager messageManager = new BaseMessageManager(dbHelper, userInfo); returnValue = messageManager.MessageChek(); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.MessageService_MessageChek, 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="parentId">父主键</param> /// <param name="code">编号</param> /// <param name="fullName">全称</param> /// <param name="categoryId">分类</param> /// <param name="outerPhone">外线</param> /// <param name="innerPhone">内线</param> /// <param name="fax">传真</param> /// <param name="enabled">有效</param> /// <param name="statusCode">状态码</param> /// <param name="statusMessage">状态信息</param> /// <returns>主键</returns> public string AddByDetail(BaseUserInfo userInfo, string parentId, string code, string fullName, string categoryId, string outerPhone, string innerPhone, string fax, bool enabled, out string statusCode, out string statusMessage) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif statusCode = string.Empty; statusMessage = string.Empty; string returnValue = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseOrganizeManager organizeManager = new BaseOrganizeManager(dbHelper, userInfo); returnValue = organizeManager.AddByDetail(parentId, code, fullName, categoryId, outerPhone, innerPhone, fax, enabled, out statusCode); statusMessage = organizeManager.GetStateMessage(statusCode); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.OrganizeService_AddByDetail, 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="id">主键</param> /// <param name="auditIdea">审核意见</param> /// <returns>影响行数</returns> public int AuditComplete(BaseUserInfo userInfo, string[] ids, string auditIdea) { // 写入调试信息 #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); //IWorkFlowManager userReportManager = new UserReportManager(userInfo); BaseWorkFlowCurrentManager workFlowCurrentManager = new BaseWorkFlowCurrentManager(dbHelper, userInfo); dbHelper.BeginTransaction(); returnValue += workFlowCurrentManager.AuditComplete(ids, auditIdea); dbHelper.CommitTransaction(); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { dbHelper.RollbackTransaction(); 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="addRoleIds">加入角色</param> /// <returns>影响的行数</returns> public int AddUserToRole(BaseUserInfo userInfo, string userId, string[] addRoleIds) { // 写入调试信息 #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); // 小心异常,检查一下参数的有效性 if (addRoleIds != null) { returnValue += userManager.AddToRole(userId, addRoleIds); } 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="tableName">目标表</param> /// <param name="ids">编码主键数组</param> /// <param name="targetId">目标主键</param> /// <returns>影响行数</returns> public int BatchMoveTo(BaseUserInfo userInfo, string tableName, string[] ids, string targetId) { // 写入调试信息 #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); BaseItemsManager itemsManager = new BaseItemsManager(dbHelper, userInfo, tableName); for (int i = 0; i < ids.Length; i++) { returnValue += itemsManager.SetProperty(ids[i], new KeyValuePair <string, object>(BaseItemsEntity.FieldParentId, targetId)); } BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.ItemsService_BatchMoveTo, 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[] GetResourcePermissionItemIds(BaseUserInfo userInfo, string resourceCategory, string resourceId) /// <summary> /// 获取资源权限主键数组 /// </summary> /// <param name="userInfo">用户</param> /// <param name="resourceCategory">资源分类</param> /// <returns>主键数组</returns> public string[] GetResourcePermissionItemIds(BaseUserInfo userInfo, string resourceCategory, string resourceId) { // 写入调试信息 #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); List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>(BasePermissionEntity.FieldResourceCategory, resourceCategory)); parameters.Add(new KeyValuePair <string, object>(BasePermissionEntity.FieldResourceId, resourceId)); DataTable dataTable = DbLogic.GetDataTable(dbHelper, BasePermissionEntity.TableName, parameters); returnValue = BaseBusinessLogic.FieldToArray(dataTable, BasePermissionEntity.FieldPermissionItemId); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_GetResourcePermissionItemIds, 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="id">主键</param> /// <returns>数据表</returns> public BaseItemDetailsEntity GetEntityByCode(BaseUserInfo userInfo, string tableName, string code) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif BaseItemDetailsEntity itemDetailsEntity = new BaseItemDetailsEntity(); using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseItemDetailsManager itemDetailsManager = new BaseItemDetailsManager(dbHelper, userInfo, tableName); DataTable datatable = itemDetailsManager.GetDataTable(new KeyValuePair <string, object>(BaseItemDetailsEntity.FieldItemCode, code), BaseItemDetailsEntity.FieldSortCode); if ((datatable != null) && (datatable.Rows.Count > 0)) { itemDetailsEntity = itemDetailsEntity.GetFrom(datatable.Rows[0]); } BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.ItemDetailsService_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(itemDetailsEntity); }
/// <summary> /// 添加 /// </summary> /// <param name="userInfo">用户</param> /// <param name="folderId">文件夹主键</param> /// <param name="fileName">文件名</param> /// <param name="file"></param> /// <param name="description"></param> /// <param name="enabled"></param> /// <param name="statusCode"></param> /// <param name="statusMessage"></param> /// <returns></returns> public string Add(BaseUserInfo userInfo, string folderId, string fileName, byte[] file, string description, bool enabled, out string statusCode, out string statusMessage) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif statusCode = string.Empty; statusMessage = string.Empty; string returnValue = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseFileManager fileManager = new BaseFileManager(dbHelper, userInfo); returnValue = fileManager.Add(folderId, fileName, file, description, enabled, out statusCode); statusMessage = fileManager.GetStateMessage(statusCode); 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="dataTable">数据表</param> /// <param name="statusCode">返回状态码</param> /// <param name="statusMessage">返回状态信息</param> /// <returns>数据表</returns> public string Add(BaseUserInfo userInfo, string tableName, BaseItemDetailsEntity itemDetailsEntity, out string statusCode, out string statusMessage) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif string returnValue = string.Empty; statusCode = string.Empty; statusMessage = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseItemDetailsManager itemDetailsManager = new BaseItemDetailsManager(dbHelper, userInfo, tableName); // 调用方法,并且返回运行结果 returnValue = itemDetailsManager.Add(itemDetailsEntity, out statusCode); statusMessage = itemDetailsManager.GetStateMessage(statusCode); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.ItemDetailsService_Add, 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="revokeModuleIds">撤消模块主键数组</param> /// <returns>影响的行数</returns> public int RevokeOrganizeModuleScopes(BaseUserInfo userInfo, string organizeId, string permissionItemCode, string[] revokeModuleIds) { // 写入调试信息 #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); BaseOrganizeScopeManager organizeScopeManager = new BaseOrganizeScopeManager(dbHelper, userInfo); // 小心异常,检查一下参数的有效性 if (revokeModuleIds != null) { returnValue += organizeScopeManager.RevokeModules(organizeId, permissionItemCode, revokeModuleIds); } BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.PermissionService_RevokeOrganizeModuleScopes, 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); }