public void AddNewUser() { _selectedUser = new User("", "", "", "", User.SexOfPerson.Male); this.updateViewDetailValues(_selectedUser); this._view.CanModifyID = true; }
public void UpdateGrid(User usr) { ListViewItem rowToUpdate = null; foreach (ListViewItem row in this.listUser.Items) { if (row.Text == usr.ID) { rowToUpdate = row; } if (rowToUpdate != null) { rowToUpdate.Text = usr.ID; rowToUpdate.SubItems[1].Text = usr.FirstName; rowToUpdate.SubItems[2].Text = usr.LastName; rowToUpdate.SubItems[3].Text = usr.Departement; rowToUpdate.SubItems[4].Text = Enum.GetName(typeof(User.SexOfPerson), usr.Sex); } } }
public void SetSelectedUser(User usr) { foreach (ListViewItem row in this.listUser.Items) { if (row.Text == usr.ID) { row.Selected = true; } } }
public void RemoveUser(User usr) { ListViewItem rowToRemove = null; foreach (ListViewItem row in this.listUser.Items) { if (row.Text == usr.ID) { rowToRemove = row; } if (rowToRemove != null) { this.listUser.Items.Remove(rowToRemove); this.listUser.Focus(); } } }
public void AddUserToGrid(User usr) { ListViewItem parent; parent = this.listUser.Items.Add(usr.ID); parent.SubItems.Add(usr.FirstName); parent.SubItems.Add(usr.LastName); parent.SubItems.Add(usr.Departement); parent.SubItems.Add(Enum.GetName(typeof(User.SexOfPerson), usr.Sex)); }
private void updateViewDetailValues(User usr) { _view.ID = usr.ID; _view.FirstName = usr.FirstName; _view.LastName = usr.LastName; _view.Departement = usr.Departement; _view.Sex = usr.Sex; }
private void updateUserWithViewValues(User usr) { usr.ID = _view.ID; usr.FirstName = _view.FirstName; usr.LastName = _view.LastName; usr.Departement = _view.Departement; usr.Sex = _view.Sex; }
public void SelectedUserChanged(string selectedUserID) { foreach (User usr in this._users) { if (usr.ID == selectedUserID) { _selectedUser = usr; updateViewDetailValues(usr); _view.SetSelectedUser(usr); this._view.CanModifyID = false; break; } } }