void PopulateFields(BmsHospital value) { try { txtAddress.Text = value.Address; txtCity.Text = value.City; txtContactNo.Text = value.ContactNo; txtHospitalID.Text = value.HospitalID.ToString(); txtHospitalName.Text = value.HospitalName; } catch (Exception ex) { MessageHandler.ShowErrorMessage(ex.Message); } }
private void btnControl_Click(object sender, RoutedEventArgs e) { object selected = dataGridPrimary.SelectedItem; BmsHospital value = dataGridPrimary.SelectedItem as BmsHospital; try { if (bal == null) { return; } bool state = bal.Remove(value); if (state) { applicationStatus.Text = "Hospital Information Deleted Successfully."; list.Remove(value); dataGridPrimary.Items.Refresh(); } else { applicationStatus.Text = "Failed Deleting Hospital Information."; } //clock.Start(); applicationStatus.Text = "Ready"; } catch (System.Data.SqlClient.SqlException ex) { MessageHandler.ShowErrorMessage(ex.Message); } catch (ValidationException ex) { MessageHandler.ShowErrorMessage(ex.Message); } catch (ConnectedDalException ex) { MessageHandler.ShowErrorMessage(ex.Message); } catch (Exception ex) { MessageHandler.ShowErrorMessage(ex.Message); } //dataGridPrimary.ItemsSource = (List<BmsHospital>)bal.GetAll(); //MessageBox.Show(value.BloodBankName); }
BmsHospital FetchData() { BmsHospital value = new BmsHospital(); try { value.Address = txtAddress.Text; value.City = txtCity.Text; value.ContactNo = txtContactNo.Text; value.HospitalID = int.Parse(txtHospitalID.Text); value.HospitalName = txtHospitalName.Text; } catch (Exception ex) { MessageHandler.ShowErrorMessage(ex.Message); } return(value); }