public void saveProviderPhone(ProviderPhoneDB providerPhone) { if (providerPhone.IsNew()) { int id = this.dbConnection.addProviderPhone((int)providerPhone.ProviderId, providerPhone.Phone, providerPhone.Description); providerPhone.Id = id; } else { this.dbConnection.updateProviderPhone((int)providerPhone.Id, (int)providerPhone.ProviderId, providerPhone.Phone, providerPhone.Description); } }
public DialogResult ShowDialog(ProviderPhoneDB providerPhone, DbActionsEnum operation) { if (operation == DbActionsEnum.Create) { this.originalPhone = null; } else { this.originalPhone = providerPhone; } this.setBehaviorFromOperation(operation); return this.ShowDialog(); }
private void bAccept_Click(object sender, EventArgs e) { if (this.validData()) { if (this.originalPhone == null || this.originalPhone.Id == null) { this.resultPhone = new ProviderPhoneDB(this.tbPhone.Text, this.tbDescription.Text); } else { this.resultPhone = new ProviderPhoneDB((int)this.originalPhone.Id, this.originalPhone.ProviderId, this.tbPhone.Text, this.tbDescription.Text); } this.DialogResult = DialogResult.OK; this.Close(); } }
public void deleteProviderPhone(ProviderPhoneDB providerPhone) { this.dbConnection.deleteProviderPhone((int)providerPhone.Id); }