private void buttonAddressSave_Click(object sender, EventArgs e) { CrudeAddressServiceClient service = new CrudeAddressServiceClient(); try { _bookingContract.BookingAddress.AddressTypeRcd = addressTypeRefCombo.Text; _bookingContract.BookingAddress.AddressOne = textBoxAddressOne.Text; _bookingContract.BookingAddress.AddressTwo = textBoxAddressTwo.Text; _bookingContract.BookingAddress.AddressThree = textBoxAddressThree.Text; _bookingContract.BookingAddress.State = textBoxState.Text; _bookingContract.BookingAddress.District = textBoxDistrict.Text; _bookingContract.BookingAddress.Province = textBoxProvince.Text; _bookingContract.BookingAddress.ZipCode = textBoxZipCode.Text; _bookingContract.BookingAddress.PoBox = textBoxPoBox.Text; _bookingContract.BookingAddress.Comment = textBoxComment.Text; _bookingContract.BookingAddress.DateTime = DateTime.UtcNow; _bookingContract.BookingAddress.UserId = _userId; if (_bookingContract.BookingAddress.AddressId != Guid.Empty) { service.Update(_bookingContract.BookingAddress); } else { service.Insert(_bookingContract.BookingAddress); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { service.Close(); } }
// saves the form // links: // docLink: http://sql2x.org/documentationLink/c9522930-91f8-4468-a936-8030bb2a6482 private void buttonSave_Click(object sender, EventArgs e) { var service = new CrudeAddressServiceClient(); try { _contract.AddressTypeRcd = addressTypeRefCombo.Text; _contract.AddressOne = textBoxAddressOne.Text; _contract.AddressTwo = textBoxAddressTwo.Text; _contract.AddressThree = textBoxAddressThree.Text; _contract.City = textBoxCity.Text; _contract.Street = textBoxStreet.Text; _contract.State = textBoxState.Text; _contract.District = textBoxDistrict.Text; _contract.Province = textBoxProvince.Text; _contract.ZipCode = textBoxZipCode.Text; _contract.PoBox = textBoxPoBox.Text; _contract.Comment = textBoxComment.Text; _contract.UserId = (Guid)userPicker.SelectedValue; if (_isNew) { service.Insert(_contract); } else { service.Update(_contract); } } catch (Exception ex) { if (ex == null) { } else { System.Diagnostics.Debugger.Break(); } } finally { service.Close(); } Close(); }
public ActionResult CrudeAddressEdit( System.Guid addressId ) { CrudeAddressContract contract = new CrudeAddressServiceClient().FetchByAddressId(addressId); ViewBag.AddressTypeRcd = new SelectList(new CrudeAddressTypeRefServiceClient().FetchAll(), "AddressTypeRcd", "AddressTypeName", contract.AddressTypeRcd ); ViewBag.DefaultUserName = new CrudeDefaultUserServiceClient().FetchByDefaultUserId(contract.UserId).DefaultUserName; return(View( "~/Views/Crude/Address/CrudeAddress/CrudeAddressEdit.cshtml", contract )); }
// refresh the grid // links: // docLink: http://sql2x.org/documentationLink/a90065e7-8ace-4de7-9367-d4653a7c637f public void RefreshCrudeAddress() { var address = new CrudeAddressServiceClient(); try { var bindingSource = new BindingSource(); bindingSource.DataSource = address.FetchWithFilter( Guid.Empty , addressTypeRefCombo.Text , textBoxAddressOne.Text , textBoxAddressTwo.Text , textBoxAddressThree.Text , textBoxCity.Text , textBoxStreet.Text , textBoxState.Text , textBoxDistrict.Text , textBoxProvince.Text , textBoxZipCode.Text , textBoxPoBox.Text , textBoxComment.Text , Guid.Empty , DateTime.MinValue ); dataGridViewCrudeAddress.AutoGenerateColumns = false; dataGridViewCrudeAddress.DataSource = bindingSource; dataGridViewCrudeAddress.AutoResizeColumns(); dataGridViewCrudeAddress.Refresh(); } catch (Exception ex) { if (ex == null) { } else { System.Diagnostics.Debugger.Break(); } } finally { address.Close(); } }
// shows the form in edit modus // links: // docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77 public void ShowAsEdit(System.Guid addressId) { var service = new CrudeAddressServiceClient(); _isNew = false; try { _contract = service.FetchByAddressId(addressId); addressTypeRefCombo.Text = _contract.AddressTypeRcd != null ? _contract.AddressTypeRcd : String.Empty; textBoxAddressOne.Text = _contract.AddressOne; textBoxAddressTwo.Text = _contract.AddressTwo; textBoxAddressThree.Text = _contract.AddressThree; textBoxCity.Text = _contract.City; textBoxStreet.Text = _contract.Street; textBoxState.Text = _contract.State; textBoxDistrict.Text = _contract.District; textBoxProvince.Text = _contract.Province; textBoxZipCode.Text = _contract.ZipCode; textBoxPoBox.Text = _contract.PoBox; textBoxComment.Text = _contract.Comment; userPicker.SelectedValue = _contract.UserId; _contract.DateTime = DateTime.UtcNow; dateTimePickerDateTime.Text = _contract.DateTime.ToString(); Show(); } catch (Exception ex) { if (ex == null) { } else { System.Diagnostics.Debugger.Break(); } } finally { service.Close(); } }