예제 #1
0
        private void AddUser_Click(object sender, EventArgs e)
        {
            if (!validator.Validate())
            {
                return;
            }

            RolesModel   roles  = roles_coll.FirstOrDefault(r => r.rolename == RolesComboBoxEdit.Text);
            UserLookup   f      = new UserLookup();
            DialogResult dialog = f.ShowDialog(this);

            if (dialog == DialogResult.OK)
            {
                UserModel user = f.User;
                userAkses.AssignRoleToUser(user, roles);
                var users = user_has_roles_coll.Where(uhr => uhr.rolename.rolename == RolesComboBoxEdit.Text).Select(uhr => uhr.username.username);
                UserGridControl.DataSource = user_coll.Where(u => users.Contains(u.username));
            }
        }
예제 #2
0
        private void Username_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            UserLookup   f      = new UserLookup();
            DialogResult dialog = f.ShowDialog(this);

            if (dialog == DialogResult.OK)
            {
                UserModel user = f.User;
                username.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
                username.Text    = user.username;
                person_name.Text = user.person_name;
                branch.Text      = user.current_branch.branch_name;
                active.Checked   = user.active;
                Edit.Enabled     = true;
                Hapus.Enabled    = true;

                username.Enabled    = false;
                person_name.Enabled = false;
                branch.Enabled      = false;
                active.Enabled      = false;
            }
        }