private void buttonSave_Click(object sender, EventArgs e) { try { _customerPresenter.Save(); } catch (Exception ex) { showException(ex); } }
protected override int SaveData() { switch (AccountingObjectCategoryId) { case 0: IdResult = _vendorPresenter.Save(); break; case 2: IdResult = _accountingObjectPresenter.Save(); break; case 3: IdResult = _customerPresenter.Save(); break; default: IdResult = 0; break; } return(IdResult); }
/// <summary> /// Validates user input and, if valid, closes window. /// </summary> private void buttonSave_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(CompanyName) || String.IsNullOrEmpty(City) || String.IsNullOrEmpty(Country)) { // Do not close the dialog MessageBox.Show("All fields are required"); return; } try { _customerPresenter.Save(); this.Close(); } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Save failed"); _cancelClose = true; } }
/// <summary> /// Saves the data. /// </summary> /// <returns></returns> protected override int SaveData() { return(_customerPresenter.Save()); }