private void ultraButtonSave_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (!this.ValidateChildren()) { return; } this.errorProvider.Clear(); bool passValidation = true; if (this.txt_OrganisationName.Value == null) { errorProvider.SetError(txt_OrganisationName, "Organisation name can not be empty"); passValidation = false; } if (string.IsNullOrEmpty(cmb_State.Value == null ? null : cmb_State.Value.ToString())) { if (!string.IsNullOrEmpty(txt_UnitNumber.Text) || !string.IsNullOrEmpty(txt_StreetNumber.Text) || !string.IsNullOrEmpty(txt_Street.Text) || !string.IsNullOrEmpty(cmb_Type.Value == null ? null : cmb_Type.Value.ToString()) || !string.IsNullOrEmpty(cmb_Suffix.Value == null ? null : cmb_Suffix.Value.ToString()) || !string.IsNullOrEmpty(txt_Suburb.Text) || !string.IsNullOrEmpty(txt_PostCode.Text)) { errorProvider.SetError(cmb_State, "State is mandatory when to input address."); passValidation=false; } } if(!passValidation) { return; } LookupOrganisationalUnitDataSet.LookupOrganisationalUnitDataTable dtLookupOrganisationalUnitDataTable = new LookupOrganisationalUnitDataSet.LookupOrganisationalUnitDataTable(); LookupOrganisationalUnitDataSet.LookupOrganisationalUnitRow rw = dtLookupOrganisationalUnitDataTable.NewLookupOrganisationalUnitRow(); rw.OrganisationalUnitID = OrgenisationID; rw.OrganisationalUnitName= txt_OrganisationName.Text.Trim(); rw.UnitNumber = txt_UnitNumber.Text; rw.StreetNumber = txt_StreetNumber.Text; rw.Street = txt_Street.Text; rw.Type = cmb_Type.Value==null?string.Empty:cmb_Type.Value.ToString(); rw.Suffix = cmb_Suffix.Value == null ? string.Empty : cmb_Suffix.Value.ToString(); rw.Suburb = txt_Suburb.Text; rw.PostCode = txt_PostCode.Text; rw.State = cmb_State.Value == null ? string.Empty : cmb_State.Value.ToString(); rw.Phone = txt_Phone.Text; rw.Fax = txt_Fax.Text; rw.Mobile = txt_Mobile.Text; rw.TollFreePhone = txt_TollFreePhone.Text; rw.Email = txt_Email.Text; rw.VersionNo = VersionNumber.ToString(); dtLookupOrganisationalUnitDataTable.AddLookupOrganisationalUnitRow(rw); _presenter.SaveOrganisationLookup(dtLookupOrganisationalUnitDataTable); this.SetDirtyStatus(false); _presenter.OnCloseView(); } catch (Exception exception) { if (ExceptionManager.Handle(exception)) throw; } finally { this.Cursor = Cursors.Default; } }