示例#1
0
        /// <summary>
        /// Заповнюємо список ролей
        /// </summary>
        private void FillRoles()
        {
            SecurityUserRolesLogic userRoles = new SecurityUserRolesLogic(manager);
            SecurityRolesLogic roles = new SecurityRolesLogic(manager);
            List<SecurityRole> allRoles = roles.GetAll();

            if (userId != null)
            {
                List<SecurityUserRole> userHasRoles = userRoles.GetAll(Convert.ToInt32(userId));

                foreach (var role in allRoles)
                {
                    Helpers.Item item = new Item();
                    item.ID = role.ID.ToString();
                    item.Name = role.Name;

                    ((ListBox)RolesLB).DisplayMember = "Name";
                    ((ListBox)RolesLB).ValueMember = "ID";

                    SecurityUserRole userRole = userHasRoles.Where(a => a.RoleID == role.ID).Select(a => a).FirstOrDefault();
                    bool selected = false;
                    if (userRole != null)
                    {
                        selected = true;

                    }
                    RolesLB.Items.Add(item, selected);

                }
            }
        }
示例#2
0
 private void FillGrid()
 {
     ContextManager manager = new ContextManager();
     SecurityRolesLogic sr = new SecurityRolesLogic(manager);
     RolesGV.DataSource = sr.GetAll();
     manager.CloseContext();
 }
示例#3
0
        /// <summary>
        /// Заповнюємо список ролей
        /// </summary>
        private void FillRoles()
        {
            SecurityUserRolesLogic userRoles = new SecurityUserRolesLogic(manager);
            SecurityRolesLogic     roles     = new SecurityRolesLogic(manager);
            List <SecurityRole>    allRoles  = roles.GetAll();

            if (userId != null)
            {
                List <SecurityUserRole> userHasRoles = userRoles.GetAll(Convert.ToInt32(userId));

                foreach (var role in allRoles)
                {
                    Helpers.Item item = new Item();
                    item.ID   = role.ID.ToString();
                    item.Name = role.Name;

                    ((ListBox)RolesLB).DisplayMember = "Name";
                    ((ListBox)RolesLB).ValueMember   = "ID";

                    SecurityUserRole userRole = userHasRoles.Where(a => a.RoleID == role.ID).Select(a => a).FirstOrDefault();
                    bool             selected = false;
                    if (userRole != null)
                    {
                        selected = true;
                    }
                    RolesLB.Items.Add(item, selected);
                }
            }
        }
示例#4
0
        private void FillGrid()
        {
            ContextManager     manager = new ContextManager();
            SecurityRolesLogic sr      = new SecurityRolesLogic(manager);

            RolesGV.DataSource = sr.GetAll();
            manager.CloseContext();
        }
示例#5
0
 private void DeleteSB_Click(object sender, EventArgs e)
 {
     ContextManager manager = new ContextManager();
     SecurityRolesLogic sr = new SecurityRolesLogic(manager);
     sr.Delete(Convert.ToInt32(RolesGV.SelectedRows[0].Cells[0].FormattedValue));
     manager.Save();
     FillGrid();
     manager.CloseContext();
 }
示例#6
0
文件: RoleNew.cs 项目: rymarrv/Compas
 private void SaveBt_Click(object sender, EventArgs e)
 {
     ContextManager manager = new ContextManager();
     SecurityRolesLogic sr = new SecurityRolesLogic(manager);
     sr.Create(NameTB.Text, DescriptionTB.Text);
     manager.Save();
     manager.CloseContext();
     this.Close();
 }
示例#7
0
        private void SaveBt_Click(object sender, EventArgs e)
        {
            ContextManager     manager = new ContextManager();
            SecurityRolesLogic sr      = new SecurityRolesLogic(manager);

            sr.Create(NameTB.Text, DescriptionTB.Text);
            manager.Save();
            manager.CloseContext();
            this.Close();
        }
示例#8
0
        private void DeleteSB_Click(object sender, EventArgs e)
        {
            ContextManager     manager = new ContextManager();
            SecurityRolesLogic sr      = new SecurityRolesLogic(manager);

            sr.Delete(Convert.ToInt32(RolesGV.SelectedRows[0].Cells[0].FormattedValue));
            manager.Save();
            FillGrid();
            manager.CloseContext();
        }
示例#9
0
        public RoleEdit(int _ID)
        {
            ID = _ID;
            InitializeComponent();
            ContextManager     manager = new ContextManager();
            SecurityRolesLogic sr      = new SecurityRolesLogic(manager);
            SecurityRole       role    = sr.Get(ID);

            NameTB.Text        = role.Name;
            DescriptionTB.Text = role.Description;

            manager.CloseContext();
        }
示例#10
0
        public RoleActionsF()
        {
            InitializeComponent();
            //створюэмо грід з можливістю групування
            GroupByGrid             grid       = new GroupByGrid();
            ContextManager          manager    = new ContextManager();
            SecurityActionsLogic    actions    = new Logic.Security.SecurityActionsLogic(manager);
            SecurityCategoriesLogic categories = new SecurityCategoriesLogic(manager);
            SecurityRolesLogic      roles      = new SecurityRolesLogic(manager);

            ActionsGV.AutoGenerateColumns = false;
            RolesCB.DataSource            = roles.GetAll();
            CategoriesCB.DataSource       = categories.GetAll();
            manager.CloseContext();
        }