/// <summary> /// 发送组消息 /// </summary> /// <param name="userInfo">用户</param> /// <param name="organizeId">组织机构主键</param> /// <param name="roleId">角色主键</param> /// <param name="contents">内容</param> /// <returns></returns> public string SendGroupMessage(UserInfo userInfo, string organizeId, string roleId, string contents) { int returnValue = 0; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var messageEntity = new CiMessageEntity { Id = BusinessLogic.NewGuid(), CategoryCode = MessageCategory.Send.ToString(), MSGContent = contents, IsNew = (int)MessageStateCode.New, ReadCount = 0, DeleteMark = 0, Enabled = 1 }; if (!string.IsNullOrEmpty(organizeId)) { messageEntity.FunctionCode = MessageFunction.OrganizeMessage.ToString(); messageEntity.ObjectId = organizeId; } if (!string.IsNullOrEmpty(roleId)) { messageEntity.FunctionCode = MessageFunction.RoleMessage.ToString(); messageEntity.ObjectId = roleId; } var messageManager = new CiMessageManager(dbProvider, userInfo); returnValue = messageManager.BatchSend(string.Empty, organizeId, roleId, messageEntity, false); }); return(returnValue.ToString()); }
/// <summary> /// 获取数据权限目标主键 /// </summary> /// <param name="userInfo">用户</param> /// <param name="resourceCategory">资源类别</param> /// <param name="targetId">目标资源主键</param> /// <param name="targetResourceCategory">目标资源类别</param> /// <param name="permissionItemCode">操作权限编号</param> /// <returns>资源主键数组</returns> public string[] GetPermissionScopeResourceIds(UserInfo userInfo, string resourceCategory, string targetId, string targetResourceCategory, string permissionItemCode) { string[] returnValue = null; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var permissionItemManager = new PiPermissionItemManager(dbProvider, userInfo); var permissionItemId = permissionItemManager.GetId(PiPermissionItemTable.FieldCode, permissionItemCode); var names = new string[6]; var values = new object[6]; names[0] = PiPermissionScopeTable.FieldResourceCategory; values[0] = resourceCategory; names[1] = PiPermissionScopeTable.FieldTargetId; values[1] = targetId; names[2] = PiPermissionScopeTable.FieldPermissionId; values[2] = permissionItemId; names[3] = PiPermissionScopeTable.FieldTargetCategory; values[3] = targetResourceCategory; names[4] = PiPermissionScopeTable.FieldDeleteMark; values[4] = 0; names[5] = PiPermissionScopeTable.FieldEnabled; values[5] = 1; returnValue = DbCommonLibary.GetIds(dbProvider, PiPermissionScopeTable.TableName, names, values, PiPermissionScopeTable.FieldResourceId); }); return(returnValue); }
/// <summary> /// 获取在线用户列表 /// </summary> /// <param name="userInfo">用户</param> /// <returns>数据表</returns> public DataTable GetOnLineState(UserInfo userInfo) { var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIWriteDbWithLock(userInfo, parameter, locker, (dbProvider, getOnLine) => { var manager = new PiUserLogOnManager(dbProvider); // 设置为在线状态 manager.OnLine(userInfo.Id); if (MessageService.LastCheckOnLineState == DateTime.MinValue) { getOnLine = true; } else { TimeSpan timeSpan = DateTime.Now - MessageService.LastCheckOnLineState; if ((timeSpan.Minutes * 60 + timeSpan.Seconds) >= SystemInfo.OnLineCheck) { getOnLine = true; } } if (OnLineStateDT == null || getOnLine) { // 检查用户在线状态(服务器专用) manager.CheckOnLine(); // 获取在线状态列表 OnLineStateDT = manager.GetOnLineStateDT(); OnLineStateDT.TableName = PiUserTable.TableName; MessageService.LastCheckOnLineState = DateTime.Now; } return(getOnLine); }); return(OnLineStateDT); }
/// <summary> /// 用户在线 /// </summary> /// <param name="userInfo">用户</param> /// <param name="onLineState">用户在线状态</param> public void OnLine(UserInfo userInfo, int onLineState = 1) { var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIWriteDbWithLock(userInfo, parameter, locker, dbProvider => { var manager = new PiUserLogOnManager(dbProvider, userInfo); manager.OnLine(userInfo.Id, onLineState); }); }
/// <summary> /// 获取约束条件 /// </summary> /// <param name="userInfo">用户</param> /// <param name="resourceCategory">资源类别</param> /// <param name="resourceId">资源主键</param> /// <param name="tableName">表名</param> /// <returns>约束条件</returns> public PiPermissionScopeEntity GetConstraintEntity(UserInfo userInfo, string resourceCategory, string resourceId, string tableName, string permissionCode = "Resource.AccessPermission") { PiPermissionScopeEntity returnValue = null; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { returnValue = new TableColumnsManager(dbProvider, userInfo).GetConstraintEntity(resourceCategory, resourceId, tableName, permissionCode); }); 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(UserInfo userInfo, string resourceCategory, string resourceId, string tableName) { string returnValue = string.Empty; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { returnValue = new TableColumnsManager(dbProvider, userInfo).GetConstraint(resourceCategory, resourceId, tableName); }); return(returnValue); }
/// <summary> /// 获取用户的某个资源的权限范围(树型资源) /// </summary> /// <param name="userInfo">用户</param> /// <param name="userId">用户主键</param> /// <param name="targetCategory">目标类别</param> /// <param name="permissionItemCode">权限编号</param> /// <param name="childrens">是否含子节点</param> /// <returns>主键数组</returns> public string[] GetTreeResourceScopeIds(UserInfo userInfo, string userId, string targetCategory, string permissionItemCode, bool childrens) { string[] returnValue = null; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { returnValue = new PiPermissionScopeManager(dbProvider, userInfo).GetTreeResourceScopeIds(userId, targetCategory, permissionItemCode, childrens); }); return(returnValue); }
/// <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(UserInfo userInfo, string resourceCategory, string[] resourceIds, string targetCategory, string revokeTargetId, string permissionItemId) { var returnValue = 0; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { returnValue = new PiPermissionScopeManager(dbProvider, userInfo).RevokeResourcePermissionScopeTarget(resourceCategory, resourceIds, targetCategory, revokeTargetId, permissionItemId); }); return(returnValue); }
/// <summary> /// 得到指定模块的操作权限主健数组 /// </summary> /// <param name="userInfo">用户</param> /// <param name="moduleId">模块主键</param> /// <returns>主键数组</returns> public string[] GetIdsByModule(UserInfo userInfo, string moduleId) { string[] returnValue = null; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { returnValue = new PermissionModuleManager(dbProvider, userInfo).GetPermissionIds(moduleId); }); return(returnValue); }
/// <summary> /// 获取倒序序列号 /// </summary> /// <param name="userInfo">用户</param> /// <param name="fullName">序列名称</param> /// <returns>序列号</returns> public string GetReduction(UserInfo userInfo, string fullName) { string returnValue = string.Empty; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIWriteDbWithLock(userInfo, parameter, Lock, dbProvider => { returnValue = this.GetReduction(dbProvider, userInfo, fullName); }); return(returnValue); }
/// <summary> /// 获取新序列号 /// </summary> /// <param name="userInfo">用户</param> /// <param name="fullName">序列名称</param> /// <param name="defaultSequence">默认序列</param> /// <param name="sequenceLength">序列长度</param> /// <param name="fillZeroPrefix">是否填充补零</param> /// <returns>序列号</returns> public string GetNewSequence(UserInfo userInfo, string fullName, int defaultSequence, int sequenceLength, bool fillZeroPrefix) { string returnValue = string.Empty; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIWriteDbWithLock(userInfo, parameter, Lock, dbProvider => { returnValue = new CiSequenceManager(dbProvider).GetSequence(fullName, defaultSequence, sequenceLength, fillZeroPrefix); }); return(returnValue); }
////////////////////////////////////////////////////////////////////////////////////////////////////// /// 组织机构模块关联关系相关 ////////////////////////////////////////////////////////////////////////////////////////////////////// #region public string[] GetScopeModuleIdsByOrganizeId(UserInfo userInfo, string organizeId, string permissionItemCode) 获取指定组织机构在某个权限域下所有模块主键数组 /// <summary> /// 获取指定组织机构在某个权限域下所有模块主键数组 /// </summary> /// <param name="userInfo">用户</param> /// <param name="organizeId">组织机构主键</param> /// <param name="permissionItemCode">操作权限编号</param> /// <returns>组织机构主键数组</returns> public string[] GetScopeModuleIdsByOrganizeId(UserInfo userInfo, string organizeId, string permissionItemCode) { string[] returnValue = null; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { returnValue = new OrganizeScopeManage(dbProvider, userInfo, PiPermissionScopeTable.TableName).GetModuleIds(organizeId, permissionItemCode); }); return(returnValue); }
/// <summary> /// 取得表权限控制数据表实体 /// </summary> /// <param name="userInfo">用户</param> /// <param name="name">字段名称</param> /// <param name="value">字段值</param> /// <returns>实体</returns> public PiTablePermissionScopeEntity GetTablePermissionScopeEntity(UserInfo userInfo, string name, object value) { PiTablePermissionScopeEntity entity = null; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { entity = new TablePermissionScopeManager(dbProvider, userInfo).GetEntity(name, value); }); return(entity); }
/// <summary> /// 获取组织机构主键数组通过指定操作权限 /// </summary> /// <param name="userInfo">用户</param> /// <param name="permissionItemId">操作权限主键</param> /// <returns>主键数组</returns> public string[] GetOrganizeIdsByPermissionItemId(UserInfo userInfo, string permissionItemId) { string[] returnValue = null; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { returnValue = new OrganizePermissionManager(dbProvider, userInfo, PiPermissionTable.TableName).GetOrganizeIds(permissionItemId); }); return(returnValue); }
/// <summary> /// 单个删除平台插件 /// </summary> /// <param name="userInfo">用户</param> /// <param name="id">主鍵</param> /// <returns>受影响的行数</returns> public int Delete(UserInfo userInfo, string id) { int returnValue = 0; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { returnValue = new PiPlatFormAddInManager(dbProvider, userInfo).Delete(id); }); return(returnValue); }
/// <summary> /// 获取用户角色列表 /// </summary> /// <param name="userInfo">用户</param> /// <param name="userId">用户主键</param> /// <returns>主键数组</returns> public string[] GetAllUserRoleIds(UserInfo userInfo, string userId) { string[] returnValue = null; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { returnValue = new PiUserRoleManager(dbProvider, userInfo).GetAllRoleIds(userId); }); return(returnValue); }
public byte[] GetTheLatestAddIn(UserInfo userInfo, string Id) { var dtAddIn = new DataTable(PiPlatFormAddInTable.TableName); var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { dtAddIn = new PiPlatFormAddInManager(dbProvider, userInfo).GetDTById(Id); }); return(BusinessLogic.GetBinaryFormatData(dtAddIn)); }
/// <summary> /// 获得用户的组织机构兼职情况 /// </summary> /// <param name="userInfo">用户</param> /// <param name="userId">用户主键</param> /// <returns>数据表</returns> public DataTable GetUserOrganizeDT(UserInfo userInfo, string userId) { var dataTable = new DataTable(PiStaffTable.TableName); var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { dataTable = new PiUserOrganizeManager(dbProvider, userInfo).GetUserOrganizeDT(userId); dataTable.TableName = PiUserOrganizeTable.TableName; }); return(dataTable); }
/// <summary> /// 批次設置刪除标志 /// </summary> /// <param name="userInfo">使用者</param> /// <param name="ids">主键数组</param> /// <returns>影响行数</returns> public int SetDeleted(UserInfo userInfo, string[] ids) { int returnValue = 0; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var manager = new CiItemDetailsManager(dbProvider, userInfo); returnValue = manager.SetDeleted(ids); }); return(returnValue); }
/// <summary> /// 批次保存数据 /// </summary> /// <param name="userInfo">使用者</param> /// <param name="entites">实体列表</param> /// <returns>影响行数</returns> public int BatchSave(UserInfo userInfo, List <CiItemDetailsEntity> entites) { int returnValue = 0; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var manager = new CiItemDetailsManager(dbProvider, userInfo); //returnValue = manager.BatchSave(entites); }); return(returnValue); }
/// <summary> /// 查询用户 /// </summary> /// <param name="userInfo">用户</param> /// <param name="searchValue">查询</param> /// <param name="auditStates">有效</param> /// <param name="roleIds">用户角色</param> /// <returns>数据表</returns> public DataTable Search(UserInfo userInfo, string searchValue, string auditStates, string[] roleIds) { var dataTable = new DataTable(PiUserTable.TableName); var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { dataTable = new PiUserManager(dbProvider, userInfo).Search(string.Empty, searchValue, roleIds, null, auditStates, string.Empty); dataTable.TableName = PiUserTable.TableName; }); return(dataTable); }
/// <summary> /// 批量保存 /// </summary> /// <param name="userInfo">用户</param> /// <param name="dataTable">数据表</param> /// <returns>影响行数</returns> public int BatchSave(UserInfo userInfo, DataTable dataTable) { int returnValue = 0; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var userManager = new PiUserManager(dbProvider, userInfo); returnValue = userManager.BatchSave(dataTable); }); return(returnValue); }
/// <summary> /// 取得平台插件列表 /// </summary> /// <param name="userInfo">用户</param> /// <returns>数据表</returns> public DataTable GetDT(UserInfo userInfo) { var dataTable = new DataTable(PiPlatFormAddInTable.TableName); var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { dataTable = new PiPlatFormAddInManager(dbProvider, userInfo).GetDT(CiDbLinkDefineTable.FieldDeleteMark, 0); dataTable.TableName = PiPlatFormAddInTable.TableName; }); return(dataTable); }
/// <summary> /// 设置可用性 /// </summary> /// <param name="userInfo">用户</param> /// <param name="id">主键</param> /// <param name="enabled">是否可用(1:可用、0:不可用)</param> /// <returns>受影响的行数</returns> public int SetEnabled(UserInfo userInfo, string id, int enabled) { var returnValue = 0; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { returnValue = new PiPlatFormAddInManager(dbProvider, userInfo).SetProperty(id, PiPlatFormAddInTable.FieldEnabled, enabled); }); return(returnValue); }
/// <summary> /// 批量删除文件列表 /// </summary> /// <param name="userInfo">用户</param> /// <param name="ids">主键数组</param> /// <returns>受影响的行数</returns> public int BatchDelete(UserInfo userInfo, string[] ids) { int returnValue = 0; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIWriteDbWithTran(userInfo, parameter, dbProvider => { var fileManager = new CiFileManager(dbProvider, userInfo); returnValue = fileManager.Delete(ids); }); return(returnValue); }
/// <summary> /// 取得实体 /// </summary> /// <param name="userInfo">用户</param> /// <param name="id">主鍵</param> /// <returns>实体</returns> public CiTableColumnsEntity GetEntity(UserInfo userInfo, string id) { CiTableColumnsEntity entity = null; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { entity = new TableColumnsManager(dbProvider, userInfo).GetEntity(id); }); return(entity); }
/// <summary> /// 获取实体 /// </summary> /// <param name="userInfo">用户</param> /// <param name="id">主键</param> /// <returns>实体</returns> public PiUserLogOnEntity GetEntity(UserInfo userInfo, string id) { PiUserLogOnEntity entity = null; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var manager = new PiUserLogOnManager(dbProvider, userInfo); entity = manager.GetEntity(id); }); return(entity); }
/// <summary> /// 按条件获取平台插件数据列表 /// </summary> /// <param name="userInfo">用户</param> /// <param name="names">字段</param> /// <param name="values">值</param> /// <returns>数据表</returns> public DataTable GetDTByValues(UserInfo userInfo, string[] names, object[] values) { var dataTable = new DataTable(PiPlatFormAddInTable.TableName); var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { dataTable = new PiPlatFormAddInManager(dbProvider, userInfo).GetDT(names, values); dataTable.TableName = PiPlatFormAddInTable.TableName; }); return(dataTable); }
/// <summary> /// 获取主键 /// </summary> /// <param name="userInfo">用户</param> /// <param name="name">查询的参数</param> /// <param name="value">参数值</param> /// <returns>影响行数</returns> public string GetId(UserInfo userInfo, string name, object value) { string returnValue = string.Empty; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { returnValue = new PiStaffManager(dbProvider).GetId(new KeyValuePair <string, object>(name, value)); }); return(returnValue); }
/// <summary> /// 批量移动文件到指定文件夹 /// </summary> /// <param name="userInfo">用户</param> /// <param name="ids"></param> /// <param name="folderId">文件夹主键</param> /// <returns>受影响的行数</returns> public int BatchMoveTo(UserInfo userInfo, string[] ids, string folderId) { int returnValue = 0; var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessRDIWriteDbWithTran(userInfo, parameter, dbProvider => { var fileManager = new CiFileManager(dbProvider, userInfo); returnValue += ids.Sum(t => fileManager.MoveTo(t, folderId)); }); return(returnValue); }