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));
        }
예제 #2
0
 public PartialViewResult LazyLoaderProducts(string pageindex)
 {
     long? id = Convert.ToInt64(CommonFile.Decode(pageindex));
     int PageIndex = (int)id;
     string SearchCookieValue = Services.GetCookie(this.HttpContext, "SearchBarCookie").Value;
     dynamic _data = SearchCookieValue;
     var json = JsonConvert.DeserializeObject<Dictionary<string, object>>(_data);
     string SearchBarText = json["SearchBarText"].ToString();
     ViewBag.LazyLoaderProducts = ListAllProduct.Where(x => x.ProductName.ToUpper().Contains(SearchBarText.ToUpper())).ToList().Skip(Constant.NumberOfProducts * PageIndex).Take(Constant.NumberOfProducts);
     ViewBag.PageIndex = PageIndex + 1;
     return PartialView("~/Views/Shared/LazyLoaderProducts.cshtml");
 }
        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));
        }
예제 #4
0
        public ActionResult OrderDetails(string Id)
        {
            long id = Convert.ToInt64(CommonFile.Decode(Id));
            SaleOrderModel objmodel = new SaleOrderModel();
            LoginModel MdUser = Services.GetLoginWebUser(this.ControllerContext.HttpContext, _JwtTokenManager);
            if (MdUser.EmailId != null)
            {
                if (MdUser.Id != 0)
                {
                    objmodel.UserId = Convert.ToInt64(MdUser.Id);
                }
                objmodel.SaleOrderId = id;
                objmodel.Id = id;
                var _request = JsonConvert.SerializeObject(objmodel);
                ResponseModel ObjResponse = CommonFile.GetApiResponse(Constant.ApiGetOrders, _request);
                var Orderdetails = JsonConvert.DeserializeObject<List<SaleOrderModel>>(ObjResponse.Response);

                decimal TotalAmount = 0;
                List<SaleOrderModel> Locallist = new List<SaleOrderModel>();
                foreach (var orders in Orderdetails)
                {
                    TotalAmount = +(orders.Amount * Convert.ToInt32(orders.Quantity)) + (TotalAmount);
                    orders.IProductsTotal = (orders.Amount * Convert.ToInt32(orders.Quantity));
                    Locallist.Add(orders);
                }
                if (TotalAmount >= 500)
                {
                    ViewBag.charges = 0;
                }
                else
                {
                    ViewBag.charges = 50;
                }
                ViewBag.TotalAmount = TotalAmount;
                ViewBag.Orderdetails = Locallist;


                return View(objmodel);
            }
            else
            {
                return RedirectToAction("Index", "WebLogin");
            }
        }
        public PartialViewResult MorePages(long id)
        {
            ProductModel objmodel  = new ProductModel();
            int          pageindex = (int)id;

            ViewBag.PageIndex = pageindex;
            HeaderPartialModel objModel = new HeaderPartialModel();

            if (pageindex % 5 == 0)
            {
                ViewBag.LowerLimit = ((pageindex / 5));
            }
            else
            {
                ViewBag.LowerLimit = ((pageindex / 5) * 5) + 1;
            }

            #region  For binding products in next page


            if (String.IsNullOrWhiteSpace(objModel.SearchBarText))
            {
                if (objModel.ParentCatId == 0)
                {
                    var SearchProductList = new List <ProductModel>();
                    var ProductCatId      = Services.GetCookie(this.HttpContext, "ProductCatId").Value;
                    if (!CommonFile.IsParentCategory(long.Parse(CommonFile.Decode(ProductCatId))))
                    {
                        if (sortedproducts != null)
                        {
                            SearchProductList = sortedproducts;
                        }
                        else
                        {
                            SearchProductList = ListAllProduct.Where(x => x.ProductCatId == long.Parse(CommonFile.Decode(ProductCatId))).ToList();
                        }
                    }
                    else
                    {
                        SearchProductList = ListAllProduct.Where(x => x.ParentCatId == long.Parse(CommonFile.Decode(ProductCatId))).ToList();
                    }
                    ViewBag.UsersProduct      = SearchProductList.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);
                    ViewBag.SearchResultCount = SearchProductList.Count;
                    if ((ViewBag.SearchResultCount / Constant.NumberOfProducts) < (pageindex + 4))
                    {
                        if ((ViewBag.SearchResultCount % Constant.NumberOfProducts) != 0)
                        {
                            ViewBag.NumberOfPages = (ViewBag.SearchResultCount / Constant.NumberOfProducts) + 1;
                        }
                        else
                        {
                            ViewBag.NumberOfPages = (ViewBag.SearchResultCount / Constant.NumberOfProducts);
                        }
                    }
                    else
                    {
                        ViewBag.NumberOfPages = ViewBag.LowerLimit + 4;
                    }
                    ViewBag.ProductsFrom = ((pageindex - 1) * Constant.NumberOfProducts) + 1;
                    string NumberOfPages1     = ViewBag.NumberOfPages.ToString();
                    string LowerLimit1        = ViewBag.LowerLimit.ToString();
                    string SearchResultCount1 = ViewBag.SearchResultCount.ToString();
                    ViewBag.ToProductsCount = Enumerable.Count(ViewBag.UsersProduct);
                    Services.SetCookie(this.ControllerContext.HttpContext, "NumberOfPages", NumberOfPages1);
                    Services.SetCookie(this.ControllerContext.HttpContext, "LowerLimit", LowerLimit1);
                    Services.SetCookie(this.ControllerContext.HttpContext, "SearchResutlCount", SearchResultCount1);
                    return(PartialView("~/Views/ProductCatWise/PartialCatwiseProductValue.cshtml"));
                }
                var SearchListWithCategory = ListAllProduct.Where(x => x.ParentCatId.Equals(objModel.ParentCatId)).ToList();
                ViewBag.UsersProduct      = SearchListWithCategory.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);
                ViewBag.SearchResultCount = SearchListWithCategory.Count;
                if ((ViewBag.SearchResultCount / 10) < (pageindex + 4))
                {
                    ViewBag.NumberOfPages = ViewBag.LowerLimit + ((ViewBag.SearchResultCount - 5) - 1);
                }
                else
                {
                    ViewBag.NumberOfPages = pageindex + 4;
                }
                ViewBag.ProductsFrom    = ((pageindex - 1) * Constant.NumberOfProducts) + 1;
                ViewBag.ToProductsCount = Enumerable.Count(ViewBag.UsersProduct);
                string NumberOfPages2     = ViewBag.NumberOfPages;
                string LowerLimit2        = ViewBag.LowerLimit;
                string SearchResultCount2 = ViewBag.SearchResultCount;
                Services.SetCookie(this.ControllerContext.HttpContext, "NumberOfPages", NumberOfPages2);
                Services.SetCookie(this.ControllerContext.HttpContext, "LowerLimit", LowerLimit2);
                Services.SetCookie(this.ControllerContext.HttpContext, "SearchResutlCount", SearchResultCount2);
                return(PartialView("~/Views/ProductCatWise/PartialCatwiseProductValue.cshtml"));
            }
            if (objModel.ParentCatId == 0)
            {
                var SearchList = ListAllProduct.Where(x => x.ProductName.ToUpper().Contains(objModel.SearchBarText.ToString().ToUpper())).ToList();
                ViewBag.UsersProduct      = SearchList.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);
                ViewBag.SearchResultCount = SearchList.Count;
            }
            else
            {
                var SearchList = ListAllProduct.Where(x => x.ProductName.ToUpper().Contains(objModel.SearchBarText.ToString().ToUpper())).ToList();

                var SearchListWithCategory = SearchList.Where(x => x.ParentCatId.Equals(objModel.ParentCatId)).ToList();
                ViewBag.UsersProduct = SearchListWithCategory.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);

                ViewBag.SearchResultCount = SearchListWithCategory.Count;
            }

            #endregion
            if ((ViewBag.SearchResultCount / 10) < (pageindex + 4))
            {
                ViewBag.NumberOfPages = ViewBag.LowerLimit + ((ViewBag.SearchResultCount - 5) - 1);
            }
            else
            {
                ViewBag.NumberOfPages = pageindex + 4;
            }
            ViewBag.ProductsFrom    = ((pageindex - 1) * Constant.NumberOfProducts) + 1;
            ViewBag.ToProductsCount = Enumerable.Count(ViewBag.UsersProduct);

            string NumberOfPages3     = ViewBag.NumberOfPages;
            string LowerLimit3        = ViewBag.LowerLimit;
            string SearchResultCount3 = ViewBag.SearchResultCount;
            Services.SetCookie(this.ControllerContext.HttpContext, "NumberOfPages", NumberOfPages3);
            Services.SetCookie(this.ControllerContext.HttpContext, "LowerLimit", LowerLimit3);
            Services.SetCookie(this.ControllerContext.HttpContext, "SearchResutlCount", SearchResultCount3);
            return(PartialView("~/Views/ProductCatWise/PartialCatwiseProductValue.cshtml"));
        }
        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));
        }
예제 #8
0
        public ActionResult PreviousPages(string Id)
        {
            long? id = Convert.ToInt64(CommonFile.Decode(Id));
            if (id == 0) { id = 1; }
            int pageindex = (int)id;
            ViewBag.PageIndex = pageindex;
            ViewBag.PageNoactive = id;
            HeaderPartialModel objModel = new HeaderPartialModel();
            if (pageindex % 5 == 0)
            {
                if ((pageindex / 5) == 1)
                { ViewBag.LowerLimit = ((pageindex / 5)); }
                else
                {
                    ViewBag.LowerLimit = pageindex - 5;
                }
            }
            else
            {
                ViewBag.LowerLimit = ((pageindex / 5) * 5) + 1;
            }

            #region  For binding products in next page

            // ListAllProduct = CommonFile.GetProduct();
            if (String.IsNullOrWhiteSpace(objModel.SearchBarText))
            {

                if (objModel.ParentCatId == 0)
                {
                    ViewBag.UsersProduct = ListAllProduct.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);
                    ViewBag.SearchResultCount = ListAllProduct.Count;
                    if ((ViewBag.SearchResultCount / 10) < (pageindex + 4))
                    {
                        ViewBag.NumberOfPages = ViewBag.LowerLimit * 5;
                    }
                    else
                    {
                        ViewBag.NumberOfPages = ViewBag.LowerLimit + 4;
                    }
                    ViewBag.ProductsFrom = ((pageindex - 1) * Constant.NumberOfProducts) + 1;
                    ViewBag.ToProductsCount = Enumerable.Count(ViewBag.UsersProduct);
                    return View("SearchBar");
                }
                var SearchListWithCategory = ListAllProduct.Where(x => x.ParentCatId.Equals(objModel.ParentCatId)).ToList();
                ViewBag.UsersProduct = SearchListWithCategory.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);
                ViewBag.SearchResultCount = SearchListWithCategory.Count;
                if ((ViewBag.SearchResultCount / 10) < (pageindex + 4))
                {
                    ViewBag.NumberOfPages = ViewBag.LowerLimit + ((ViewBag.SearchResultCount - 5) - 1);
                }
                else
                {
                    ViewBag.NumberOfPages = pageindex + 4;
                }
                ViewBag.ProductsFrom = ((pageindex - 1) * Constant.NumberOfProducts) + 1;
                ViewBag.ToProductsCount = Enumerable.Count(ViewBag.UsersProduct);
                return View("SearchBar");
            }
            if (objModel.ParentCatId == 0)
            {
                var SearchList = ListAllProduct.Where(x => x.ProductName.ToUpper().Contains(objModel.SearchBarText.ToString().ToUpper())).ToList();
                ViewBag.UsersProduct = SearchList.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);
                ViewBag.SearchResultCount = SearchList.Count;
            }
            else
            {
                var SearchList = ListAllProduct.Where(x => x.ProductName.ToUpper().Contains(objModel.SearchBarText.ToString().ToUpper())).ToList();

                var SearchListWithCategory = SearchList.Where(x => x.ParentCatId.Equals(objModel.ParentCatId)).ToList();
                ViewBag.UsersProduct = SearchListWithCategory.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);

                ViewBag.SearchResultCount = SearchListWithCategory.Count;
            }

            #endregion
            ViewBag.ProductsFrom = ((pageindex - 1) * Constant.NumberOfProducts) + 1;
            ViewBag.ToProductsCount = Enumerable.Count(ViewBag.UsersProduct);
            return View("SearchBar");
        }
예제 #9
0
        public ActionResult MorePages(string Id)
        {
            long? id = Convert.ToInt64(CommonFile.Decode(Id));
            int pageindex = (int)id;
            ViewBag.PageIndex = pageindex;
            ViewBag.PageNoactive = id;
            HeaderPartialModel objModel = new HeaderPartialModel();
            //HeaderPartialModel objModel = new HeaderPartialModel();
            string SearchCookieValue = Services.GetCookie(this.HttpContext, "SearchBarCookie").Value;
            dynamic _data = SearchCookieValue;
            var json = JsonConvert.DeserializeObject<Dictionary<string, object>>(_data);
            if (json.ContainsKey("ParentCatId"))
            {
                string ParentCatId = json["ParentCatId"].ToString();
                string SearchBarText = json["SearchBarText"].ToString();
                objModel.ParentCatId = long.Parse(ParentCatId);
                objModel.SearchBarText = SearchBarText;
            }
            if (pageindex % 5 == 0)
            {
                ViewBag.LowerLimit = ((pageindex / 5));
            }
            else
            {
                ViewBag.LowerLimit = ((pageindex / 5) * 5) + 1;
            }
            //ViewBag.NumberOfPages = pageindex+4;
            #region  For binding products in next page

            //ListAllProduct = CommonFile.GetProduct();
            if (String.IsNullOrWhiteSpace(objModel.SearchBarText))
            {

                if (objModel.ParentCatId == 0)
                {
                    ViewBag.UsersProduct = ListAllProduct.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);
                    ViewBag.SearchResultCount = ListAllProduct.Count;
                    if ((ViewBag.SearchResultCount / Constant.NumberOfProducts) < (pageindex + 4))
                    {
                        ViewBag.NumberOfPages = (ViewBag.SearchResultCount / Constant.NumberOfProducts);
                    }
                    else
                    {
                        ViewBag.NumberOfPages = ViewBag.LowerLimit + 4;
                    }
                    ViewBag.ProductsFrom = ((pageindex - 1) * Constant.NumberOfProducts) + 1;
                    ViewBag.ToProductsCount = Enumerable.Count(ViewBag.UsersProduct);
                    return View("SearchBar");
                }
                var SearchListWithCategory = ListAllProduct.Where(x => x.ParentCatId.Equals(objModel.ParentCatId)).ToList();
                ViewBag.UsersProduct = SearchListWithCategory.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);
                ViewBag.SearchResultCount = SearchListWithCategory.Count;
                if ((ViewBag.SearchResultCount / Constant.NumberOfProducts) < (pageindex + 4))
                {
                    if ((ViewBag.SearhResultCount % Constant.NumberOfProducts) != 0) { ViewBag.NumberOfPages = (ViewBag.SearchResultCount / Constant.NumberOfProducts) + 1; }
                    else { ViewBag.NumberOfPages = (ViewBag.SearchResultCount / Constant.NumberOfProducts); }
                }
                else
                {
                    ViewBag.NumberOfPages = pageindex + 4;
                }
                ViewBag.ProductsFrom = ((pageindex - 1) * Constant.NumberOfProducts) + 1;
                ViewBag.ToProductsCount = Enumerable.Count(ViewBag.UsersProduct);
                return View("SearchBar");
            }
            if (objModel.ParentCatId == 0)
            {
                var SearchList = ListAllProduct.Where(x => x.ProductName.ToUpper().Contains(objModel.SearchBarText.ToString().ToUpper())).ToList();
                ViewBag.UsersProduct = SearchList.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);
                ViewBag.SearchResultCount = SearchList.Count;
            }
            else
            {
                var SearchList = ListAllProduct.Where(x => x.ProductName.ToUpper().Contains(objModel.SearchBarText.ToString().ToUpper())).ToList();

                var SearchListWithCategory = SearchList.Where(x => x.ParentCatId.Equals(objModel.ParentCatId)).ToList();
                ViewBag.UsersProduct = SearchListWithCategory.Skip((pageindex - 1) * Constant.NumberOfProducts).Take(Constant.NumberOfProducts);

                ViewBag.SearchResultCount = SearchListWithCategory.Count;
            }

            #endregion
            if ((ViewBag.SearchResultCount / Constant.NumberOfProducts) < (pageindex + 4))
            {
                if ((ViewBag.SearhResultCount % Constant.NumberOfProducts) != 0) { ViewBag.NumberOfPages = (ViewBag.SearchResultCount / Constant.NumberOfProducts) + 1; }
                else { ViewBag.NumberOfPages = (ViewBag.SearchResultCount / Constant.NumberOfProducts); }
            }
            else
            {
                ViewBag.NumberOfPages = pageindex + 4;
            }
            ViewBag.ProductsFrom = ((pageindex - 1) * Constant.NumberOfProducts) + 1;
            ViewBag.ToProductsCount = Enumerable.Count(ViewBag.UsersProduct);
            return View("SearchBar");
        }
예제 #10
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");
            }
        }