public void RefreshCrudeClient() { var client = new CrudeClientServiceClient(); try { var bindingSource = new BindingSource(); bindingSource.DataSource = client.FetchWithFilter( Guid.Empty , clientTypeRefCombo.Text , clientNationalityRefCombo.Text , clientGenderRefCombo.Text , clientTitleRefCombo.Text , Guid.Empty , textBoxFirstName.Text , textBoxMiddleName.Text , textBoxLastName.Text , null , string.Empty , Guid.Empty , DateTime.MinValue ); dataGridViewCrudeClient.AutoGenerateColumns = false; dataGridViewCrudeClient.DataSource = bindingSource; dataGridViewCrudeClient.AutoResizeColumns(); dataGridViewCrudeClient.Refresh(); } catch (Exception ex) { if (ex != null) { } } finally { client.Close(); } }
// shows the form in edit modus // links: // docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77 public void ShowAsEdit(System.Guid clientId) { var service = new CrudeClientServiceClient(); _isNew = false; try { _contract = service.FetchByClientId(clientId); clientTypeRefCombo.Text = _contract.ClientTypeRcd != null ? _contract.ClientTypeRcd : String.Empty; clientNationalityRefCombo.Text = _contract.ClientNationalityRcd != null ? _contract.ClientNationalityRcd : String.Empty; clientGenderRefCombo.Text = _contract.ClientGenderRcd != null ? _contract.ClientGenderRcd : String.Empty; clientTitleRefCombo.Text = _contract.ClientTitleRcd != null ? _contract.ClientTitleRcd : String.Empty; textBoxFirstName.Text = _contract.FirstName; textBoxMiddleName.Text = _contract.MiddleName; textBoxLastName.Text = _contract.LastName; if (_contract.Image != null) { pictureBoxImage.Image = ByteToImage(_contract.Image); } textBoxImageBlobFilename.Text = _contract.ImageBlobFilename; _contract.DateTime = DateTime.UtcNow; dateTimePickerDateTime.Text = _contract.DateTime.ToString(); Show(); } catch (Exception ex) { if (ex == null) { } else { System.Diagnostics.Debugger.Break(); } } finally { service.Close(); } }
public ActionResult ClientAddressEdit( System.Guid clientId ) { ViewBag.ClientId = clientId; CrudeClientContract clientContract = new CrudeClientServiceClient().FetchByClientId(clientId); CrudeClientAddressContract addressContract; if (clientContract.ClientAddressId != Guid.Empty) { addressContract = new CrudeClientAddressServiceClient().FetchByClientAddressId(clientContract.ClientAddressId); } else { addressContract = new CrudeClientAddressContract(); } ViewBag.ClientAddressTypeRcd = new SelectList(new CrudeClientAddressTypeRefServiceClient().FetchAll(), "ClientAddressTypeRcd", "ClientAddressTypeName", addressContract.ClientAddressTypeRcd ); ViewBag.DefaultUserName = new CrudeDefaultUserServiceClient().FetchByDefaultUserId(addressContract.UserId).DefaultUserName; return(View( MVCHelper.Resolve(Request, "Client", "ClientAddress", "ClientAddressEdit"), addressContract )); }
// shows the form in edit modus // links: // docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77 public void ShowAsEdit(System.Guid clientId) { var service = new CrudeClientServiceClient(); _isNew = false; try { _contract = service.FetchByClientId(clientId); textBoxFirstName.Text = _contract.FirstName; textBoxMiddleName.Text = _contract.MiddleName; textBoxLastName.Text = _contract.LastName; passengerTypeRefCombo.Text = _contract.PassengerTypeRcd != null ? _contract.PassengerTypeRcd : String.Empty; nationalityRefCombo.Text = _contract.NationalityRcd != null ? _contract.NationalityRcd : String.Empty; genderRefCombo.Text = _contract.GenderRcd != null ? _contract.GenderRcd : String.Empty; titleRefCombo.Text = _contract.TitleRcd != null ? _contract.TitleRcd : String.Empty; clientTypeRefCombo.Text = _contract.ClientTypeRcd != null ? _contract.ClientTypeRcd : String.Empty; 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(); } }
public ActionResult CrudeClientEdit( System.Guid clientId ) { CrudeClientContract contract = new CrudeClientServiceClient().FetchByClientId(clientId); ViewBag.ClientTypeRcd = new SelectList(new CrudeClientTypeRefServiceClient().FetchAll(), "ClientTypeRcd", "ClientTypeName", contract.ClientTypeRcd ); ViewBag.ClientNationalityRcd = new SelectList(new CrudeClientNationalityRefServiceClient().FetchAll(), "ClientNationalityRcd", "ClientNationalityName", contract.ClientNationalityRcd ); ViewBag.ClientGenderRcd = new SelectList(new CrudeClientGenderRefServiceClient().FetchAll(), "ClientGenderRcd", "ClientGenderName", contract.ClientGenderRcd ); ViewBag.ClientTitleRcd = new SelectList(new CrudeClientTitleRefServiceClient().FetchAll(), "ClientTitleRcd", "ClientTitleName", contract.ClientTitleRcd ); ViewBag.ClientAddressId = new SelectList(new CrudeClientAddressServiceClient().FetchAll(), "ClientAddressId", "AddressLineOneName", contract.ClientAddressId ); ViewBag.DefaultUserName = new CrudeDefaultUserServiceClient().FetchByDefaultUserId(contract.UserId).DefaultUserName; return(View( "~/Views/Crude/Client/CrudeClient/CrudeClientEdit.cshtml", contract )); }
public ActionResult CrudeClientEdit( System.Guid clientId ) { CrudeClientContract contract = new CrudeClientServiceClient().FetchByClientId(clientId); ViewBag.PassengerTypeRcd = new SelectList(new CrudePassengerTypeRefServiceClient().FetchAll(), "PassengerTypeRcd", "PassengerTypeName", contract.PassengerTypeRcd ); ViewBag.NationalityRcd = new SelectList(new CrudeNationalityRefServiceClient().FetchAll(), "NationalityRcd", "NationalityName", contract.NationalityRcd ); ViewBag.GenderRcd = new SelectList(new CrudeGenderRefServiceClient().FetchAll(), "GenderRcd", "GenderName", contract.GenderRcd ); ViewBag.TitleRcd = new SelectList(new CrudeTitleRefServiceClient().FetchAll(), "TitleRcd", "TitleName", contract.TitleRcd ); ViewBag.ClientTypeRcd = new SelectList(new CrudeClientTypeRefServiceClient().FetchAll(), "ClientTypeRcd", "ClientTypeName", contract.ClientTypeRcd ); ViewBag.DefaultUserName = new CrudeDefaultUserServiceClient().FetchByDefaultUserId(contract.UserId).DefaultUserName; return(View( "~/Views/Crude/Client/CrudeClient/CrudeClientEdit.cshtml", contract )); }
public ActionResult ClientEdit(System.Guid clientId) { ViewBag.ClientId = clientId; CrudeClientContract contract = new CrudeClientServiceClient().FetchByClientId(clientId); ViewBag.ClientTypeRcd = new SelectList(new CrudeClientTypeRefServiceClient().FetchAll(), "ClientTypeRcd", "ClientTypeName", contract.ClientTypeRcd ); ViewBag.ClientNationalityRcd = new SelectList(new CrudeClientNationalityRefServiceClient().FetchAll(), "ClientNationalityRcd", "ClientNationalityName", contract.ClientNationalityRcd ); ViewBag.ClientGenderRcd = new SelectList(new CrudeClientGenderRefServiceClient().FetchAll(), "ClientGenderRcd", "ClientGenderName", contract.ClientGenderRcd ); ViewBag.ClientTitleRcd = new SelectList(new CrudeClientTitleRefServiceClient().FetchAll(), "ClientTitleRcd", "ClientTitleName", contract.ClientTitleRcd ); ViewBag.DefaultUserName = new CrudeDefaultUserServiceClient().FetchByDefaultUserId(contract.UserId).DefaultUserName; return(View( MVCHelper.Resolve(Request, "Client", "ClientEdit"), contract )); }
public void ShowAsEdit(System.Guid clientId) { var service = new CrudeClientServiceClient(); _isNew = false; try { // keep original values from database for cases where the values are not shown/edited but meant for updating _contract = service.FetchByClientId(clientId); clientTypeRefCombo.Text = _contract.ClientTypeRcd != null ? _contract.ClientTypeRcd : String.Empty; clientNationalityRefCombo.Text = _contract.ClientNationalityRcd != null ? _contract.ClientNationalityRcd : String.Empty; clientGenderRefCombo.Text = _contract.ClientGenderRcd != null ? _contract.ClientGenderRcd : String.Empty; clientTitleRefCombo.Text = _contract.ClientTitleRcd != null ? _contract.ClientTitleRcd : String.Empty; textBoxFirstName.Text = _contract.FirstName; textBoxMiddleName.Text = _contract.MiddleName; textBoxLastName.Text = _contract.LastName; if (_contract.Image != null) { pictureBoxImage.Image = ByteToImage(_contract.Image); } textBoxImageBlobFilename.Text = _contract.ImageBlobFilename; _contract.DateTime = DateTime.UtcNow; dateTimePickerDateTime.Text = _contract.DateTime.ToString(); Show(); } catch (Exception ex) { if (ex.HResult == 000) { if (ex != null) { } else { System.Diagnostics.Debugger.Break(); } } } finally { service.Close(); } }
// populates the Picker with the first match from the SOAP service // links: // docLink: http://sql2x.org/documentationLink/3e8b9e1a-39eb-444f-9632-ce3406db3534 private void txtClientCode_Validating(object sender, CancelEventArgs e) { if (!DesignMode) { // empty picker on no code if (string.IsNullOrEmpty(txtClientCode.Text)) { _clientId = Guid.Empty; txtClientName.Text = string.Empty; txtClientCode.Text = string.Empty; return; } CrudeClientServiceClient client = null; try { client = new CrudeClientServiceClient(); CrudeClientContract contract = client.FetchByFirstName(txtClientCode.Text); if (contract != null) { txtClientCode.Text = contract.FirstName; txtClientName.Text = contract.FirstName; _clientId = contract.ClientId; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (client != null) { client.Close(); } } if (this.Picked != null) { this.Picked(new object(), new EventArgs()); } } }
private void buttonSave_Click(object sender, EventArgs e) { var service = new CrudeClientServiceClient(); try { _contract.ClientTypeRcd = clientTypeRefCombo.Text; _contract.ClientNationalityRcd = clientNationalityRefCombo.Text; _contract.ClientGenderRcd = clientGenderRefCombo.Text; _contract.ClientTitleRcd = clientTitleRefCombo.Text; _contract.FirstName = textBoxFirstName.Text; _contract.MiddleName = textBoxMiddleName.Text; _contract.LastName = textBoxLastName.Text; _contract.Image = ImageToByte(pictureBoxImage.Image); _contract.ImageBlobFilename = textBoxImageBlobFilename.Text; if (_isNew) { service.Insert(_contract); } else { service.Update(_contract); } } catch (Exception ex) { if (ex.HResult == -2146233087) // {"The remote server returned an unexpected response: (413) Request Entity Too Large."}, { MessageBox.Show("Request Entity Too Large"); } else { System.Diagnostics.Debugger.Break(); } } finally { service.Close(); } Close(); }
// refresh the grid // links: // docLink: http://sql2x.org/documentationLink/a90065e7-8ace-4de7-9367-d4653a7c637f public void RefreshCrudeClient() { var client = new CrudeClientServiceClient(); try { var bindingSource = new BindingSource(); bindingSource.DataSource = client.FetchWithFilter( Guid.Empty , textBoxFirstName.Text , textBoxMiddleName.Text , textBoxLastName.Text , Guid.Empty , Guid.Empty , passengerTypeRefCombo.Text , nationalityRefCombo.Text , genderRefCombo.Text , titleRefCombo.Text , clientTypeRefCombo.Text , Guid.Empty , DateTime.MinValue ); dataGridViewCrudeClient.AutoGenerateColumns = false; dataGridViewCrudeClient.DataSource = bindingSource; dataGridViewCrudeClient.AutoResizeColumns(); dataGridViewCrudeClient.Refresh(); } catch (Exception ex) { if (ex == null) { } else { System.Diagnostics.Debugger.Break(); } } finally { client.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 CrudeClientServiceClient(); try { _contract.ClientTypeRcd = clientTypeRefCombo.Text; _contract.ClientNationalityRcd = clientNationalityRefCombo.Text; _contract.ClientGenderRcd = clientGenderRefCombo.Text; _contract.ClientTitleRcd = clientTitleRefCombo.Text; _contract.FirstName = textBoxFirstName.Text; _contract.MiddleName = textBoxMiddleName.Text; _contract.LastName = textBoxLastName.Text; _contract.Image = ImageToByte(pictureBoxImage.Image); _contract.ImageBlobFilename = textBoxImageBlobFilename.Text; if (_isNew) { service.Insert(_contract); } else { service.Update(_contract); } } catch (Exception ex) { if (ex == null) { } else { System.Diagnostics.Debugger.Break(); } } finally { service.Close(); } 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 CrudeClientServiceClient(); try { _contract.FirstName = textBoxFirstName.Text; _contract.MiddleName = textBoxMiddleName.Text; _contract.LastName = textBoxLastName.Text; _contract.PassengerTypeRcd = passengerTypeRefCombo.Text; _contract.NationalityRcd = nationalityRefCombo.Text; _contract.GenderRcd = genderRefCombo.Text; _contract.TitleRcd = titleRefCombo.Text; _contract.ClientTypeRcd = clientTypeRefCombo.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 ClientAddressEdit( [Bind()] CrudeClientAddressContract contract, System.Guid clientId ) { ViewBag.ClientId = clientId; if (ModelState.IsValid) { if (contract.ClientAddressId == Guid.Empty) { // new address contract.ClientAddressId = Guid.NewGuid(); contract.UserId = new System.Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}"); contract.DateTime = DateTime.UtcNow; new CrudeClientAddressServiceClient().Insert(contract); // update client CrudeClientContract clientContract = new CrudeClientServiceClient().FetchByClientId(clientId); clientContract.ClientAddressId = contract.ClientAddressId; new CrudeClientServiceClient().Update(clientContract); } else { new CrudeClientAddressServiceClient().Update(contract); } return(RedirectToAction("ClientAddressEdit", new { clientId = clientId })); } return(View( MVCHelper.Resolve(Request, "Client", "ClientAddress", "ClientAddressEdit"), contract )); }