public ActionResult ProcessForm(FormCollection frm, string submit)
        {
            ProductModel objModel    = new ProductModel();
            String       SearchText  = frm["TxtSearch"];
            String       SearchPrice = frm["TxtPriceRange"];

            switch (submit)
            {
            case "Search":
                ViewBag.UsersProduct = SearchProduct(SearchText);
                var ProductCatList = CommonFile.GetProductCategory(null);

                ViewBag.ProductCatList = ProductCatList;
                break;

            case "PriceRange":
                ViewBag.UsersProduct = SearchPriceRange(SearchPrice, 0);
                var ProductCatListPrice = CommonFile.GetProductCategory(null);
                ViewBag.ProductCatList = ProductCatListPrice;
                // return PartialCatwiseProductValue(2);
                break;
            }
            return(View("Index"));
            // return PartialView("~/Views/ProductCatWise/PartialCatwiseProductValue.cshtml", objModel);
        }
        public PartialViewResult PartialCatwiseProductValue(string id)

        {
            long?Id          = Convert.ToInt64(CommonFile.Decode(id));
            var  jsonString1 = "{\"ProductCatId\":\"" + Id + "\"}";

            Services.SetCookie(this.ControllerContext.HttpContext, "ProductCatWiseCatId", jsonString1.ToString());
            ProductModel        objModel          = new ProductModel();
            List <ProductModel> SearchProductList = new List <ProductModel>();

            if (Id == null)
            {
                SearchProductList = ListAllProduct;
            }
            else
            {
                objModel.ProductCatId = Convert.ToInt64(Id);
                if (!CommonFile.IsParentCategory(Id))
                {
                    SearchProductList = ListAllProduct.Where(x => x.ProductCatId == Id).ToList();
                }
                else
                {
                    SearchProductList = ListAllProduct.Where(x => x.ParentCatId == Id).ToList();
                }
            }
            ViewBag.LowerLimit        = 1;
            ViewBag.UsersProduct      = SearchProductList.Take(12);
            ViewBag.NumberOfPages     = SearchProductList.Count / 10;
            ViewBag.SearchResultCount = SearchProductList.Count;
            var ProductCatList = CommonFile.GetProductCategory(Id);

            //var ProductListMdel = new List<DropDownModel>();
            return(PartialView("~/Views/ProductCatWise/PartialCatwiseProductValue.cshtml", objModel));
        }
        public AddressModel BindCartItems()
        {
            AddressModel objModel = new AddressModel();

            ViewBag.ProductCatList = CommonFile.GetProductCategory(null);
            List <AddToCartModel> ListAddToCart = Services.GetMyCart(this.ControllerContext.HttpContext, _JwtTokenManager);

            ViewBag.AddToCart      = ListAddToCart;
            objModel.CartItemCount = ListAddToCart.Count();
            ViewBag.TotalAmount    = GetTotalAmount(ListAddToCart);
            return(objModel);
        }
        public PartialViewResult WebSiteSidebar()
        {
            ProductModel objModel       = new ProductModel();
            var          ProductCatList = CommonFile.GetProductCategory(null);

            ViewBag.ProductCatList = ProductCatList;
            List <AddToCartModel> ListAddToCart = Services.GetMyCart(this.ControllerContext.HttpContext, _JwtTokenManager);

            ViewBag.AddToCart      = ListAddToCart;
            objModel.CartItemCount = ListAddToCart.Count();
            ViewBag.TotalAmount    = GetTotalAmount(ListAddToCart);
            return(PartialView("~/Views/Shared/_WebSiteSidebar.cshtml", objModel));
        }
        public PartialViewResult PartialCatwiseProductPrice(decimal Price, String CategoryId)
        {
            long         id       = Convert.ToInt64(CommonFile.Decode(CategoryId));
            ProductModel objModel = new ProductModel();

            objModel.ProductCatId = id;
            var SearchProductList = SearchPriceRange(Price.ToString(), id);

            ViewBag.UsersProduct = SearchProductList.Take(Constant.NumberOfProducts);
            var ProductCatList = CommonFile.GetProductCategory(id);

            ViewBag.ProductCatList = ProductCatList;
            return(PartialView("~/Views/ProductCatWise/PartialCatwiseProductPrice.cshtml", objModel));
        }
Example #6
0
 public ActionResult Index()
 {
     if (ListAllProduct == null)
     {
         ListAllProduct = CommonFile.GetProduct();
     }
     var PopularProducts = CommonFile.GetPopularProduct(0);
     ViewBag.PopularProducts = PopularProducts;
     ViewBag.FirstCategory = PopularProducts.Where(x => x.ParentCatId == long.Parse((Constant.ParentCategories[0]).ToString())).Take(Constant.NumberOfProductsInFrontPage);
     ViewBag.SecondCategory = PopularProducts.Where(x => x.ParentCatId == Constant.ParentCategories[1]).Take(Constant.NumberOfProductsInFrontPage);
     ViewBag.ThirdCategory = PopularProducts.Where(x => x.ParentCatId == Constant.ParentCategories[2]).Take(Constant.NumberOfProductsInFrontPage);
     ViewBag.FourthCategory = PopularProducts.Where(x => x.ParentCatId == Constant.ParentCategories[3]).Take(Constant.NumberOfProductsInFrontPage);
     ViewBag.FifthCategory = PopularProducts.Where(x => x.ParentCatId == Constant.ParentCategories[4]).Take(Constant.NumberOfProductsInFrontPage);
     ViewBag.ProductCatList = CommonFile.GetProductCategory(null);
     return View();
 }
Example #7
0
        public ActionResult ProcessForm(FormCollection frm, string submit)
        {
            String SearchText = frm["TxtSearch"];
            switch (submit)
            {
                case "Search":
                    ViewBag.UsersProduct = SearchProduct(SearchText);
                    var ProductCatList = CommonFile.GetProductCategory(null);

                    ViewBag.ProductCatList = ProductCatList;
                    break;
                case "Cancel":
                    ViewBag.Message = "The operation was cancelled!";
                    break;
            }
            return View("Index");
        }
Example #8
0
        public PartialViewResult HeaderValue(HeaderPartialModel objmodel1)
        {
            HeaderPartialModel    objModel      = new HeaderPartialModel();
            LoginModel            MdUser        = Services.GetLoginWebUser(this.ControllerContext.HttpContext, _JwtTokenManager);
            List <AddToCartModel> ListAddToCart = Services.GetMyCart(this.ControllerContext.HttpContext, _JwtTokenManager);

            objModel.UserName      = MdUser.Name;
            objModel.UserId        = Convert.ToInt64(MdUser.Id);
            objModel.ProfileImg    = MdUser.ProfileImg;
            objModel.CartItemCount = ListAddToCart.Count();
            objModel.RegisterType  = MdUser.RegisterType;

            ViewBag.AddToCart = ListAddToCart;

            ViewBag.TotalAmount = GetTotalAmount(ListAddToCart);

            var parentcategories = CommonFile.GetProductCategory(0);

            ViewBag.ParentCategories = new SelectList(parentcategories, "Id", "Name");
            objModel.ParentCatId     = objmodel1.ParentCatId;
            ViewBag.ProductCatList   = CommonFile.GetProductCategory(null);
            return(PartialView("~/Views/Shared/_WebsiteHeader.cshtml", objModel));
        }
Example #9
0
        private void preRequistProduct(long editId)
        {
            LoginModel MdUser = Services.GetLoginUser(this.ControllerContext.HttpContext, _JwtTokenManager);
            long       UserId = 0;

            if (MdUser.Id != 0)
            {
                UserId = MdUser.Id;
            }
            var ProductCatList = CommonFile.GetProductCategory(null);

            ViewBag.ProductCatList = new SelectList(ProductCatList, "Id", "Name");
            var BusinessList = CommonFile.GetUsersBusiness(UserId);

            ViewBag.BusinessList = new SelectList(BusinessList, "Id", "BusinessName");
            List <ProductImages> ListProductImages = new List <ProductImages>();

            ViewBag.ProductImages = ListProductImages;
            if (editId == 0)
            {
                EditProductImageList = null;
            }
        }
        public ActionResult Sortby(int sortorder, int pageindex, string productcatid)
        {
            long?        Id                = Convert.ToInt64(CommonFile.Decode(productcatid));
            ProductModel objModel          = new ProductModel();
            var          SearchProductList = new List <ProductModel>();
            string       SortOrder         = "";

            switch (sortorder)
            {
            case 1:
                SortOrder = "DiscountPrice";
                break;

            case 2:
                SortOrder = "DiscountPrice desc";
                break;

            case 3:
                SortOrder = "Popularity";
                break;

            case 4:
                SortOrder = "RecordDate";
                break;
            }
            sortedproducts = ListAllProduct.Where(x => x.ProductCatId == Id).ToList();
            if (sortedproducts.Count == 0)
            {
                sortedproducts = ListAllProduct.Where(x => x.ParentCatId == Id).ToList();
            }
            if (sortorder == 1)
            {
                sortedproducts = sortedproducts.OrderBy(x => x.DiscountPrice).ToList();
            }
            if (sortorder == 2)
            {
                sortedproducts = sortedproducts.OrderByDescending(x => x.DiscountPrice).ToList();
            }
            ViewBag.UsersProduct = sortedproducts.Take(Constant.NumberOfProducts);
            ViewBag.SearchCatId  = productcatid;
            var ProductCatList = CommonFile.GetProductCategory(null);

            ViewBag.ProductsFrom      = ((pageindex - 1) * Constant.NumberOfProducts);
            ViewBag.ToProductsCount   = Enumerable.Count(ViewBag.UsersProduct);
            ViewBag.SearchResultCount = sortedproducts.Count;

            int nop         = sortedproducts.Count / Constant.NumberOfProducts;
            int remindernop = sortedproducts.Count % 12;

            if (nop < Constant.NumberOfPages)
            {
                if (remindernop > 0)
                {
                    nop = nop + 1;
                }
                ViewBag.NumberOfPages = nop;
            }
            else
            {
                ViewBag.NumberOfPages = Constant.NumberOfPages;
            }
            ViewBag.LowerLimit = 1;


            int    NumberOfPages     = Convert.ToInt32(ViewBag.NumberOfPages);
            string SearchResultCount = Convert.ToString(sortedproducts.Count);

            Services.SetCookie(this.ControllerContext.HttpContext, "NumberOfPages", NumberOfPages.ToString());
            Services.SetCookie(this.ControllerContext.HttpContext, "LowerLimit", "1");
            Services.SetCookie(this.ControllerContext.HttpContext, "SearchResutlCount", SearchResultCount);


            ViewBag.ProductCatList = ProductCatList;
            return(PartialView("~/Views/ProductCatWise/PartialCatwiseProductValue.cshtml", objModel));
        }
        public ActionResult Index(string id)
        {
            long?Id = Convert.ToInt64(CommonFile.Decode(id));

            Services.SetCookie(this.ControllerContext.HttpContext, "ProductCatId", id.ToString());
            ListAllProduct = CommonFile.GetProduct();
            ProductModel objmodel          = new ProductModel();
            var          SearchProductList = new List <ProductModel>();

            if (!CommonFile.IsParentCategory(Id))
            {
                SearchProductList = ListAllProduct.Where(x => x.ProductCatId == Id).ToList();
            }
            else
            {
                SearchProductList = ListAllProduct.Where(x => x.ParentCatId == Id).ToList();
            }
            ViewBag.SearchCatId       = id;
            ViewBag.UsersProduct      = SearchProductList;
            ViewBag.SearchResultCount = SearchProductList.Count;
            var ProductCatList    = CommonFile.GetProductCategory(null);
            var EncodedCategories = new List <DropDownModel>();

            foreach (var item in ProductCatList)
            {
                DropDownModel dropDown = new DropDownModel();
                dropDown.Name         = item.Name;
                dropDown.Id           = item.Id;
                dropDown.EncodedId    = CommonFile.Encode(item.Id.ToString());
                dropDown.CatIdEncoded = CommonFile.Encode(item.ParentCatId.ToString());
                dropDown.ParentCatId  = item.ParentCatId;
                EncodedCategories.Add(dropDown);
            }
            int pageindex = 1;

            ViewBag.UsersProduct      = SearchProductList.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);
            ViewBag.LowerLimit        = ((pageindex / 5) * 5) + 1;
            ViewBag.PageIndex         = pageindex;
            ViewBag.ProductsFrom      = ((pageindex - 1) * Constant.NumberOfProducts);
            ViewBag.ToProductsCount   = Enumerable.Count(ViewBag.UsersProduct);
            ViewBag.SearchResultCount = SearchProductList.Count;
            ViewBag.LowerLimit        = 1;
            int nop         = SearchProductList.Count / Constant.NumberOfProducts;
            int remindernop = SearchProductList.Count % 12;

            if (nop < Constant.NumberOfPages)
            {
                if (remindernop > 0)
                {
                    nop = nop + 1;
                }
                ViewBag.NumberOfPages = nop;
            }
            else
            {
                ViewBag.NumberOfPages = Constant.NumberOfPages;
            }
            var ProductCategory = ProductCatList.Where(x => x.Id.Equals(Id));

            ViewBag.ProductCatList = EncodedCategories.Where(x => x.ParentCatId == ProductCategory.Single().ParentCatId);
            if (!CommonFile.IsParentCategory(Id))
            {
                objmodel.ParentCatId = ProductCategory.Single().ParentCatId;
            }
            else
            {
                objmodel.ParentCatId = ProductCategory.Single().Id;
            }
            objmodel.CategoryName = ProductCategory.Single().Name;
            return(View(objmodel));
        }
Example #12
0
        public ActionResult ProductDetail(string Id)
        {
            long id = 0;
            try
            {
                id = Convert.ToInt64(CommonFile.Decode(Id));
                List<ProductModel> Product = GetProduct(id);
                ProductModel objModel = new ProductModel();
                if (Product != null && Product.Count() > 0)
                {
                    objModel.Id = id;
                    objModel.ProductName = Product[0].ProductName;
                    objModel.ProductCatId = Product[0].ProductCatId;
                    objModel.ProductImage = Product[0].ProductImage;
                    objModel.SellingPrice = Product[0].SellingPrice;
                    objModel.DiscountPrice = Product[0].DiscountPrice;
                    objModel.BusinessId = Product[0].BusinessId;
                    objModel.UserId = Product[0].UserId;
                    objModel.Description = Product[0].Description;
                    objModel.VendorName = Product[0].VendorName;
                    objModel.ProductImages = Product[0].ProductImages;

                    List<ProductImages> ListProductImages = new List<ProductImages>();
                    if (!String.IsNullOrEmpty(objModel.ProductImages))
                    {
                        String[] ProductImages = objModel.ProductImages.Split(',');
                        ListProductImages = GetSelectedProductImages(ProductImages, objModel.ProductImage);
                        ViewBag.ProductImages = ListProductImages;
                    }
                    else
                    {
                        ViewBag.ProductImages = ListProductImages;
                    }
                }
                ViewBag.SimilarProductList = ListAllProduct.Where(x => x.ProductCatId == objModel.ProductCatId).ToList();       //ViewBag for showing similar products in the Product Detail Page

                ViewBag.ProductCatList = CommonFile.GetProductCategory(null);

                var Productlist = ListAllProduct.Where(X => X.Id == id).SingleOrDefault();
                var Menuslist = CommonFile.GetProductCategory(null);
                if (Menuslist != null && Menuslist.Count > 0)
                {
                    foreach (var mlist in Menuslist)
                    {
                        if (mlist.Id == Productlist.ParentCatId)
                        {
                            ViewBag.ParentCatDiscription = mlist.Name;
                            ViewBag.ParentCatId = Productlist.ParentCatId;
                            break;
                        }
                    }
                    foreach (var mlist in Menuslist)
                    {
                        if (mlist.Id == Productlist.ProductCatId)
                        {
                            ViewBag.ProductCatDiscription = mlist.Name;
                            ViewBag.ProductCatId = Productlist.ProductCatId;
                            break;
                        }
                    }
                }
                return View(objModel);
            }
            catch (Exception ex)
            {
                return View("PageNotFound", "Eror");
            }
        }