public static int AddUpdateSellingHistory(selling_history ob) { int _id = 0; using (InventoryEntities db = new InventoryEntities()) { if (ob.id > 0) { selling_history temp = db.selling_history.Where(u => u.id == ob.id).FirstOrDefault(); if (temp != null) { temp.id = ob.id; temp.dealer_id = ob.dealer_id; temp.product_id = ob.product_id; temp.quantity = ob.quantity; temp.credit = ob.credit; temp.debit = ob.debit; temp.transaction_type = ob.transaction_type; temp.customer_info = ob.customer_info; temp.payment_type = ob.payment_type; temp.payment_date = ob.payment_date; temp.customer_name = ob.customer_name; temp.remarks = ob.remarks; } } else { db.selling_history.Add(ob); } int x = db.SaveChanges(); if (x > 0) { _id = ob.id; } } return _id; }
public static int AddUpdateSellingHistory(selling_history ob) { int _id = 0; using (InventoryEntities db = new InventoryEntities()) { if (ob.id > 0) { selling_history temp = db.selling_history.Where(u => u.id == ob.id).FirstOrDefault(); if (temp != null) { temp.id = ob.id; temp.dealer_id = ob.dealer_id; temp.product_id = ob.product_id; temp.quantity = ob.quantity; temp.credit = ob.credit; temp.debit = ob.debit; temp.transaction_type = ob.transaction_type; temp.customer_info = ob.customer_info; temp.payment_type = ob.payment_type; temp.payment_date = ob.payment_date; temp.customer_name = ob.customer_name; temp.remarks = ob.remarks; } } else { db.selling_history.Add(ob); } int x = db.SaveChanges(); if (x > 0) { _id = ob.id; } } return(_id); }
public static int AddUpdateSellingHistory(selling_history ob) { return SellingHistoryProvider.AddUpdateSellingHistory(ob); }
protected void AddStock(object parameter) { try { selling_history ob = new selling_history(); ob.id = 0; ob.dealer_id = SelectedDealer.id; ob.product_id = SelectedProduct.id; ob.quantity = Quantity; ob.credit = 0; ob.debit = Amount; ob.transaction_type = (int)InventoryHelper.TransactionType.Debit; ob.customer_info = ""; ob.payment_type = PaymentType == null ? "" : PaymentType.Content.ToString(); ob.payment_date = DateTime.Now; ob.customer_name = ""; ob.remarks = Remarks; SellingHistoryServices.AddUpdateSellingHistory(ob); ProductServices.UpdateProductStock(ob.product_id); //MessageBox.Show("Stock Added"); InventoryHelper.SuccessAlert("Success", "Stock Added"); Initialize(); } catch (Exception ex) { MessageBox.Show("Error Occurse::" + ex.ToString()); } }
protected selling_history Converttosellinghistory(ProductSellingEntity ob) { selling_history temphistory = new selling_history(); temphistory.dealer_id = null; temphistory.product_id = ob.ProductId; temphistory.quantity = ob.Quantity; temphistory.credit = ob.Amount; temphistory.debit = 0; temphistory.transaction_type = (int)InventoryHelper.TransactionType.Credit; temphistory.customer_info = CustomerInfo; temphistory.payment_type = PaymentType.Content == null ? "" : PaymentType.Content.ToString(); temphistory.payment_date = DateTime.Now; temphistory.customer_name = CustomerName; temphistory.remarks = Remarks; return temphistory; }