예제 #1
0
 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");
     }
 }
예제 #2
0
 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");
     }
 }
예제 #3
0
 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");
     }
 }
예제 #4
0
 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");
     }
 }