示例#1
0
        private void Settings_Load(object sender, EventArgs e)
        {
            if (Service.CurrentUser.Role != User.UserRole.Admin)
            {
                btnAdd.Visible       = false;
                btnDelete.Visible    = false;
                dgvUsers.Visible     = false;
                cmbRole.Visible      = false;
                lblLogin.Location    = new System.Drawing.Point(40, 54);
                lblPassword.Location = new System.Drawing.Point(40, 90);
                lblFio.Location      = new System.Drawing.Point(40, 120);
                txtLogin.Location    = new System.Drawing.Point(117, 48);
                txtPassword.Location = new System.Drawing.Point(117, 85);
                txtFio.Location      = new System.Drawing.Point(117, 117);
                btnSave.Location     = new System.Drawing.Point(240, 148);
                ClientSize           = new System.Drawing.Size(341, 240);

                txtLogin.Text    = Service.CurrentUser.Login;
                txtPassword.Text = Service.CurrentUser.Password;
                txtFio.Text      = Service.CurrentUser.Fio;
            }


            _userList = new UserList();
            _userList.Fill();

            dgvUsers.DataSource = _userList.Value;
        }
示例#2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtLogin.Text == "" || txtPassword.Text == "" || txtFio.Text == "")
            {
                MessageBox.Show("Не все поля заполнены!", "Ошибка!");
            }
            else
            {
                var newUser = new User();
                newUser.Login    = txtLogin.Text;
                newUser.Password = txtPassword.Text;
                newUser.Fio      = txtFio.Text;
                newUser.Role     = (User.UserRole)cmbRole.SelectedIndex;

                _userList.Add(newUser);
                _userList.Fill();

                dgvUsers.DataSource = typeof(List <User>);
                dgvUsers.DataSource = _userList.Value;
            }
        }
示例#3
0
 private void Authorization_Load(object sender, EventArgs e)
 {
     _userList = new UserList();
     _userList.Fill();
 }