private void UpdateBtn(object sender, RoutedEventArgs e)
        {
            if (checkIfEmpty())
            {
                Objects.Medicine Obj = new Objects.Medicine();
                //Obj.MedID = new BLL.Medicine().GetMaxID();
                Obj.MedName      = txtMedName.Text.ToString();
                Obj.Formula      = txtFormula.Text.ToString();
                Obj.ExpTime      = txtExpiry.Text.ToString();
                Obj.TypeID       = new BLL.Medicine().GetTypeID(TypeComboBox.Text.ToString());
                Obj.SymptomID    = new BLL.Medicine().GetUseID(UseComboBox.Text.ToString());
                Obj.Manufacturer = txtManufacturer.Text.ToString();
                Obj.Quantity     = Convert.ToInt32(txtQuantity.Text);
                Obj.Price        = Convert.ToInt32(txtPrice.Text);
                int vCheck = new BLL.Medicine().UpdateData(Obj);
                MessageBox.Show("Data Updated");

                txtExpiry.Text             = "";
                txtQuantity.Text           = "";
                txtManufacturer.Text       = "";
                txtPrice.Text              = "";
                txtFormula.Text            = "";
                txtMedName.Text            = "";
                TypeComboBox.SelectedIndex = -1;
                UseComboBox.SelectedIndex  = -1;
                Close();
            }
            else
            {
                MessageBox.Show("Please Fill All The Inputs.");
            }
        }
Beispiel #2
0
        private void SymptomBtn(object sender, RoutedEventArgs e)
        {
            Objects.Medicine Obj = new Objects.Medicine();
            DataTable        dt  = new DataTable();

            dt = new BLL.Medicine().formloadSymptom(Obj, Search_Symptom.Text.ToString());

            MedicineGrid.ItemsSource = dt.AsDataView();
            clearAll();
        }
Beispiel #3
0
        private void NameBtn(object sender, RoutedEventArgs e)
        {
            Objects.Medicine Obj = new Objects.Medicine();
            DataTable        dt  = new DataTable();

            dt = new BLL.Medicine().formloadName(Obj, Search_Name.Text);

            MedicineGrid.ItemsSource = dt.AsDataView();

            clearAll();
        }
Beispiel #4
0
        private void formload()
        {
            counter          = 1;
            txtQuantity.Text = counter.ToString();


            Objects.Medicine Obj = new Objects.Medicine();
            DataTable        dt  = new DataTable();

            dt = new BLL.Medicine().formload(Obj);
            MedicineGrid.ItemsSource = dt.AsDataView();
        }
Beispiel #5
0
        private void MedicineGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (MedicineGrid.SelectedIndex != -1)
            {
                BLL.Medicine     Obj = new BLL.Medicine();
                Objects.Medicine med = new Objects.Medicine();
                string           MedName;
                DataRowView      rows = (DataRowView)MedicineGrid.SelectedItems[0];
                MedName = rows["Medicine_Name"].ToString();

                med = Obj.getRow(MedName);
                new UpdateWindow(med).Show();
            }
            else
            {
                MessageBox.Show("Please select an entry from the table.");
            }
        }
Beispiel #6
0
 private void MedicineGrid_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.F)
     {
         string       MedName;
         BLL.Medicine Obj      = new BLL.Medicine();
         int          Quantity = Convert.ToInt32(txtQuantity.Text.ToString());
         if (MedicineGrid.SelectedIndex != -1)
         {
             DataRowView rows = (DataRowView)MedicineGrid.SelectedItems[0];
             MedName = rows["Medicine_Name"].ToString();
             int vCheck = Obj.DeleteData(MedName);
             MessageBox.Show("Entry Deleted");
             formload();
         }
         else
         {
             MessageBox.Show("Please select an entry from the table.");
         }
     }
 }
Beispiel #7
0
        private void BuyBtn(object sender, RoutedEventArgs e)
        {
            string MedName;

            BLL.Medicine Obj      = new BLL.Medicine();
            int          Quantity = Convert.ToInt32(txtQuantity.Text.ToString());

            if (MedicineGrid.SelectedIndex != -1)
            {
                DataRowView rows = (DataRowView)MedicineGrid.SelectedItems[0];
                MedName = rows["Medicine_Name"].ToString();
                int totalPrice = Obj.getPrice(MedName, Quantity) * Quantity;
                MessageBox.Show("Item: " + MedName + "\nQuantity: " + Quantity + "\nTotal Payment: Rs. "
                                + totalPrice + "\nThanks for purchasing");
                Obj.BuyMedicine(MedName, Quantity);
                formload();
            }
            else
            {
                MessageBox.Show("Please select an entry from the table.");
            }
        }