Beispiel #1
0
       public List<ProductDetails> Get_product_list()
       {

           List<ProductDetails> products = new List<ProductDetails>();
           DBHelper helper = new DBHelper();
           DataSet ds = helper.executeSelectQuery(PROCEDURES.GET_PRODUCTS);
           if (ds != null)
           {

               foreach (DataRow row in ds.Tables[0].Rows)
               {
                   ProductDetails product = new ProductDetails();
                   product.Prod_Id = row["Prod_Id"].ToString();
                   product.Prod_Name = row["Prod_Name"].ToString();
                   product.Prod_Img = row["Prod_Img"].ToString();
                   product.Brand_Name = row["Brand_Name"].ToString();
                   product.SubCategory = row["Sub_Cat_Name"].ToString();
                   //product. = row["Prod_Img"].ToString();
                   product.Price = Convert.ToSingle(row["Price"]);
                   product.Offer_Price = Convert.ToSingle(row["offer_price"]);
                   product.Purchase_Price = Convert.ToSingle(row["Purchase_Price"]);
                   product.Prod_Quantity = row["packed_quantity"].ToString();
                   product.SubClassification = row["SubClassification"].ToString();
                   product.Total_Quantity = Convert.ToInt32(row["Availabe_qty"]);
                   products.Add(product);
               }
           }
           return products;
 
       }
Beispiel #2
0
       public int updateProduct(ProductDetails product)
       {
           DBHelper helper = new DBHelper();
           SqlParameter[] param = new SqlParameter[11];
           param[0] = new SqlParameter(CONSTANT.SUB_CATEGORY_ID, product.SubCategory);
           param[1] = new SqlParameter(CONSTANT.BRAND_ID, product.Brand_Name);
           param[2] = new SqlParameter(CONSTANT.PRODUCT_ID, product.Prod_Id);
           param[3] = new SqlParameter(CONSTANT.PRODUCT_NAME, product.Prod_Name);
           param[4] = new SqlParameter(CONSTANT.PRODUCT_IMAGE, product.Prod_Img);
           param[5] = new SqlParameter(CONSTANT.PRICE, product.Price);
           param[6] = new SqlParameter(CONSTANT.OFFER_PRICE, product.Offer_Price);
           param[7] = new SqlParameter(CONSTANT.PURCHASE_PRICE, product.Purchase_Price);
           param[8] = new SqlParameter(CONSTANT.PACKING_QUANITY, product.Prod_Quantity);
           param[9] = new SqlParameter(CONSTANT.TotalQuantity, product.Total_Quantity);
           param[10] = new SqlParameter(CONSTANT.SUB_CLASSFICATION_NAME, product.SubClassification);

           int res = helper.InsertQuery(PROCEDURES.UPDATE_PRODUCTS, param);
           return res;

       }
        public ActionResult ProdEdit_post(ProductDetails productdetails)
        {

            Session["ControllerName"] = "Prod Edit";
            if (Session["loginDetails"] != null)
            {
                getDdlsForProduct();
                ViewBag.DDLBrand = new SelectList(ddlbrand, "Value", "Text").ToList();
                //ViewBag.SubCategory = new SelectList(ddlSubCategory, "Value", "Text").ToList();

                ProductAdminBLL bll = new ProductAdminBLL();
                int res = bll.updateProduct(productdetails);
                if (res > 0)
                {

                   return RedirectToAction("ProductList");
                }

                return View();
            }
            else
            {

                return RedirectToAction("Error");
            }
        }