Exemplo n.º 1
0
        public ActionResult Product_Detail(int Id)
        {
            if (HttpContext.Request.Cookies[StaticLicense.LicName + "Factor"] != null)
            {
                string     SSSession = "";
                HttpCookie cookie    = HttpContext.Request.Cookies.Get(StaticLicense.LicName + "Factor");
                if (cookie != null)
                {
                    Encryption ENC = new Encryption();
                    SSSession = ENC.DecryptText(cookie.Value, "OMD_FACTOR");
                    MiniFactorModel   minif  = JsonConvert.DeserializeObject <MiniFactorModel>(SSSession);
                    D_APIModelFiller  dmf    = new D_APIModelFiller();
                    FactorPopUpModel  FPM    = dmf.shoppingCart(minif.Id);
                    FactorMasterModel modell = new FactorMasterModel()
                    {
                        ListOfProducts = FPM,
                        Totality       = minif
                    };
                    ViewBag.factorMasterModel = modell;
                }
                else
                {
                    ViewBag.factorMasterModel = null;
                }
            }
            else
            {
                ViewBag.factorMasterModel = null;
            }

            D_APIModelFiller DMF = new D_APIModelFiller();
            var model            = new ProductDetail_ModelView()
            {
                ProductModel = DMF.SingleProduct(Id, "Ago"),
                Company      = DMF.CompanyCustomers()
            };

            model.RelatedProducts = DMF.ProductList(15, "گروه اصلی", model.ProductModel.SubCatId, 1, "", "Ago");
            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult Product_List(string Type, int Id = 0, int Page = 1, string Search = "", int CustomerId = 0)
        {
            if (HttpContext.Request.Cookies[StaticLicense.LicName + "Factor"] != null)
            {
                string     SSSession = "";
                HttpCookie cookie    = HttpContext.Request.Cookies.Get(StaticLicense.LicName + "Factor");
                if (cookie != null)
                {
                    Encryption ENC = new Encryption();
                    SSSession = ENC.DecryptText(cookie.Value, "OMD_FACTOR");
                    MiniFactorModel   minif  = JsonConvert.DeserializeObject <MiniFactorModel>(SSSession);
                    D_APIModelFiller  dmf    = new D_APIModelFiller();
                    FactorPopUpModel  FPM    = dmf.shoppingCart(minif.Id);
                    FactorMasterModel modell = new FactorMasterModel()
                    {
                        ListOfProducts = FPM,
                        Totality       = minif
                    };
                    ViewBag.factorMasterModel = modell;
                }
                else
                {
                    ViewBag.factorMasterModel = null;
                }
            }
            else
            {
                ViewBag.factorMasterModel = null;
            }
            D_APIModelFiller DMF  = new D_APIModelFiller(4);
            D_APIModelFiller DMF2 = new D_APIModelFiller();
            var model             = new D_ProductList_ModelView()
            {
                Cateqories    = DMF.CategoriesAsTree_OneSub("MainCat", 1),
                NewProducts   = DMF.ChosenProducts("New", 3, "Ago"),
                Sale_Products = DMF.ChosenProducts("Sale", 3, "Ago"),
                ProductsG3    = DMF.ChosenProducts("MainTag", 3, "Ago", 1),
                thisPage      = Page,
                Cat           = Type,
                Search        = Search,
                CatId         = Id
            };

            if (Type == "پرفروش ها")
            {
                model.Products = DMF.ChosenProducts("Sale", 15, "Ago");
                model.Pages    = 1;
            }
            else if (Type == "جدیدترین")
            {
                model.Products = DMF.ChosenProducts("New", 15, "Ago");
                model.Pages    = 1;
            }
            else if (Type == "فروش ویژه")
            {
                model.Products = DMF.ChosenProducts("MainTag", 15, "Ago", 1);
                model.Pages    = 1;
            }
            else if (Type == "علاقه مندی ها")
            {
                model.Products = DMF2.FavoriteProducts(15, Type, Id, Page, Search, "Date", CustomerId);
                model.Pages    = DMF2.ProList_Pages(Type, 15, Id, Search, CustomerId);
            }
            else
            {
                model.Products = DMF2.ProductList(15, Type, Id, Page, Search, "Date");
                model.Pages    = DMF2.ProList_Pages(Type, 15, Id, Search);
            }



            if (Type == "گروه اصلی")
            {
                model.tags = DMF2.ProductTags("Sub", Id);
            }
            else
            {
                model.tags = DMF2.ProductTags("min", 0);
            }
            return(View(model));
        }