Ejemplo n.º 1
0
        public bool DeleteSystemRole(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, int systemRoleId)
        {
            BusinessObjects.AuthorizationDS.SystemRoleAndBusinessOperateDataTable table = this.RoleAndOperateTA.GetDataBySystemRoleId(systemRoleId);
            foreach (AuthorizationDS.SystemRoleAndBusinessOperateRow row in table)
            {
                row.Delete();
            }
            this.RoleAndOperateTA.Update(table);

            AuthorizationDS.PositionAndSystemRoleDataTable positionAndRoleTable = this.PositionAndSystemRoleTA.GetDataBySystemRoleId(systemRoleId);
            foreach (AuthorizationDS.PositionAndSystemRoleRow row in positionAndRoleTable)
            {
                row.Delete();
            }
            this.PositionAndSystemRoleTA.Update(positionAndRoleTable);

            BusinessObjects.AuthorizationDS.SystemRoleDataTable roleTable = this.SystemRoleTA.GetDataById(systemRoleId);

            string roleName = roleTable[0].SystemRoleName;

            roleTable[0].Delete();
            int rowsAffected = this.SystemRoleTA.Update(roleTable);

            AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();

            authorizationConfigure.StuffId         = stuffUser.StuffId;
            authorizationConfigure.StuffName       = stuffUser.StuffName;
            authorizationConfigure.ConfigureTarget = "系统角色设置";
            authorizationConfigure.ConfigureTime   = DateTime.Now;
            authorizationConfigure.ConfigureType   = "删除";
            authorizationConfigure.OldContent      = "系统角色:" + roleName;
            SysLog.LogAuthorizationConfigure(authorizationConfigure);

            return(rowsAffected == 1);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 设置职务的系统角色
        /// </summary>
        /// <param name="positionId"></param>
        /// <param name="systemRoleIds"></param>
        public void SetPositionSystemRole(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, int positionId, int[] systemRoleIds)
        {
            StringBuilder oldContent = new StringBuilder();
            StringBuilder newContent = new StringBuilder();

            BusinessObjects.AuthorizationDS.PositionAndSystemRoleDataTable table = this.PositionAndSystemRoleTA.GetDataByPositionId(positionId);
            List <int> roleIds = new List <int>(systemRoleIds);

            foreach (BusinessObjects.AuthorizationDS.PositionAndSystemRoleRow positionAndSystemRole in table)
            {
                if (roleIds.Contains(positionAndSystemRole.SystemRoleId))
                {
                    roleIds.Remove(positionAndSystemRole.SystemRoleId);
                }
                else
                {
                    oldContent.Append("[").Append(this.SystemRoleTA.GetSystemRoleName(positionAndSystemRole.SystemRoleId)).Append("] ");
                    positionAndSystemRole.Delete();
                }
            }
            foreach (int roleId in roleIds)
            {
                BusinessObjects.AuthorizationDS.PositionAndSystemRoleRow newRow = table.NewPositionAndSystemRoleRow();
                newRow.PositionId   = positionId;
                newRow.SystemRoleId = roleId;
                newContent.Append("[").Append(this.SystemRoleTA.GetSystemRoleName(roleId)).Append("] ");
                table.AddPositionAndSystemRoleRow(newRow);
            }

            this.PositionAndSystemRoleTA.Update(table);

            if (oldContent.Length > 0 || newContent.Length > 0)
            {
                AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();
                authorizationConfigure.StuffId         = stuffUser.StuffId;
                authorizationConfigure.StuffName       = stuffUser.StuffName;
                authorizationConfigure.ConfigureTarget = "职务权限设置";
                authorizationConfigure.ConfigureTime   = DateTime.Now;
                authorizationConfigure.ConfigureType   = "更新";
                string positionName = new OUTreeBLL().GetPositionById(positionId).PositionName;
                if (oldContent.Length > 0)
                {
                    oldContent.Insert(0, "撤销职务[" + positionName + "]的系统角色:");
                    authorizationConfigure.OldContent = oldContent.ToString();
                }
                if (newContent.Length > 0)
                {
                    newContent.Insert(0, "新增职务[" + positionName + "]的系统角色:");
                    authorizationConfigure.NewContent = newContent.ToString();
                }
                SysLog.LogAuthorizationConfigure(authorizationConfigure);
            }
        }
Ejemplo n.º 3
0
        public bool InsertSystemRole(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, string systemRoleName, string description)
        {
            if (systemRoleName == null || systemRoleName.Length == 0)
            {
                throw new ApplicationException("系统角色名称不能为空");
            }
            BusinessObjects.AuthorizationDS.SystemRoleDataTable table = this.SystemRoleTA.GetDataBySystemRoleName(systemRoleName);
            if (table != null && table.Count > 0)
            {
                throw new ApplicationException("系统角色名称不能重复");
            }

            int rowsAffected = this.SystemRoleTA.Insert(systemRoleName, description);
            AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();

            authorizationConfigure.StuffId         = stuffUser.StuffId;
            authorizationConfigure.StuffName       = stuffUser.StuffName;
            authorizationConfigure.ConfigureTarget = "系统角色设置";
            authorizationConfigure.ConfigureTime   = DateTime.Now;
            authorizationConfigure.ConfigureType   = "新增";
            authorizationConfigure.NewContent      = "系统角色:" + systemRoleName;
            SysLog.LogAuthorizationConfigure(authorizationConfigure);
            return(rowsAffected == 1);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="newOperateIds"></param>
        /// <param name="roleId"></param>
        public void SetSystemRoleOperateRight(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, List<int> newOperateIds, int roleId)
        {
            List<int> deleteOperateIds = new List<int>();

            SystemRoleAndBusinessOperateTableAdapter da = new SystemRoleAndBusinessOperateTableAdapter();
            BusinessObjects.AuthorizationDS.SystemRoleAndBusinessOperateDataTable table = da.GetDataBySystemRoleId(roleId);
            foreach (BusinessObjects.AuthorizationDS.SystemRoleAndBusinessOperateRow row in table) {

                if (newOperateIds.Contains(row.BusinessOperateId)) {
                    newOperateIds.Remove(row.BusinessOperateId);
                } else {
                    deleteOperateIds.Add(row.BusinessOperateId);
                    row.Delete();
                }
            }
            AuthorizationDS.SystemRoleAndBusinessOperateDataTable newTable = new AuthorizationDS.SystemRoleAndBusinessOperateDataTable();
            foreach (int newOperateId in newOperateIds) {
                BusinessObjects.AuthorizationDS.SystemRoleAndBusinessOperateRow newRow = newTable.NewSystemRoleAndBusinessOperateRow();
                newRow.BusinessOperateId = newOperateId;
                newRow.SystemRoleId = roleId;
                newTable.AddSystemRoleAndBusinessOperateRow(newRow);
            }

            da.Update(table);
            da.Update(newTable);

            if (deleteOperateIds.Count > 0 || newOperateIds.Count > 0) {
                AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();
                authorizationConfigure.StuffId = stuffUser.StuffId;
                authorizationConfigure.StuffName = stuffUser.StuffName;
                authorizationConfigure.ConfigureTarget = "ϵͳ��ɫ����";
                authorizationConfigure.ConfigureTime = DateTime.Now;
                authorizationConfigure.ConfigureType = "����";
                if (deleteOperateIds.Count > 0) {
                    StringBuilder oldContent = new StringBuilder();
                    oldContent.Append("����ϵͳ��ɫ[").Append(this.SystemRoleTA.GetSystemRoleName(roleId)).Append("]��Ȩҵ�����:");
                    foreach (int id in deleteOperateIds) {
                        oldContent.Append("[").Append(this.BusinessOperateTA.GetBusinessUseCaseName(id) + "-" + this.BusinessOperateTA.GetBusinessOperateName(id)).Append("] ");
                    }
                    authorizationConfigure.OldContent = oldContent.ToString();
                }
                if (newOperateIds.Count > 0) {
                    StringBuilder newContent = new StringBuilder();
                    newContent.Append("����ϵͳ��ɫ[").Append(this.SystemRoleTA.GetSystemRoleName(roleId));
                    newContent.Append("]��Ȩҵ�������");
                    foreach (int id in newOperateIds) {
                        newContent.Append("[").Append(this.BusinessOperateTA.GetBusinessUseCaseName(id) + "-" + this.BusinessOperateTA.GetBusinessOperateName(id)).Append("] ");
                    }

                    authorizationConfigure.NewContent = newContent.ToString();
                }
                SysLog.LogAuthorizationConfigure(authorizationConfigure);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// ����ְ���ϵͳ��ɫ
        /// </summary>
        /// <param name="positionId"></param>
        /// <param name="systemRoleIds"></param>
        public void SetPositionSystemRole(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, int positionId, int[] systemRoleIds)
        {
            StringBuilder oldContent = new StringBuilder();
            StringBuilder newContent = new StringBuilder();

            BusinessObjects.AuthorizationDS.PositionAndSystemRoleDataTable table = this.PositionAndSystemRoleTA.GetDataByPositionId(positionId);
            List<int> roleIds = new List<int>(systemRoleIds);
            foreach (BusinessObjects.AuthorizationDS.PositionAndSystemRoleRow positionAndSystemRole in table) {
                if (roleIds.Contains(positionAndSystemRole.SystemRoleId)) {
                    roleIds.Remove(positionAndSystemRole.SystemRoleId);
                } else {
                    oldContent.Append("[").Append(this.SystemRoleTA.GetSystemRoleName(positionAndSystemRole.SystemRoleId)).Append("] ");
                    positionAndSystemRole.Delete();
                }
            }
            foreach (int roleId in roleIds) {
                BusinessObjects.AuthorizationDS.PositionAndSystemRoleRow newRow = table.NewPositionAndSystemRoleRow();
                newRow.PositionId = positionId;
                newRow.SystemRoleId = roleId;
                newContent.Append("[").Append(this.SystemRoleTA.GetSystemRoleName(roleId)).Append("] ");
                table.AddPositionAndSystemRoleRow(newRow);
            }

            this.PositionAndSystemRoleTA.Update(table);

            if (oldContent.Length > 0 || newContent.Length > 0) {
                AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();
                authorizationConfigure.StuffId = stuffUser.StuffId;
                authorizationConfigure.StuffName = stuffUser.StuffName;
                authorizationConfigure.ConfigureTarget = "ְ��Ȩ������";
                authorizationConfigure.ConfigureTime = DateTime.Now;
                authorizationConfigure.ConfigureType = "����";
                string positionName = new OUTreeBLL().GetPositionById(positionId).PositionName;
                if (oldContent.Length > 0) {
                    oldContent.Insert(0, "����ְ��[" + positionName + "]��ϵͳ��ɫ��");
                    authorizationConfigure.OldContent = oldContent.ToString();
                }
                if (newContent.Length > 0) {
                    newContent.Insert(0, "����ְ��[" + positionName + "]��ϵͳ��ɫ��");
                    authorizationConfigure.NewContent = newContent.ToString();
                }
                SysLog.LogAuthorizationConfigure(authorizationConfigure);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// ��������ְ���ҵ�������Χ
        /// </summary>
        /// <param name="positionId">ְ��ID</param>
        /// <param name="operateIds">����ҵ�����ID����</param>
        /// <param name="scopeOUIds">������Χ���ǵ���֯����ID����</param>
        /// <param name="scopePOIds">������Χ���ǵ�ְ��ID����</param>
        public void SetOperateScope(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, int positionId, int[] operateIds, int[] scopeOUIds, int[] scopePOIds)
        {
            StringBuilder deleteContent = new StringBuilder();
            StringBuilder addContent = new StringBuilder();

            foreach (int operateId in operateIds) {
                string operateName = (string)this.BusinessOperateTA.GetBusinessOperateName(operateId);
                StringBuilder addStr = new StringBuilder();
                StringBuilder deleteStr = new StringBuilder();
                List<int> sOUIds = new List<int>(scopeOUIds);
                List<int> sPOIds = new List<int>(scopePOIds);
                BusinessObjects.AuthorizationDS.OperateScopeDataTable table = this.OperateScopeTA.GetDataByOperateAndPosition(operateId, positionId);
                foreach (BusinessObjects.AuthorizationDS.OperateScopeRow operateScope in table) {
                    if (operateScope.IsScopeOrganziationUnitIdNull()) {
                        if (sPOIds.Contains(operateScope.ScopePositionId)) {
                            sPOIds.Remove(operateScope.ScopePositionId);
                        } else {
                            deleteStr.Append("ְ��[" +
                            new OUTreeBLL().GetPositionById(operateScope.ScopePositionId).PositionName + "] ");
                            operateScope.Delete();
                        }
                    } else {
                        if (sOUIds.Contains(operateScope.ScopeOrganziationUnitId)) {
                            sOUIds.Remove(operateScope.ScopeOrganziationUnitId);
                        } else {
                            deleteStr.Append("����[" +
                            new OUTreeBLL().GetOrganizationUnitById(operateScope.ScopeOrganziationUnitId).OrganizationUnitName + "] ");

                            operateScope.Delete();
                        }
                    }
                }

                if (deleteStr.Length > 0) {
                    deleteStr.Insert(0, "����ҵ�����[" + operateName + "]�������ݷ�Χ��");
                    deleteContent.Append(deleteStr.ToString());
                }

                foreach (int ouId in sOUIds) {
                    BusinessObjects.AuthorizationDS.OperateScopeRow newRow = table.NewOperateScopeRow();
                    newRow.PositionId = positionId;
                    newRow.BusinessOperateId = operateId;
                    newRow.ScopeOrganziationUnitId = ouId;
                    table.AddOperateScopeRow(newRow);
                    addStr.Append("����[" + new OUTreeBLL().GetOrganizationUnitById(ouId).OrganizationUnitName + "] ");
                }
                foreach (int poId in sPOIds) {
                    BusinessObjects.AuthorizationDS.OperateScopeRow newRow = table.NewOperateScopeRow();
                    newRow.PositionId = positionId;
                    newRow.BusinessOperateId = operateId;
                    newRow.ScopePositionId = poId;
                    table.AddOperateScopeRow(newRow);
                    addStr.Append("ְ��[" + new OUTreeBLL().GetPositionById(poId).PositionName + "] ");
                }

                if (addStr.Length > 0) {
                    addStr.Insert(0, "����ҵ�����[" + operateName + "]�������ݷ�Χ��");
                    addContent.Append(addStr.ToString());
                }

                this.OperateScopeTA.Update(table);
            }
            if (deleteContent.Length > 0 || addContent.Length > 0) {
                AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();
                authorizationConfigure.StuffId = stuffUser.StuffId;
                authorizationConfigure.StuffName = stuffUser.StuffName;
                authorizationConfigure.ConfigureType = "����";
                authorizationConfigure.ConfigureTarget = "ҵ�������Χ";
                authorizationConfigure.ConfigureTime = DateTime.Now;
                string positionName = new OUTreeBLL().GetPositionById(positionId).PositionName;
                if (deleteContent.Length > 0) {
                    deleteContent.Insert(0, "ְ��[" + positionName + "]��");
                    authorizationConfigure.OldContent = deleteContent.ToString();
                }
                if (addContent.Length > 0) {
                    addContent.Insert(0, "ְ��[" + positionName + "]��");
                    authorizationConfigure.NewContent = addContent.ToString();
                }
                SysLog.LogAuthorizationConfigure(authorizationConfigure);
            }
        }
Ejemplo n.º 7
0
        public bool InsertSystemRole(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, string systemRoleName, string description)
        {
            if (systemRoleName == null || systemRoleName.Length == 0) {
                throw new ApplicationException("ϵͳ��ɫ���Ʋ���Ϊ��");
            }
            BusinessObjects.AuthorizationDS.SystemRoleDataTable table = this.SystemRoleTA.GetDataBySystemRoleName(systemRoleName);
            if (table != null && table.Count > 0) {
                throw new ApplicationException("ϵͳ��ɫ���Ʋ����ظ�");
            }

            int rowsAffected = this.SystemRoleTA.Insert(systemRoleName, description);
            AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();
            authorizationConfigure.StuffId = stuffUser.StuffId;
            authorizationConfigure.StuffName = stuffUser.StuffName;
            authorizationConfigure.ConfigureTarget = "ϵͳ��ɫ����";
            authorizationConfigure.ConfigureTime = DateTime.Now;
            authorizationConfigure.ConfigureType = "����";
            authorizationConfigure.NewContent = "ϵͳ��ɫ��" + systemRoleName;
            SysLog.LogAuthorizationConfigure(authorizationConfigure);
            return rowsAffected == 1;
        }
Ejemplo n.º 8
0
        public bool DeleteSystemRole(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, int systemRoleId)
        {
            BusinessObjects.AuthorizationDS.SystemRoleAndBusinessOperateDataTable table = this.RoleAndOperateTA.GetDataBySystemRoleId(systemRoleId);
            foreach (AuthorizationDS.SystemRoleAndBusinessOperateRow row in table) {
                row.Delete();
            }
            this.RoleAndOperateTA.Update(table);

            AuthorizationDS.PositionAndSystemRoleDataTable positionAndRoleTable = this.PositionAndSystemRoleTA.GetDataBySystemRoleId(systemRoleId);
            foreach (AuthorizationDS.PositionAndSystemRoleRow row in positionAndRoleTable) {
                row.Delete();
            }
            this.PositionAndSystemRoleTA.Update(positionAndRoleTable);

            BusinessObjects.AuthorizationDS.SystemRoleDataTable roleTable = this.SystemRoleTA.GetDataById(systemRoleId);

            string roleName = roleTable[0].SystemRoleName;
            roleTable[0].Delete();
            int rowsAffected = this.SystemRoleTA.Update(roleTable);

            AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();
            authorizationConfigure.StuffId = stuffUser.StuffId;
            authorizationConfigure.StuffName = stuffUser.StuffName;
            authorizationConfigure.ConfigureTarget = "ϵͳ��ɫ����";
            authorizationConfigure.ConfigureTime = DateTime.Now;
            authorizationConfigure.ConfigureType = "ɾ��";
            authorizationConfigure.OldContent = "ϵͳ��ɫ��" + roleName;
            SysLog.LogAuthorizationConfigure(authorizationConfigure);

            return rowsAffected == 1;
        }
Ejemplo n.º 9
0
 public static void LogAuthorizationConfigure(AuthorizationConfigure configure)
 {
     SysTrace.TraceData(TraceEventType.Information, (int)LogType.AuthorizationConfigure, configure);
 }
Ejemplo n.º 10
0
 public void LogAuthorizationConfigure(AuthorizationConfigure configure)
 {
     this.AuthorizationConfigureLogTA.Insert(configure.ConfigureTarget,
                                             configure.NewContent, configure.OldContent, configure.ConfigureType,
                                             configure.ConfigureTime, configure.StuffId, configure.StuffName);
 }
Ejemplo n.º 11
0
 public static void LogAuthorizationConfigure(AuthorizationConfigure configure)
 {
     SysTrace.TraceData(TraceEventType.Information, (int)LogType.AuthorizationConfigure, configure);
 }
Ejemplo n.º 12
0
 public void LogAuthorizationConfigure(AuthorizationConfigure configure)
 {
     this.AuthorizationConfigureLogTA.Insert(configure.ConfigureTarget,
         configure.NewContent, configure.OldContent, configure.ConfigureType,
         configure.ConfigureTime, configure.StuffId, configure.StuffName);
 }
Ejemplo n.º 13
0
        /// <summary>
        /// 批量设置职务的业务操作范围
        /// </summary>
        /// <param name="positionId">职务ID</param>
        /// <param name="operateIds">批量业务操作ID数组</param>
        /// <param name="scopeOUIds">操作范围覆盖的组织机构ID数组</param>
        /// <param name="scopePOIds">操作范围覆盖的职务ID数组</param>
        public void SetOperateScope(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, int positionId, int[] operateIds, int[] scopeOUIds, int[] scopePOIds)
        {
            StringBuilder deleteContent = new StringBuilder();
            StringBuilder addContent    = new StringBuilder();

            foreach (int operateId in operateIds)
            {
                string        operateName = (string)this.BusinessOperateTA.GetBusinessOperateName(operateId);
                StringBuilder addStr      = new StringBuilder();
                StringBuilder deleteStr   = new StringBuilder();
                List <int>    sOUIds      = new List <int>(scopeOUIds);
                List <int>    sPOIds      = new List <int>(scopePOIds);
                BusinessObjects.AuthorizationDS.OperateScopeDataTable table = this.OperateScopeTA.GetDataByOperateAndPosition(operateId, positionId);
                foreach (BusinessObjects.AuthorizationDS.OperateScopeRow operateScope in table)
                {
                    if (operateScope.IsScopeOrganziationUnitIdNull())
                    {
                        if (sPOIds.Contains(operateScope.ScopePositionId))
                        {
                            sPOIds.Remove(operateScope.ScopePositionId);
                        }
                        else
                        {
                            deleteStr.Append("职务[" +
                                             new OUTreeBLL().GetPositionById(operateScope.ScopePositionId).PositionName + "] ");
                            operateScope.Delete();
                        }
                    }
                    else
                    {
                        if (sOUIds.Contains(operateScope.ScopeOrganziationUnitId))
                        {
                            sOUIds.Remove(operateScope.ScopeOrganziationUnitId);
                        }
                        else
                        {
                            deleteStr.Append("机构[" +
                                             new OUTreeBLL().GetOrganizationUnitById(operateScope.ScopeOrganziationUnitId).OrganizationUnitName + "] ");

                            operateScope.Delete();
                        }
                    }
                }

                if (deleteStr.Length > 0)
                {
                    deleteStr.Insert(0, "撤销业务操作[" + operateName + "]包含数据范围:");
                    deleteContent.Append(deleteStr.ToString());
                }

                foreach (int ouId in sOUIds)
                {
                    BusinessObjects.AuthorizationDS.OperateScopeRow newRow = table.NewOperateScopeRow();
                    newRow.PositionId              = positionId;
                    newRow.BusinessOperateId       = operateId;
                    newRow.ScopeOrganziationUnitId = ouId;
                    table.AddOperateScopeRow(newRow);
                    addStr.Append("机构[" + new OUTreeBLL().GetOrganizationUnitById(ouId).OrganizationUnitName + "] ");
                }
                foreach (int poId in sPOIds)
                {
                    BusinessObjects.AuthorizationDS.OperateScopeRow newRow = table.NewOperateScopeRow();
                    newRow.PositionId        = positionId;
                    newRow.BusinessOperateId = operateId;
                    newRow.ScopePositionId   = poId;
                    table.AddOperateScopeRow(newRow);
                    addStr.Append("职务[" + new OUTreeBLL().GetPositionById(poId).PositionName + "] ");
                }

                if (addStr.Length > 0)
                {
                    addStr.Insert(0, "新增业务操作[" + operateName + "]包含数据范围:");
                    addContent.Append(addStr.ToString());
                }

                this.OperateScopeTA.Update(table);
            }
            if (deleteContent.Length > 0 || addContent.Length > 0)
            {
                AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();
                authorizationConfigure.StuffId         = stuffUser.StuffId;
                authorizationConfigure.StuffName       = stuffUser.StuffName;
                authorizationConfigure.ConfigureType   = "更新";
                authorizationConfigure.ConfigureTarget = "业务操作范围";
                authorizationConfigure.ConfigureTime   = DateTime.Now;
                string positionName = new OUTreeBLL().GetPositionById(positionId).PositionName;
                if (deleteContent.Length > 0)
                {
                    deleteContent.Insert(0, "职务[" + positionName + "]:");
                    authorizationConfigure.OldContent = deleteContent.ToString();
                }
                if (addContent.Length > 0)
                {
                    addContent.Insert(0, "职务[" + positionName + "]:");
                    authorizationConfigure.NewContent = addContent.ToString();
                }
                SysLog.LogAuthorizationConfigure(authorizationConfigure);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="newOperateIds"></param>
        /// <param name="roleId"></param>
        public void SetSystemRoleOperateRight(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, List <int> newOperateIds, int roleId)
        {
            List <int> deleteOperateIds = new List <int>();

            SystemRoleAndBusinessOperateTableAdapter da = new SystemRoleAndBusinessOperateTableAdapter();

            BusinessObjects.AuthorizationDS.SystemRoleAndBusinessOperateDataTable table = da.GetDataBySystemRoleId(roleId);
            foreach (BusinessObjects.AuthorizationDS.SystemRoleAndBusinessOperateRow row in table)
            {
                if (newOperateIds.Contains(row.BusinessOperateId))
                {
                    newOperateIds.Remove(row.BusinessOperateId);
                }
                else
                {
                    deleteOperateIds.Add(row.BusinessOperateId);
                    row.Delete();
                }
            }
            AuthorizationDS.SystemRoleAndBusinessOperateDataTable newTable = new AuthorizationDS.SystemRoleAndBusinessOperateDataTable();
            foreach (int newOperateId in newOperateIds)
            {
                BusinessObjects.AuthorizationDS.SystemRoleAndBusinessOperateRow newRow = newTable.NewSystemRoleAndBusinessOperateRow();
                newRow.BusinessOperateId = newOperateId;
                newRow.SystemRoleId      = roleId;
                newTable.AddSystemRoleAndBusinessOperateRow(newRow);
            }

            da.Update(table);
            da.Update(newTable);

            if (deleteOperateIds.Count > 0 || newOperateIds.Count > 0)
            {
                AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure();
                authorizationConfigure.StuffId         = stuffUser.StuffId;
                authorizationConfigure.StuffName       = stuffUser.StuffName;
                authorizationConfigure.ConfigureTarget = "系统角色设置";
                authorizationConfigure.ConfigureTime   = DateTime.Now;
                authorizationConfigure.ConfigureType   = "更新";
                if (deleteOperateIds.Count > 0)
                {
                    StringBuilder oldContent = new StringBuilder();
                    oldContent.Append("撤销系统角色[").Append(this.SystemRoleTA.GetSystemRoleName(roleId)).Append("]授权业务操作:");
                    foreach (int id in deleteOperateIds)
                    {
                        oldContent.Append("[").Append(this.BusinessOperateTA.GetBusinessUseCaseName(id) + "-" + this.BusinessOperateTA.GetBusinessOperateName(id)).Append("] ");
                    }
                    authorizationConfigure.OldContent = oldContent.ToString();
                }
                if (newOperateIds.Count > 0)
                {
                    StringBuilder newContent = new StringBuilder();
                    newContent.Append("新增系统角色[").Append(this.SystemRoleTA.GetSystemRoleName(roleId));
                    newContent.Append("]授权业务操作:");
                    foreach (int id in newOperateIds)
                    {
                        newContent.Append("[").Append(this.BusinessOperateTA.GetBusinessUseCaseName(id) + "-" + this.BusinessOperateTA.GetBusinessOperateName(id)).Append("] ");
                    }

                    authorizationConfigure.NewContent = newContent.ToString();
                }
                SysLog.LogAuthorizationConfigure(authorizationConfigure);
            }
        }