// 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 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); 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 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(); }