private void Updatebutton_Click(object sender, RoutedEventArgs e) { try { BloodInventory p = new BloodInventory() { BloodInvenoryID = (SearchtextBox.Text), BloodGroup = BloodGrouptextBox.Text, NumberOfBottles = int.Parse(txtNoOfBottles.Text), BloodBankID = (txtBloodBankId.Text), ExpiryDate = Convert.ToDateTime(txtExpiryDate.Text), //HospitalID = int.Parse(txtHospitalId.Text) }; BloodInventoryBLL pb = new BloodInventoryBLL(); if (pb.EditBloodInventory(p)) { groupBox.Visibility = Visibility.Hidden; MessageBox.Show("Inventory data updated.", "BBMS"); } } catch (BloodBankExceptions ex) { MessageBox.Show(ex.Message, "BBMS"); } catch (SystemException ex) { MessageBox.Show(ex.Message, "BBMS"); } }
private void button_Click(object sender, RoutedEventArgs e) { try { BloodInventoryBLL pb = new BloodInventoryBLL(); BloodInventory p = pb.Search(int.Parse(SearchtextBox.Text)); if (p != null) { BloodGrouptextBox.Text = p.BloodGroup; txtBloodBankId.Text = p.BloodBankID.ToString(); txtNoOfBottles.Text = p.NumberOfBottles.ToString(); txtExpiryDate.Text = p.ExpiryDate.ToShortDateString(); // txtHospitalId.Text = p.HospitalID.ToString(); groupBox.Visibility = Visibility.Visible; } else { groupBox.Visibility = Visibility.Hidden; MessageBox.Show (string.Format("Blood Inventory with id {0} does not exists.", SearchtextBox.Text), "Blood Inventory Management System"); } } catch (BloodBankExceptions ex) { MessageBox.Show(ex.Message, "Blood Inventory Management System"); } catch (SystemException ex) { MessageBox.Show(ex.Message, "Blood Inventory Management System"); } }
private void Deletebutton_Click(object sender, RoutedEventArgs e) { try { DateTime pid = DateTime.Parse(txtExpiryDate.Text); BloodInventoryBLL pb = new BloodInventoryBLL(); if (pb.DeleteBloodInventory(pid)) { groupBox.Visibility = Visibility.Hidden; MessageBox.Show("Blood Inventory Id " + pid + " was deleted."); } } catch (BloodBankExceptions ex) { MessageBox.Show(ex.Message, "Product Management System"); } catch (SystemException ex) { MessageBox.Show(ex.Message, "Product Management System"); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { BloodInventoryBLL pb = new BloodInventoryBLL(); DataTable dt = pb.BloodInventoryDisplay(); if (dt != null) { dataGrid.ItemsSource = dt.DefaultView; } else { MessageBox.Show("Table is empty", "Blood Inventory Management System"); } } catch (BloodBankExceptions ex) { MessageBox.Show(ex.Message, "Blood Inventory Management System"); } catch (SystemException ex) { MessageBox.Show(ex.Message, "Blood Inventory Management System"); } }