Exemplo n.º 1
0
        private void btnAddUse_Click(object sender, EventArgs e)
        {
            _currentUser = null;

            txtUsername.Text = string.Empty;
            txtFirstName.Text = string.Empty;
            txtLastName.Text = string.Empty;
        }
Exemplo n.º 2
0
        private void cboUsers_SelectedIndexChanged(object sender, EventArgs e)
        {
            _currentUser = cboUsers.SelectedItem as User;

            if (_currentUser != null)
            {
                txtUsername.Text = _currentUser.Username.ToString();
                txtFirstName.Text = _currentUser.FirstName;
                txtLastName.Text = _currentUser.LastName;
            }
        }
Exemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_currentUser == null)
            {
                _currentUser = new User();
                Database.DBContext.Users.Add(_currentUser);
            }
            else
            {
                Database.DBContext.Users.Attach(_currentUser);
            }

            _currentUser.Username = txtUsername.Text;
            _currentUser.FirstName = txtFirstName.Text;
            _currentUser.LastName = txtLastName.Text;

            Database.DBContext.SaveChanges();
        }
Exemplo n.º 4
0
 private void cboUsers_SelectedIndexChanged(object sender, EventArgs e)
 {
     _currentUser = cboUsers.SelectedItem as User;
     dgvLast10.DataSource = Database.TopSolveTimes(10, _currentUser.UserId).ToList();
 }