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); }
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; }
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"); } } }
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; }
public static bool DeleteBillDetail(BillDetail a) { return BillDetailData.DeleteBillDetail(a); }
public static bool AddQuantity(BillDetail a) { return BillDetailData.AddQuantity(a); }
public static bool isExist(BillDetail a) { return BillDetailData.isExist(a); }
public static bool AddBillDetails(BillDetail a) { return BillDetailData.AddBillDetails(a); }
public static bool CheckQuantity(BillDetail a) { return ProductData.CheckQuantity(a); }
public static bool UpdateQuantity(BillDetail a) { return ProductData.UpdateQuantity(a); }
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(); } }