private void AddUser() { AddUser add = new AddUser(logic); if (add.ShowDialog(this) == DialogResult.OK) { User user = new User(add.FirstName, add.LastName, add.BirthDate, add.ResultRewards); //user.FirstName = add.FirstName; //user.LastName = add.LastName; //user.Birthdate = add.BirthDate; logic.AddUser(user); } RefreshGrid(); }
private void EditUser() { if (ctlDataUsers_n_Rewards.SelectedCells.Count > 0) { DataGridViewRow row = ctlDataUsers_n_Rewards.SelectedCells[0].OwningRow; var id = (int)row.Cells[5].Value; User user = logic.GetUserById(id); AddUser edit = new AddUser(logic, user); if (edit.ShowDialog(this) == DialogResult.OK) { user.FirstName = edit.FirstName; user.LastName = edit.LastName; user.Birthdate = edit.BirthDate; user.reward = edit.ResultRewards; user.RefreshRewards(user.reward); logic.EditUser(user); } } RefreshGrid(); }