private void btnControl_Click(object sender, RoutedEventArgs e) { object selected = dataGridPrimary.SelectedItem; BmsBloodDonorDonation value = dataGridPrimary.SelectedItem as BmsBloodDonorDonation; try { if (bal == null) { return; } bool state = bal.Remove(value); if (state) { applicationStatus.Text = "Blood Donation Information Deleted Successfully."; list.Remove(value); dataGridPrimary.Items.Refresh(); } else { applicationStatus.Text = "Failed Deleting Blood Donation 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<BmsBloodDonorDonation>)bal.GetAll(); //MessageBox.Show(value.BloodBankName); }
void PopulateFields(BmsBloodDonorDonation value) { try { txtBloodDonationCampID.Text = value.BloodDonationCampID.ToString(); txtBloodDonationDate.Text = value.BloodDonationDate.ToShortDateString(); txtBloodDonationID.Text = value.BloodDonationID.ToString(); txtBloodDonorID.Text = value.BloodDonorID.ToString(); txtBloodInventoryID.Text = value.BloodInventoryID.ToString(); txtHBCount.Text = value.HBCount.ToString(); txtNumberofBottle.Text = value.NumberofBottle.ToString(); txtWeight.Text = value.Weight.ToString();; } catch (Exception ex) { MessageHandler.ShowErrorMessage(ex.Message); } }
BmsBloodDonorDonation FetchData() { BmsBloodDonorDonation value = new BmsBloodDonorDonation(); try { value.BloodDonationCampID = int.Parse(txtBloodDonationCampID.Text); value.BloodDonationDate = Convert.ToDateTime(txtBloodDonationDate.Text); value.BloodDonationID = int.Parse(txtBloodDonationID.Text); value.BloodDonorID = int.Parse(txtBloodDonorID.Text); value.BloodInventoryID = int.Parse(txtBloodInventoryID.Text); value.HBCount = Convert.ToDecimal(txtHBCount.Text); value.NumberofBottle = int.Parse(txtNumberofBottle.Text); value.Weight = Convert.ToDecimal(txtWeight.Text); } catch (Exception ex) { MessageHandler.ShowErrorMessage(ex.Message); } return(value); }