示例#1
0
 private void btnUpdate_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DonorEntities de = new DonorEntities
         {
             BloodDonorID = txtDID.Text,
             FirstName    = txtFName.Text,
             LastName     = txtLName.Text,
             Address      = txtAdd.Text,
             City         = txtCity.Text,
             Mobile       = txtMob.Text,
             BloodGroup   = cmbBG.SelectedValue.ToString()
         };
         DonorBL db = new DonorBL();
         if (db.EditDonor(de))
         {
             gb1.Visibility = Visibility.Hidden;
             MessageBox.Show("Donor Info Saved.", "Blood Bank Management System");
         }
     }
     catch (BloodBankExceptions ex)
     {
         MessageBox.Show(ex.Message, "Blood Bank Management System");
     }
     catch (SystemException ex)
     {
         MessageBox.Show(ex.Message, "Blood Bank Management System");
     }
 }
示例#2
0
 private void window_loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         DonorBL   db = new DonorBL();
         DataTable dt = db.GetCategories();
         if (dt != null)
         {
             cmbBG.ItemsSource       = dt.DefaultView;
             cmbBG.DisplayMemberPath = "BG";
             cmbBG.SelectedValuePath = "BG";
         }
         else
         {
             MessageBox.Show("Table is empty", "Blood Bank Management System");
         }
     }
     catch (BloodBankExceptions ex)
     {
         MessageBox.Show(ex.Message, "Blood Bank Management System");
     }
     catch (SystemException ex)
     {
         MessageBox.Show(ex.Message, "Blood Bank Management System");
     }
 }
示例#3
0
 private void btnSearch_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DonorBL       db = new DonorBL();
         DonorEntities de = db.Search(txtDID.Text);
         if (de != null)
         {
             txtFName.Text       = de.FirstName;
             txtLName.Text       = de.LastName;
             txtAdd.Text         = de.Address;
             txtCity.Text        = de.City;
             txtMob.Text         = de.Mobile;
             cmbBG.SelectedValue = de.BloodGroup.ToString();
             gb1.Visibility      = Visibility.Visible;
         }
         else
         {
             gb1.Visibility = Visibility.Hidden;
             MessageBox.Show
                 (string.Format("Donor with id {0} does not exists.", txtDID.Text),
                 "Blood Bank Management System");
         }
     }
     catch (BloodBankExceptions ex)
     {
         MessageBox.Show(ex.Message, "Blood Bank Management System");
     }
     catch (SystemException ex)
     {
         MessageBox.Show(ex.Message, "Blood Bank Management System");
     }
 }
示例#4
0
        public void GetAllBloodBankID()
        {
            DonorBL   bi            = new DonorBL();
            DataTable bloodBankName = bi.GetAllBloodBankID();

            if (bloodBankName == null)
            {
                MessageBox.Show("nothing to show");
            }
            else
            {
                string[] result = new string[bloodBankName.Rows.Count];


                for (int i = 0; i < bloodBankName.Rows.Count; i++)
                {
                    for (int j = 0; j < bloodBankName.Columns.Count; j++)
                    {
                        result[i] = bloodBankName.Rows[i][j].ToString();
                        cmbBloodBankId.Items.Remove(result[i]);
                    }
                }
                for (int i = 0; i < bloodBankName.Rows.Count; i++)
                {
                    for (int j = 0; j < bloodBankName.Columns.Count; j++)
                    {
                        result[i] = bloodBankName.Rows[i][j].ToString();
                        cmbBloodBankId.Items.Add(result[i]);
                    }
                }
            }
        }
示例#5
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            DonorBL Bb         = new DonorBL();
            string  bloodgroup = (string )Bb.GetBloodGroup(txtBloodDonorId.Text);

            lblbloodgroup.Content = bloodgroup;
        }
示例#6
0
 private void btnDelete_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string  did = txtDID.Text;
         DonorBL pb  = new DonorBL();
         if (pb.DeleteDonor(did))
         {
             gb1.Visibility = Visibility.Hidden;
             MessageBox.Show("Donor Id " + did + " was deleted.");
         }
     }
     catch (BloodBankExceptions ex)
     {
         MessageBox.Show(ex.Message, "Blood Bank Management System");
     }
     catch (SystemException ex)
     {
         MessageBox.Show(ex.Message, "Blood Bank Management System");
     }
 }
示例#7
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DonorBL donor = new DonorBL();

                if (donor.ValidateBloodDonorData(txtDonorID.Text, txtDonorFName.Text, txtDonorLName.Text, txtDonorAdd.Text, txtDonorCity.Text, txtDonorMobile.Text))
                {
                    DonorEntities donorEntities = new DonorEntities()
                    {
                        BloodDonorID = txtDonorID.Text,

                        FirstName  = txtDonorFName.Text,
                        LastName   = txtDonorLName.Text,
                        Address    = txtDonorAdd.Text,
                        City       = txtDonorCity.Text,
                        Mobile     = txtDonorMobile.Text,
                        BloodGroup = cmbBG.SelectedValue.ToString()
                    };

                    DonorBL dbl = new DonorBL();
                    if (donor.AddDonor(donorEntities))
                    {
                        MessageBox.Show("Details Added", "Blood Bank Management System");
                    }
                    else
                    {
                        MessageBox.Show("Details could not be added", "Blood Bank Management System");
                    }
                }
            }
            catch (BloodBankExceptions ex)
            {
                MessageBox.Show(ex.Message, "Warning");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Warning");
            }
        }
示例#8
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         DonorBL   db = new DonorBL();
         DataTable dt = db.DisplayDonations();
         if (dt != null)
         {
             dataGridDonation.ItemsSource = dt.DefaultView;
         }
         else
         {
             MessageBox.Show("Table is empty", "Blood Bank Management System");
         }
     }
     catch (BloodBankExceptions ex)
     {
         MessageBox.Show(ex.Message, "Blood Bank Management System");
     }
     catch (SystemException ex)
     {
         MessageBox.Show(ex.Message, "Blood Bank Management System");
     }
 }
示例#9
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DonorBL b = new DonorBL();
                if (b.ValidateBloodDonationDetails(txtBloodDonorId.Text, dateChoose.Text.ToString(), txtnoofbottle.Text.ToString(), textweight.Text, txtHB.Text))
                {
                    BloodDonorDonations p = new BloodDonorDonations
                    {
                        BloodDonorID      = txtBloodDonorId.Text,
                        BloodDonationDate = DateTime.Parse(dateChoose.Text),
                        NumberOfBottles   = int.Parse(txtnoofbottle.Text),
                        Weight            = int.Parse(textweight.Text),
                        HBCount           = decimal.Parse(txtHB.Text),
                        BloodGroup        = lblbloodgroup.Content.ToString(),
                        BloodBankId       = cmbBloodBankId.SelectedValue.ToString()
                    };

                    DonorBL pb  = new DonorBL();
                    int     pid = pb.AddDonation(p);
                    BloodDonationLabel.Content = pid.ToString();

                    MessageBox.Show(string.Format("New donation added.\ndonation id Id:{0}", pid),
                                    "BBMS");
                    clearall();
                }
            }
            catch (BloodBankExceptions ex)
            {
                MessageBox.Show(ex.Message, "BBMS");
            }
            catch (SystemException ex)
            {
                MessageBox.Show(ex.Message, "BBMS");
            }
        }