public List <BalProduct_Entry> Select_ProductEntry_ById(int id) { //if 0 then select all else by id try { List <BalProduct_Entry> ProductEntryList = new List <BalProduct_Entry>(); AddParameter("@Id", MySqlDbType.Int32, id); DataSet ds = ExecuteForData("Sp_Select_Product_Entry"); foreach (DataRow users in ds.Tables[0].Rows) { BalProduct_Entry productDetail = new BalProduct_Entry(); productDetail.ID = Convert.ToInt32(users["ID"]); productDetail.Name = Convert.ToString(users["Name"]); productDetail.Price = Convert.ToDecimal(users["Price"]); productDetail.Quantity = Convert.ToInt32(users["Quantity"]); productDetail.IsIGSTApplicable = Convert.ToBoolean(users["IsIGSTApplicable"]); productDetail.Purchase_Date = Convert.ToString(users["Purchase_Date"]); productDetail.Expiry_Date = Convert.ToString(users["Expiry_Date"]); productDetail.Color = Convert.ToString(users["Color"]); ProductEntryList.Add(productDetail); } return(ProductEntryList); } catch (Exception ex) { return(null); } finally { _dataConnection.Close(); } }
public ActionResult GetAllProduct_Entry() { BalProduct_Entry balProduct = new BalProduct_Entry(); ViewBag.ProductDetails = balProduct.Select_ProductEntry_ById(0).ToList(); ViewBag.UserTitle = "Other User"; return(View()); }
public ActionResult AllProduct_Entry() { BalProduct_Entry balProduct = new BalProduct_Entry(); balProduct.baproduct_lst = balProduct.Select_ProductEntry_ById(0).ToList(); var Selectdatalst = from s in balProduct.baproduct_lst select new { s.ID, s.Name, s.Price, s.Quantity, s.IsIGSTApplicable, s.Purchase_Date, s.Expiry_Date, s.Color }; return(Json(new { data = Selectdatalst }, JsonRequestBehavior.AllowGet)); }
public ActionResult Add_Product_Entry(Product_Entry product) { BalProduct_Entry balProduct_Entry = new BalProduct_Entry(); Product_Entry productEntry = new Product_Entry(); try { bool IsSave = false; balProduct_Entry.ID = product.ID; balProduct_Entry.Name = product.Name; balProduct_Entry.Price = product.Price; balProduct_Entry.Quantity = product.Quantity; balProduct_Entry.IsIGSTApplicable = product.IsIGSTApplicable; balProduct_Entry.Purchase_Date = product.Purchase_Date; balProduct_Entry.Expiry_Date = product.Expiry_Date; balProduct_Entry.Color = product.Color; balProduct_Entry.baproduct_lst = balProduct_Entry.Select_ProductEntry_ById(0).Where(m => m.Name == product.Name).ToList(); if (balProduct_Entry.baproduct_lst.Count() == 0) { if (product.ID == 0) { IsSave = balProduct_Entry.InsertProduct_Entry(balProduct_Entry); TempData["UsersaveUpdate"] = "Product Entry Saved Successfully."; } } else { TempData["UserSaveUpdate"] = "Name Allredy Exist."; } } catch (Exception ex) { } return(RedirectToAction("GetAllProduct_Entry")); }
public bool InsertProduct_Entry(BalProduct_Entry product) { try { AddParameter("@Name", MySqlDbType.VarChar, product.Name); AddParameter("@Price", MySqlDbType.Decimal, product.Price); AddParameter("@Quantity", MySqlDbType.Int32, product.Quantity); AddParameter("@IsIGSTApplicable", MySqlDbType.Bit, product.IsIGSTApplicable); AddParameter("@Purchase_Date", MySqlDbType.VarChar, product.Purchase_Date); AddParameter("@Expiry_Date", MySqlDbType.VarChar, product.Expiry_Date); AddParameter("@Color", MySqlDbType.VarChar, product.Color); ExecuteScalar("Sp_Insert_Product_Entry"); return(true); } catch (Exception ex) { return(false); } finally { _dataConnection.Close(); } }