public static int AddUpdateSubCategory(sub_category ob) { int _Categoryid = 0; using (InventoryEntities db = new InventoryEntities()) { if (ob.id > 0) { sub_category temp = db.sub_category.Where(u => u.id == ob.id).FirstOrDefault(); if (temp != null) { temp.id = ob.id; temp.subcategory_name = ob.subcategory_name; temp.category = ob.category; } } else { db.sub_category.Add(ob); } int x = db.SaveChanges(); if (x > 0) { _Categoryid = ob.id; } } return _Categoryid; }
public static int AddUpdateDealer(dealer ob) { int delarid = 0; using (InventoryEntities db = new InventoryEntities()) { if (ob.id > 0) { dealer temp = db.dealers.Where(u => u.id == ob.id).FirstOrDefault(); if (temp != null) { temp.id = ob.id; temp.dealer_name = ob.dealer_name; temp.dealer_address = ob.dealer_address; } } else { db.dealers.Add(ob); } int x = db.SaveChanges(); if (x > 0) { delarid = ob.id; } } return delarid; }
public static int AddUpdateDealer(dealer ob) { int delarid = 0; using (InventoryEntities db = new InventoryEntities()) { if (ob.id > 0) { dealer temp = db.dealers.Where(u => u.id == ob.id).FirstOrDefault(); if (temp != null) { temp.id = ob.id; temp.dealer_name = ob.dealer_name; temp.dealer_address = ob.dealer_address; } } else { db.dealers.Add(ob); } int x = db.SaveChanges(); if (x > 0) { delarid = ob.id; } } return(delarid); }
public static int AddUpdateCategory(category ob) { int _Categoryid = 0; using (InventoryEntities db = new InventoryEntities()) { if (ob.id > 0) { category temp = db.categories.Where(u => u.id == ob.id).FirstOrDefault(); if (temp != null) { temp.id = ob.id; temp.category_name = ob.category_name; } } else { db.categories.Add(ob); } int x = db.SaveChanges(); if (x > 0) { _Categoryid = ob.id; } } return(_Categoryid); }
public static bool DeleteDealer(int Dealer_id) { bool flag =false; using (InventoryEntities db = new InventoryEntities()) { dealer temp = db.dealers.Where(u => u.id == Dealer_id).FirstOrDefault(); if (temp != null) { db.dealers.Remove(temp); db.SaveChanges(); flag = true; } } return flag; }
public static bool DeleteDealer(int Dealer_id) { bool flag = false; using (InventoryEntities db = new InventoryEntities()) { dealer temp = db.dealers.Where(u => u.id == Dealer_id).FirstOrDefault(); if (temp != null) { db.dealers.Remove(temp); db.SaveChanges(); flag = true; } } return(flag); }
public static bool DeleteSubCategory(int Category_id) { bool flag = false; using (InventoryEntities db = new InventoryEntities()) { sub_category temp = db.sub_category.Where(u => u.id == Category_id).FirstOrDefault(); if (temp != null) { db.sub_category.Remove(temp); db.SaveChanges(); flag = true; } } return(flag); }
public static bool AddBulkSellingHistory(List <selling_history> lst_sellinghistory) { bool flag = false; using (InventoryEntities db = new InventoryEntities()) { foreach (selling_history item in lst_sellinghistory) { db.selling_history.Add(item); } int x = db.SaveChanges(); if (x > 0) { flag = true; } } return(flag); }
public static bool AddBulkSellingHistory(List<selling_history> lst_sellinghistory) { bool flag = false; using (InventoryEntities db = new InventoryEntities()) { foreach (selling_history item in lst_sellinghistory) { db.selling_history.Add(item); } int x = db.SaveChanges(); if (x > 0) { flag = true; } } return flag; }
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 bool DeleteCategory(int Category_id) { try { bool flag = false; using (InventoryEntities db = new InventoryEntities()) { category temp = db.categories.Where(u => u.id == Category_id).FirstOrDefault(); if (temp != null) { db.categories.Remove(temp); db.SaveChanges(); flag = true; } } return flag; } catch { return false; } }
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 AddUpdateProduct(product ob) { int _Productid = 0; using (InventoryEntities db = new InventoryEntities()) { if (ob.id > 0) { product temp = db.products.Where(u => u.id == ob.id).FirstOrDefault(); if (temp != null) { temp.id = ob.id; temp.product_name = ob.product_name; temp.category = ob.category; temp.image_url = ob.image_url; temp.brand = ob.brand; temp.sub_category = ob.sub_category; temp.sell_price = ob.sell_price; temp.cost_price = ob.cost_price; temp.weight = ob.weight; temp.status = ob.status; temp.Stock = ob.Stock; } } else { db.products.Add(ob); } int x = db.SaveChanges(); if (x > 0) { _Productid = ob.id; } } return _Productid; }
public static int AddUpdateProduct(product ob) { int _Productid = 0; using (InventoryEntities db = new InventoryEntities()) { if (ob.id > 0) { product temp = db.products.Where(u => u.id == ob.id).FirstOrDefault(); if (temp != null) { temp.id = ob.id; temp.product_name = ob.product_name; temp.category = ob.category; temp.image_url = ob.image_url; temp.brand = ob.brand; temp.sub_category = ob.sub_category; temp.sell_price = ob.sell_price; temp.cost_price = ob.cost_price; temp.weight = ob.weight; temp.status = ob.status; temp.Stock = ob.Stock; } } else { db.products.Add(ob); } int x = db.SaveChanges(); if (x > 0) { _Productid = ob.id; } } return(_Productid); }