Exemplo n.º 1
0
        /// <summary>
        /// 授予资源的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="resourceCategory">资源分类</param>
        /// <param name="resourceId">资源主键</param>
        /// <param name="grantPermissionItemIds">操作权限主键</param>
        /// <returns>影响的行数</returns>
        public int GrantResourcePermission(UserInfo userInfo, string resourceCategory, string resourceId, string[] grantPermissionItemIds)
        {
            var returnValue = 0;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.PermissionService_GrantResourcePermission);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                if (grantPermissionItemIds != null)
                {
                    var permissionManager = new PiPermissionManager(dbProvider, userInfo);
                    for (int i = 0; i < grantPermissionItemIds.Length; i++)
                    {
                        var resourcePermissionEntity = new PiPermissionEntity
                        {
                            ResourceCategory = resourceCategory,
                            ResourceId       = resourceId,
                            PermissionId     = grantPermissionItemIds[i],
                            Enabled          = 1,
                            DeleteMark       = 0
                        };
                        permissionManager.Add(resourcePermissionEntity);
                        returnValue++;
                    }
                }
            });
            return(returnValue);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 按日期获取日志
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="beginDate">开始时间</param>
        /// <param name="endDate">结束时间</param>
        /// <param name="userId">用户主键</param>
        /// <param name="moduleId">模块主键</param>
        /// <returns>数据表</returns>
        public DataTable GetDTByDate(UserInfo userInfo, string beginDate, string endDate, string userId, string moduleId)
        {
            var dataTable = new DataTable(CiLogTable.TableName);
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.LogService_GetDTByDate);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var logManager = new LogManager(dbProvider, userInfo);
                if (!string.IsNullOrEmpty(userId))
                {
                    dataTable = logManager.GetDTByDateByUserIds(new[] { userId }, CiLogTable.FieldProcessId, moduleId, beginDate, endDate);
                }
                else
                {
                    if (userInfo.IsAdministrator)
                    {
                        dataTable = logManager.GetDTByDate(CiLogTable.FieldProcessId, moduleId, beginDate, endDate);
                    }
                    else
                    {
                        var piPermissionScopeManager = new PiPermissionScopeManager(dbProvider, userInfo);
                        string[] userIds             = piPermissionScopeManager.GetUserIds(userInfo.Id, "Resource.ManagePermission");
                        dataTable = logManager.GetDTByDateByUserIds(userIds, CiLogTable.FieldProcessId, moduleId, beginDate, endDate);
                    }
                }
                dataTable.TableName = CiLogTable.TableName;
            });

            return(dataTable);
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 用户离职
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userName">离职人员用户名</param>
        /// <param name="dimissionCause">离职原因</param>
        /// <param name="dimissionDate">离职日期</param>
        /// <param name="dimissionWhither">离职去向</param>
        /// <returns>大于0操作成功</returns>
        public int UserDimission(UserInfo userInfo, string userName, string dimissionCause, DateTime?dimissionDate, string dimissionWhither = null)
        {
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.LogOnService_UserDimission);
            int result    = 0;

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var manager    = new PiUserManager(userInfo);
                var parameters = new List <KeyValuePair <string, object> > {
                    new KeyValuePair <string, object>(PiUserTable.FieldUserName, userName),
                    new KeyValuePair <string, object>(PiUserTable.FieldEnabled, 1),
                    new KeyValuePair <string, object>(PiUserTable.FieldDeleteMark, 0)
                };
                var entity = BaseEntity.Create <PiUserEntity>(manager.GetDT(parameters, 0, null));
                if ((entity != null) && !string.IsNullOrEmpty(entity.Id))
                {
                    entity.Enabled          = 0;
                    entity.IsDimission      = 1;
                    entity.DimissionCause   = dimissionCause;
                    entity.DimissionWhither = dimissionWhither;
                    entity.DimissionDate    = dimissionDate ?? DateTime.Now;
                    result = manager.Update(entity);
                    //离职的员工就不能登录系统了,应该锁定了
                    var longOnmanager             = new PiUserLogOnManager();
                    PiUserLogOnEntity lonOnentity = longOnmanager.GetEntity(entity.Id);
                    lonOnentity.LockStartDate     = DateTime.Now;
                    result += longOnmanager.Update(lonOnentity);
                }
            });
            return(result);
        }
        /// <summary>
        /// 通过连接名称得到数据库连接定义
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="linkName">数据库连接定义名称</param>
        /// <returns>数据库连接定义实体</returns>
        public CiDbLinkDefineEntity GetEntityByLinkName(UserInfo userInfo, string linkName)
        {
            CiDbLinkDefineEntity entity = null;

            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, string.Empty);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var manager = new CiDbLinkDefineManager(dbProvider, userInfo);

                var names  = new string[3];
                var values = new object[3];
                names[0]   = CiDbLinkDefineTable.FieldLinkName;
                names[1]   = CiDbLinkDefineTable.FieldEnabled;
                names[2]   = CiDbLinkDefineTable.FieldDeleteMark;
                values[0]  = linkName;
                values[1]  = 1;
                values[2]  = 0;
                var dtTemp = manager.GetDT(names, values);
                if (dtTemp != null && dtTemp.Rows.Count > 0)
                {
                    entity = BaseEntity.Create <CiDbLinkDefineEntity>(dtTemp);
                }
            });
            return(entity);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 广播消息
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="message">消息内容</param>
        /// <returns>主键</returns>
        public int Broadcast(UserInfo userInfo, string message)
        {
            int returnValue = 0;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, "广播消息");

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                string[] receiverIds = null;
                var userManager      = new PiUserManager(dbProvider, userInfo);
                receiverIds          = userManager.GetIds(new KeyValuePair <string, object>(PiUserTable.FieldEnabled, 1), new KeyValuePair <string, object>(PiUserTable.FieldDeleteMark, 0));
                var messageManager   = new CiMessageManager(dbProvider, userInfo);
                var messageEntity    = new CiMessageEntity
                {
                    Id           = BusinessLogic.NewGuid(),
                    FunctionCode = MessageFunction.Remind.ToString(),
                    MSGContent   = message,
                    IsNew        = 1,
                    ReadCount    = 0,
                    Enabled      = 1,
                    DeleteMark   = 0
                };
                returnValue = messageManager.BatchSend(receiverIds, string.Empty, string.Empty, messageEntity, false);
            });
            return(returnValue);
        }
Exemplo n.º 7
0
        /// <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());
        }
Exemplo n.º 8
0
        /// <summary>
        /// 发送系统提示消息
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="receiverId">接收者主键</param>
        /// <param name="contents">内容</param>
        /// <returns>主键</returns>
        public string Remind(UserInfo userInfo, string receiverId, string contents)
        {
            string returnValue = string.Empty;
            var    parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, "发送系统提示消息");

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var entity = new CiMessageEntity
                {
                    Id           = BusinessLogic.NewGuid(),
                    CategoryCode = MessageCategory.Receiver.ToString(),
                    FunctionCode = MessageFunction.Remind.ToString(),
                    ReceiverId   = receiverId,
                    MSGContent   = contents,
                    IsNew        = (int)MessageStateCode.New,
                    ReadCount    = 0,
                    DeleteMark   = 0,
                    Enabled      = 1
                };
                var manager = new CiMessageManager(dbProvider, userInfo);
                returnValue = manager.Add(entity);
            });

            return(returnValue);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 按组织机构获取用户列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="organizeId">组织机构主键</param>
        /// <returns>数据表</returns>
        public DataTable GetUserDTByOrganize(UserInfo userInfo, string organizeId)
        {
            var dataTable = new DataTable(PiUserTable.TableName);

            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.MessageService_GetUserDTByOrganize);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var userManager = new PiUserManager(dbProvider, userInfo);

                string sqlQuery = " SELECT " + PiUserTable.TableName + ".* "
                                  + "," + PiUserLogOnTable.TableName + "." + PiUserLogOnTable.FieldUserOnLine
                                  + " FROM PIUSER LEFT OUTER JOIN PIUSERLOGON ON PIUSER.ID = PIUSERLOGON.ID "
                                  + " WHERE (" + PiUserTable.TableName + "." + PiUserTable.FieldDeleteMark + " = 0 "
                                  + " AND " + PiUserTable.TableName + "." + PiUserTable.FieldEnabled + " = 1  "
                                  + " AND " + PiUserTable.TableName + "." + PiUserTable.FieldIsVisible + " = 1 ) ";

                if (!String.IsNullOrEmpty(organizeId))
                {
                    // 绑定在工作组上的
                    sqlQuery += " AND ((" + PiUserTable.TableName + "." + PiUserTable.FieldWorkgroupId + " = '" + organizeId + "') ";
                    // 绑定在部门上的
                    sqlQuery += " OR (" + PiUserTable.TableName + "." + PiUserTable.FieldDepartmentId + " = '" + organizeId + "' AND " + PiUserTable.TableName + "." + PiUserTable.FieldWorkgroupId + " IS NULL) ";
                    // 绑定在公司上的
                    sqlQuery += " OR (" + PiUserTable.TableName + "." + PiUserTable.FieldCompanyId + " = '" + organizeId + "' AND " + PiUserTable.TableName + "." + PiUserTable.FieldDepartmentId + " IS NULL AND " + PiUserTable.TableName + "." + PiUserTable.FieldWorkgroupId + " IS NULL)) ";
                }
                sqlQuery           += " ORDER BY " + PiUserTable.TableName + "." + PiUserTable.FieldSortCode;
                dataTable           = userManager.Fill(sqlQuery);
                dataTable.TableName = PiUserTable.TableName;
            });
            return(dataTable);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 获取用户的角色列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <returns>数据表</returns>
        public DataTable GetRoleDT(UserInfo userInfo)
        {
            var dataTable = new DataTable(PiRoleTable.TableName);
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.UserService_GetRoleDT);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var roleManager = new PiRoleManager(dbProvider, userInfo);
                // 获取有效的,未必删除的数据,按排序码排序
                string[] names  = { PiRoleTable.FieldDeleteMark, PiRoleTable.FieldEnabled };
                Object[] values = { 0, 1 };
                dataTable       = roleManager.GetDT(names, values, PiRoleTable.FieldSortCode);
                // 不是超级管理员,不能添加超级管理员
                if (!userInfo.IsAdministrator)
                {
                    foreach (DataRow dataRow in dataTable.Rows.Cast <DataRow>().Where(dataRow => dataRow[PiRoleTable.FieldCode].ToString().Equals(DefaultRole.Administrators.ToString())))
                    {
                        dataRow.Delete();
                    }
                    dataTable.AcceptChanges();
                }
                dataTable.TableName        = PiUserTable.TableName;
                dataTable.DefaultView.Sort = PiUserTable.FieldSortCode;
            });
            return(dataTable);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 按某个权限范围获取特定用户可访问的操作权限列表(有授权权限的权限列表)
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemCode">权限域编号</param>
        /// <returns>数据表</returns>
        public DataTable GetPermissionItemDTByPermissionScope(UserInfo userInfo, string userId, string permissionItemCode)
        {
            var dataTable = new DataTable(PiPermissionItemTable.TableName);
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.PermissionService_GetPermissionItemDTByPermissionScope);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var permissionItemManager = new PiPermissionItemManager(dbProvider, userInfo);
                var permissionItemId      = permissionItemManager.GetId(PiPermissionItemTable.FieldCode, permissionItemCode);
                // 数据库里没有设置可授权的权限项,系统自动增加一个权限配置项
                if (String.IsNullOrEmpty(permissionItemId) && permissionItemCode.Equals("Resource.ManagePermission"))
                {
                    var permissionItemEntity = new PiPermissionItemEntity
                    {
                        Code        = "Resource.ManagePermission",
                        FullName    = "资源管理范围权限(系统默认)",
                        IsScope     = 1,
                        Enabled     = 1,
                        AllowDelete = 0
                    };
                    permissionItemManager.AddEntity(permissionItemEntity);
                }
                dataTable           = permissionItemManager.GetDTByUser(userId, permissionItemCode);
                dataTable.TableName = PiPermissionItemTable.TableName;
            });
            return(dataTable);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 解锁指定用户
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userName">登录名(用户名)</param>
        /// <returns>大于0解锁成功</returns>
        public int UnLockUser(UserInfo userInfo, string userName)
        {
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.LogOnService_UnLockUser);
            int result    = 0;

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var manager    = new PiUserManager(userInfo);
                var parameters = new List <KeyValuePair <string, object> > {
                    new KeyValuePair <string, object>(PiUserTable.FieldUserName, userName),
                    new KeyValuePair <string, object>(PiUserTable.FieldEnabled, 1),
                    new KeyValuePair <string, object>(PiUserTable.FieldDeleteMark, 0)
                };
                var entity = BaseEntity.Create <PiUserEntity>(manager.GetDT(parameters, 0, null));
                if ((entity != null) && !string.IsNullOrEmpty(entity.Id))
                {
                    var longOnmanager             = new PiUserLogOnManager();
                    PiUserLogOnEntity lonOnentity = longOnmanager.GetEntity(entity.Id);
                    lonOnentity.LockStartDate     = null;
                    lonOnentity.LockEndDate       = null;
                    result = longOnmanager.Update(lonOnentity);
                }
            });
            return(result);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 撤消资源的权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="resourceCategory">资源分类</param>
        /// <param name="resourceId">资源主键</param>
        /// <param name="revokePermissionItemIds">操作权限主键</param>
        /// <returns>影响的行数</returns>
        public int RevokeResourcePermission(UserInfo userInfo, string resourceCategory, string resourceId, string[] revokePermissionItemIds)
        {
            var returnValue = 0;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.PermissionService_RevokeResourcePermission);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                if (revokePermissionItemIds != null)
                {
                    var permissionManager = new PiPermissionManager(dbProvider, userInfo);
                    string[] names        = new string[3];
                    string[] values       = new string[3];
                    names[0]  = PiPermissionTable.FieldResourceCategory;
                    values[0] = resourceCategory;
                    names[1]  = PiPermissionTable.FieldResourceId;
                    values[1] = resourceId;
                    names[2]  = PiPermissionTable.FieldPermissionId;
                    for (int i = 0; i < revokePermissionItemIds.Length; i++)
                    {
                        values[2] = revokePermissionItemIds[i];
                        // returnValue += permissionManager.SetDeleted(names, values);
                        returnValue += permissionManager.Delete(names, values);
                    }
                }
            });
            return(returnValue);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 用户离线
        /// </summary>
        /// <param name="userInfo">用户</param>
        public void OnExit(UserInfo userInfo)
        {
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.LogOnService_OnExit);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var manager = new PiUserLogOnManager(dbProvider, userInfo);
                manager.OnExit(userInfo.Id);
            });
        }
Exemplo n.º 15
0
        /// <summary>
        /// 全部清除异常
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <returns>数据表</returns>
        public void Truncate(UserInfo userInfo)
        {
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.ExceptionService_Truncate);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                var exceptionManager = new CiExceptionManager(dbProvider, userInfo);
                exceptionManager.Truncate();
            });
        }
Exemplo n.º 16
0
        /// <summary>
        /// 清除用户归属的角色
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <returns>影响行数</returns>
        public int ClearUserRole(UserInfo userInfo, string userId)
        {
            int returnValue = 0;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.UserService_ClearUserRole, "用户:" + userId);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                returnValue = new PiUserRoleManager(dbProvider, userInfo).ClearUserRole(userId);
            });
            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="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);
        }
Exemplo n.º 19
0
        /// <summary>
        /// 获得指定用户的数据权限范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemCode">数据权限编号</param>
        /// <returns>数据权限范围</returns>
        public PermissionScope GetPermissionScopeByUserId(UserInfo userInfo, string userId, string permissionItemCode)
        {
            var returnValue = PermissionScope.None;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.PermissionService_GetPermissionScopeByUserId);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                returnValue = new PiPermissionScopeManager(dbProvider, userInfo).GetUserPermissionScope(userId, permissionItemCode);
            });
            return(returnValue);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 批量删除用户组织机构关联
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <returns>影响行数</returns>
        public int BatchDeleteUserOrganize(UserInfo userInfo, string[] ids)
        {
            int returnValue = 0;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.UserService_BatchDeleteUserOrganize, "主键数组:" + BusinessLogic.ArrayToList(ids));

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                returnValue = new PiUserOrganizeManager(dbProvider, userInfo).Delete(ids);
            });
            return(returnValue);
        }
Exemplo n.º 21
0
        /// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="tableName">目标表</param>
        /// <param name="id">主键</param>
        /// <returns>影响的行数</returns>
        public int Delete(UserInfo userInfo, string tableName, string id)
        {
            int returnValue = 0;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.ItemsService_Delete);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                returnValue = new CiItemsManager(dbProvider, userInfo, tableName).Delete(id);
            });
            return(returnValue);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 移动实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="id">主键</param>
        /// <param name="parentId">父主键</param>
        /// <returns>影响行数</returns>
        public int MoveToQueryEngine(UserInfo userInfo, string id, string parentId)
        {
            var returnValue = 0;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.QueryEnginService_MoveTo, "权限项主键:" + id + ",父主键:" + parentId);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                returnValue = new QueryEngineManager(dbProvider, userInfo).MoveTo(id, parentId);
            });
            return(returnValue);
        }
Exemplo n.º 23
0
        /// <summary>
        /// 按角色获取用户列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleIds">角色列表</param>
        /// <returns>用户列表</returns>
        public List <PiUserEntity> GetListByRole(UserInfo userInfo, string[] roleIds)
        {
            var parameter  = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.UserService_GetDTByRole);
            var entityList = new List <PiUserEntity>();

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                entityList = new PiUserManager(dbProvider, userInfo).GetListByRole(roleIds);
            });
            return(entityList);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 指定用户是否超级管理员
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userId">用户主键</param>
        /// <returns>是否超级管理员,true:是,false:否</returns>
        public bool IsAdministratorByUserId(UserInfo userInfo, string userId)
        {
            var returnValue = false;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.PermissionService_IsAdministratorByUserId);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                returnValue = new PiUserManager(dbProvider, userInfo).IsAdministrator(userId);
            });
            return(returnValue);
        }
Exemplo n.º 25
0
        /// <summary>
        /// 取得实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="id">主键</param>
        /// <returns>实体</returns>
        public CiMessageEntity GetEntity(UserInfo userInfo, string id)
        {
            CiMessageEntity entity    = null;
            var             parameter = ParameterUtil.CreateWithOutMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                entity = new CiMessageManager(dbProvider, userInfo).GetEntity(id);
            });
            return(entity);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="id">主鍵</param>
        /// <returns>实体</returns>
        public PiStaffEntity GetEntity(UserInfo userInfo, string id)
        {
            PiStaffEntity entity    = null;
            var           parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.StaffService_GetEntity);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                entity = new PiStaffManager(dbProvider, userInfo).GetEntity(id);
            });
            return(entity);
        }
        /// <summary>
        /// 获取角色主键数组通过指定操作权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="permissionItemId">操作权限主键</param>
        /// <returns>主键数组</returns>
        public string[] GetRoleIdsByPermissionItemId(UserInfo userInfo, string permissionItemId)
        {
            string[] returnValue = null;
            var      parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.PermissionService_GetRoleIdsByPermissionItemId);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                returnValue = new RolePermissionManager(dbProvider, userInfo).GetRoleIds(permissionItemId);
            });
            return(returnValue);
        }
Exemplo n.º 28
0
        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));
        }
Exemplo n.º 29
0
        /// <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.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.StaffService_BatchDelete);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                returnValue = new PiStaffManager(dbProvider, userInfo).BatchDelete(ids);
            });
            return(returnValue);
        }
Exemplo n.º 30
0
        /// <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);
        }