private void btnUpdateCampDetails_Click(object sender, RoutedEventArgs e) { try { BloodDonationCampBL bb = new BloodDonationCampBL(); if (bb.ValidateBloodDonationCampData(txtBloodDonationCampId.Text, txtCampName.Text, txtAddress.Text, txtCity.Text, txtBloodBankId.Text, txtCampStartDate.Text, txtCampEndDate.Text)) { if (bb.validateCampIdModify(txtBloodDonationCampId.Text)) { BloodDonationCamp b = new BloodDonationCamp { BloodDonationCampId = txtBloodDonationCampId.Text, CampName = txtCampName.Text, Address = txtAddress.Text, City = txtCity.Text, CampStartDate = Convert.ToDateTime(txtCampStartDate.Text), CampEndDate = Convert.ToDateTime(txtCampEndDate.Text) }; if (bb.ModifyCampBLL(b)) { txtBloodDonationCampId.IsEnabled = true; gbModify.Visibility = Visibility.Hidden; MessageBox.Show("Blood Donation Camp Info Saved."); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnsearchCamp_Click(object sender, RoutedEventArgs e) { try { BloodDonationCampBL bb = new BloodDonationCampBL(); BloodDonationCamp b = bb.SearchCampBLL(txtBloodDonationCampId.Text); if (b != null) { txtCampName.Text = b.CampName; txtAddress.Text = b.Address; txtCity.Text = b.City; txtBloodBankId.Text = b.BloodBankId.ToString(); txtCampStartDate.Text = b.CampStartDate.ToString(); txtCampEndDate.Text = b.CampEndDate.ToString(); gbModify.Visibility = Visibility.Visible; txtBloodDonationCampId.IsEnabled = false; } else { gbModify.Visibility = Visibility.Hidden; MessageBox.Show (string.Format("Blood Donation camp with id {0} does not exists.", txtBloodDonationCampId.Text)); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { BloodDonationCampBL viewCamp = new BloodDonationCampBL(); DataTable dt = viewCamp.ViewCampDetailsBLL(); if (dt != null) { dgViewCampDetails.ItemsSource = dt.DefaultView; } else { MessageBox.Show("Table is empty"); } }
private void btnDeleteCampDetails_Click(object sender, RoutedEventArgs e) { try { BloodDonationCampBL bd = new BloodDonationCampBL(); if (bd.validateCampIdDelete(txtBloodDonationCampId.Text)) { string bloodDonationCampId = txtBloodDonationCampId.Text; BloodDonationCampBL bb = new BloodDonationCampBL(); if (bb.DeleteCampBLL(bloodDonationCampId)) { gbModify.Visibility = Visibility.Hidden; txtBloodDonationCampId.IsEnabled = true; MessageBox.Show("Blood Donation Camp Id " + bloodDonationCampId + " was deleted."); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnArrange_Click(object sender, RoutedEventArgs e) { try { BloodDonationCampBL bl = new BloodDonationCampBL(); if (bl.ValidateBloodDonationCampData(txtBloodDonationCampId.Text, txtCampName.Text, txtAddress.Text, txtCity.Text, txtBloodBankId.Text, txtCampStartDate.Text, txtCampEndDate.Text)) { if (bl.validateCampIdArrange(txtBloodDonationCampId.Text)) { BloodDonationCamp arrange = new BloodDonationCamp() { BloodDonationCampId = txtBloodDonationCampId.Text, CampName = txtCampName.Text, Address = txtAddress.Text, City = txtCity.Text, BloodBankId = txtBloodBankId.Text, CampStartDate = Convert.ToDateTime(txtCampStartDate.Text), CampEndDate = Convert.ToDateTime(txtCampEndDate.Text) }; if (bl.ArrangeCampBLL(arrange)) { MessageBox.Show(" Blood Donation Camp Arranged Successfully"); } else { MessageBox.Show("Details Not Added"); } } } } catch { throw; } }