public void AddNewPassword(int userId, DataGridView dataGrid, PasswordTracker pw) { if (string.IsNullOrEmpty(pw.Name) || string.IsNullOrEmpty(pw.Username) || string.IsNullOrEmpty(pw.Password)) { throw new Exception("Required field(s) not filled out!"); } _pwTracker.InsertNewRecord(pw); MessageBox.Show(@"Record successfully added!", @"Record Added"); //_entry.ResetEntryForm(); LoadDataGrid(dataGrid, false); }
public void EditPassword(int userId, DataGridView dataGrid, PasswordTracker pwValues) { try { var id = GetPasswordValues(dataGrid).ID; //the ID of the modified row _pwTracker.EditEntry(pwValues); MessageBox.Show(@"Record successfully updated!", @"Record Edited"); //_entry.ResetEntryForm(); LoadDataGrid(dataGrid, false); SetCurrentCell(dataGrid, id); } catch (Exception ex) { MessageBox.Show(ex.Message, @"Record Not Edited"); } }