Exemplo n.º 1
0
        public bool UpdateSystemRole(int systemRoleId, string systemRoleName, string description)
        {
            BusinessObjects.AuthorizationDS.SystemRoleDataTable table = this.SystemRoleTA.GetDataBySystemRoleName(systemRoleName);
            if (table != null && table.Count > 0)
            {
                if (table[0].SystemRoleId != systemRoleId)
                {
                    throw new ApplicationException("系统角色名称不能重复");
                }
            }

            BusinessObjects.AuthorizationDS.SystemRoleDataTable roleTable = this.SystemRoleTA.GetDataById(systemRoleId);
            roleTable[0].SystemRoleName = systemRoleName;
            if (description == null)
            {
                roleTable[0].SetDescriptionNull();
            }
            else
            {
                roleTable[0].Description = description;
            }
            int rowsAffected = this.SystemRoleTA.Update(roleTable);

            return(rowsAffected == 1);
        }
Exemplo n.º 2
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);
        }
    private void SetSystemRoleGridViewSelection(int positionId)
    {
        BusinessObjects.AuthorizationDS.SystemRoleDataTable roles = this.AuthBLL.GetSystemRoleByPostion(positionId);
        List <int> roleIds = new List <int>();

        foreach (BusinessObjects.AuthorizationDS.SystemRoleRow role in roles)
        {
            roleIds.Add(role.SystemRoleId);
        }

        foreach (GridViewRow row in this.SystemRoleGridView.Rows)
        {
            CheckBox checkBox = (CheckBox)row.FindControl("SystemRoleCheckBox");
            int      roleId   = (int)this.SystemRoleGridView.DataKeys[row.RowIndex].Value;
            if (roleIds.Contains(roleId))
            {
                checkBox.Checked = true;
            }
            else
            {
                checkBox.Checked = false;
            }
        }
    }
Exemplo n.º 4
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);
        }