Beispiel #1
0
 public static bool DeleteBillDetail(BillDetail a)
 {
     string sql = "sp_DeleteBillDetail";
     SqlParameter BillID = new SqlParameter("@BillID", a.BillID);
     SqlParameter ProID = new SqlParameter("@ProID", a.ProID);
     return DataProvider.ExecuteNonQuery(sql, CommandType.StoredProcedure, BillID, ProID);
 }
Beispiel #2
0
 public static bool isExist(BillDetail a) {
     string sql = "sp_CheckExist";
     SqlParameter BillID = new SqlParameter("@BillID", a.BillID);
     SqlParameter ProID = new SqlParameter("@ProID", a.ProID);
     SqlDataReader dr = DataProvider.ExecuteQueryWithDataReader(sql, System.Data.CommandType.StoredProcedure, BillID, ProID);
     return dr.HasRows;
 }
Beispiel #3
0
 public static bool AddQuantity(BillDetail a)
 {
     string sql = "sp_AddQuantity";
     SqlParameter BillID = new SqlParameter("@BillID", a.BillID);
     SqlParameter ProID = new SqlParameter("@ProID", a.ProID);
     SqlParameter Quantity = new SqlParameter("@Quantity", a.Quantity);
     return DataProvider.ExecuteNonQuery(sql, CommandType.StoredProcedure, BillID, ProID, Quantity);
 }
 private void btnAdd_Click(object sender, RoutedEventArgs e)
 {
     if (isvalid())
     {
         BillDetail bill = new BillDetail(BillID, int.Parse(txtProID.Text), int.Parse(txtQuantity.Text));
         if (ProductBL.CheckQuantity(bill))
         {
             if (BillDetailBL.isExist(bill))
             {
                 BillDetailBL.AddQuantity(bill);
             }
             else
                 BillDetailBL.AddBillDetails(bill);
             this.Close();
         }
         else
         {
             System.Windows.Forms.MessageBox.Show("Not enough quantity in stock");
         }
         
         
     }
     
 }
Beispiel #5
0
 public static bool CheckQuantity(BillDetail a)
 {
     string sql = "sp_CheckQuantity";
     SqlParameter ProID = new SqlParameter("@ProID", a.ProID);
     SqlParameter Quantity = new SqlParameter("@Quantity", a.Quantity);
     SqlDataReader dr= DataProvider.ExecuteQueryWithDataReader(sql, CommandType.StoredProcedure, ProID, Quantity);
     return dr.HasRows;
 }
Beispiel #6
0
 public static bool DeleteBillDetail(BillDetail a)
 {
     return BillDetailData.DeleteBillDetail(a);
 }
Beispiel #7
0
 public static bool AddQuantity(BillDetail a)
 {
     return BillDetailData.AddQuantity(a);
 }
Beispiel #8
0
 public static bool isExist(BillDetail a)
 {
     return BillDetailData.isExist(a);
 }
Beispiel #9
0
 public static bool AddBillDetails(BillDetail a)
 {
     return BillDetailData.AddBillDetails(a);
 }
Beispiel #10
0
 public static bool CheckQuantity(BillDetail a)
 {
     return ProductData.CheckQuantity(a);
 }
Beispiel #11
0
 public static bool UpdateQuantity(BillDetail a)
 {
     return ProductData.UpdateQuantity(a);
 }
Beispiel #12
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (isValid())
            {
                double total = 0;
                int ProductID = 0;
                int.TryParse(txtAdd.Text, out ProductID);
                int Quantity = int.Parse(txtQuantity.Text);
                int BillID = int.Parse(txtBillID.Text);
                double m = 0;
                if (ProductBL.GetbyProductID(ProductID))
                {
                    BillDetail bill = new BillDetail(BillID, ProductID, Quantity);
                    if (ProductBL.CheckQuantity(bill))
                    {
                        if (BillDetailBL.isExist(bill))
                        {
                            BillDetailBL.AddQuantity(bill);
                        }
                        else
                            BillDetailBL.AddBillDetails(bill);
                        txtQuantity.Text = "1";
                        txtAdd.Text = "";
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show("Not enough quantity in stock");
                    }
                    loadGrid();

                }
                else
                {
                    BillDetails frm = new BillDetails(BillID);
                    frm.ShowDialog();
                    loadGrid();
                }
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    m += double.Parse(dt.Rows[i][4].ToString());
                }
                int Discount = int.Parse(txtPercentage.Text);
                total = m-Discount*m/100;
                txtSum.Text = total.ToString();
            }            
        }