Exemplo n.º 1
0
        private void SetCouponData()
        {
            if (Session["guid"] == null)
            {
                Session.Add("guid", Guid.NewGuid().ToString());
            }

            var pin  = ((string)Session["guid"]);
            var code = 102270;

            if (!TempData.ContainsKey("coupon"))
            {
                TempData.Add("coupon",
                             "http://bricks.coupons.com/enable.asp?o=" + code + "&c=PR&p=" + pin + "&cpt=" +
                             CouponEncode.EncodeCPT(pin, code));
            }
        }
Exemplo n.º 2
0
        public ActionResult Detail(string url)
        {
            if (Session["guid"] == null)
            {
                Session.Add("guid", Guid.NewGuid().ToString());
            }

            var product = db.Products.Where(p => p.Active == true && p.FriendlyUrl == url).FirstOrDefault();

            if (product == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var products   = db.Products.Where(p => p.Active == true && p.ProductCategory.Id == product.ProductCategory.Id).OrderBy(o => o.Title).ToList();
            var detailType = Enum.GetName(typeof(Category.Classifier), product.ProductCategory.Type) + "Detail";
            var index      = products.IndexOf(product);
            var pin        = ((string)Session["guid"]);
            var code       = 1;

            switch (product.ProductCategory.Type)
            {
            case 1:
                if (product.ProductCategory.FriendlyUrl.Contains("dry"))
                {
                    code = 102276;
                }
                else
                {
                    code = 102277;
                }
                break;

            case 2:
                if (product.ProductCategory.FriendlyUrl.Contains("dry"))
                {
                    code = 102270;
                }
                else
                {
                    code = 102275;
                }
                break;

            default:
                code = 102270;
                break;
            }

            if (!TempData.ContainsKey("previous"))
            {
                TempData.Add("previous", products[index == 0 ? products.Count - 1 : index - 1]);
            }

            if (!TempData.ContainsKey("next"))
            {
                TempData.Add("next", products[index + 1 == products.Count ? 0 : index + 1]);
            }

            if (!TempData.ContainsKey("coupon"))
            {
                TempData.Add("coupon", "http://bricks.coupons.com/enable.asp?o=" + code + "&c=PR&p=" + pin + "&cpt=" + CouponEncode.EncodeCPT(pin, code));
            }

            return(View(detailType, product));
        }
Exemplo n.º 3
0
        public ActionResult Info(string type)
        {
            try
            {
                if (Session["guid"] == null)
                {
                    Session.Add("guid", Guid.NewGuid().ToString());
                }

                var classType = (int)Enum.GetValues(typeof(Category.Classifier))
                                .Cast <Category.Classifier>().
                                First(e => e.ToString().ToLower().Equals(type));

                var detailType = Enum.GetName(typeof(Category.Classifier), classType) + "Info";

                var pin  = ((string)Session["guid"]);
                var code = 1;

                switch (classType)
                {
                case 1:
                    code = 102276;
                    break;

                default:
                    code = 102270;
                    break;
                }

                if (!TempData.ContainsKey("coupon"))
                {
                    TempData.Add("coupon", "http://bricks.coupons.com/enable.asp?o=" + code + "&c=PR&p=" + pin + "&cpt=" + CouponEncode.EncodeCPT(pin, code));
                }


                return(View(detailType));
            }
            catch
            {
                return(RedirectToAction("Index", "Home"));
            }
        }