Beispiel #1
0
        //public void WriteCookie()
        //{
        //    var a = new Hyalcore("http://192.168.0.102:4567");
        //    var test= a.GetMostViewByCategory();
        //    Random r = new Random();
        //    int n = r.Next(1, 100000);
        //    if (!System.Web.HttpContext.Current.Request.Cookies.AllKeys.Contains("DinentiComHyalCore"))
        //    {
        //        HttpCookie myCookie = new HttpCookie("DinentiComHyalCore");
        //        DateTime now = DateTime.Now;
        //        // Set the cookie value.
        //        myCookie.Value = n.ToString();
        //        // Set the cookie expiration date.
        //        myCookie.Expires = now.AddYears(1);
        //        // Add the cookie.
        //        System.Web.HttpContext.Current.Response.Cookies.Add(myCookie);
        //    }
        //}
        public ActionResult Index()
        {
            Cookies.WriteCookie();
            var cookie = System.Web.HttpContext.Current.Request.Cookies["DinentiComHyalCore"];
            String userId = "NoUSER";
            if (!String.IsNullOrEmpty(cookie.Value))
                userId = cookie.Value;
            else
                userId = cookie.Value;

            //var hyRecommendation= new Hyalcore("http://162.243.105.143:9293").GetRecommendation("/recommendation?api_key=bd54a9bce84f7b6db6d1fa3b3a76e241&user_id=NOUser&section_code=home");
            IEnumerable<string> recommendation;
            string recommendationId = String.Empty;
            recommendation = new List<string>() { "7292", "7236", "7277", "7245", "7266" };

            //recommendation = new List<string>() { "7083", "7073", "7037", "7046", "7013" };
            //if (hyRecommendation == null || !hyRecommendation.data.Any())
            //{
            //    recommendation = new List<string>() { "7083", "7073", "7037", "7046", "7013" };
            //} else {
            //    recommendation = hyRecommendation.data;
            //}
            //if (hyRecommendation != null &&  hyRecommendation.metadata != null)
            //{
            //    recommendationId = hyRecommendation.metadata.recommendation_id;
            //}

            var list = new ClouthManager().FindAll().Where(x => recommendation.Contains(x.Id.ToString())).Select(x => new MvcApplication2.Models.HyalcoreClouth { Clouth = x, RecommendationId = recommendationId }).ToList();
            ViewBag.Message = ResourceHome.WelcomeTitle;
            return View(list);
        }
Beispiel #2
0
        public void ReportItems(string key)
        {
            if (String.Compare(key,validKey)!=0)
            {
                return;
            }

            var list= new ClouthManager().FindAll();
            int i=0;
            int errors = 0;
            foreach (var item in list)
            {
                var formData = String.Format("id={0}&api_key={1}&active=true&model_attributes[][name]=category&model_attributes[][type_name]=array&model_attributes[][value]=[{2},{3}]&model_attributes[][name]=Description&model_attributes[][type_name]=string&model_attributes[][value]={4}", item.Id.ToString(), apikey, item.getCategory(), item.getSubCategory(), item.Description);
                //var aaa2 = new {
                //    id=item.Id,
                //    api_key = apikey,
                //    model_attributes = array
                //};
                //var aux2 = new JavaScriptSerializer().Serialize(aaa2);
                try
                {
                    //hyalcore.Post("items", formData);
                    i++;
                }
                catch (Exception e)
                {
                    errors++;
                    var ex = e;
                    //throw;
                }

            }
        }
Beispiel #3
0
        public ActionResult CamperasBuzos()
        {
            ViewBag.TitleName = "Camperas Buzos y Chalecos para nenas";
            var list = new ClouthManager()
                .FindAll()
                .Where(x => x.Category == Clouth.CATEGORY.NENA)
                .Where(x => x.SubCategory == Clouth.SUBCATEGORY.CAMPERAS || x.SubCategory == Clouth.SUBCATEGORY.CHALECOS || x.SubCategory == Clouth.SUBCATEGORY.BUZOS)
                .OrderBy(x => x.ShortDescription)
                .ToList();

            return View("todos", list);
        }
Beispiel #4
0
        public ActionResult All()
        {
            Cookies.WriteCookie();
            ViewBag.TitleName = "Mini bebes";
            var list = new ClouthManager()
                            .FindAll()
                            .Where(x => x.Category == Clouth.CATEGORY.MINIBEBES)
                            .OrderBy(x => x.ShortDescription)
                            .ToList();

            return View("todos", list);
        }
Beispiel #5
0
        public ActionResult remerascamisas()
        {
            Cookies.WriteCookie();
            ViewBag.TitleName = "Remeras y camisas para varones";
            var list = new ClouthManager()
                            .FindAll()
                            .Where(x => x.Category == Clouth.CATEGORY.VARON)
                            .Where(x => x.SubCategory == Clouth.SUBCATEGORY.REMERAS || x.SubCategory == Clouth.SUBCATEGORY.CAMISAS)
                            .OrderBy(x => x.ShortDescription)
                            .ToList();

            return View("todos", list);
        }
Beispiel #6
0
        public ActionResult PantalonesShorts()
        {
            Cookies.WriteCookie();
            ViewBag.TitleName = "Pantalones para varones";
            var list = new ClouthManager()
                        .FindAll()
                        .Where(x => x.Category == Clouth.CATEGORY.VARON)
                        .Where(x => x.SubCategory == Clouth.SUBCATEGORY.PANTALON || x.SubCategory == Clouth.SUBCATEGORY.SHORT)
                        .OrderBy(x => x.ShortDescription)
                        .ToList();

            return View("todos", list);
        }
Beispiel #7
0
        public ActionResult buzoscamperas()
        {
            Cookies.WriteCookie();
            ViewBag.TitleName = "Buzos camperas y chalecos para varones";
            var list = new ClouthManager()
                        .FindAll()
                        .Where(x => x.Category == Clouth.CATEGORY.VARON)
                        .Where(x => x.SubCategory == Clouth.SUBCATEGORY.BUZOS || x.SubCategory == Clouth.SUBCATEGORY.CAMPERAS || x.SubCategory == Clouth.SUBCATEGORY.CHALECOS)
                        .OrderBy(x => x.ShortDescription)
                        .ToList();

            return View("todos", list);
        }
Beispiel #8
0
        public ActionResult pantalones()
        {
            Cookies.WriteCookie();
            ViewBag.TitleName = "Pantalones y Jardineros para bebes";
            var list = new ClouthManager()
                            .FindAll()
                            .Where(x => x.Category == Clouth.CATEGORY.BEBES)
                            .Where(x => x.SubCategory == Clouth.SUBCATEGORY.PANTALON)
                            .OrderBy(x => x.ShortDescription)
                            .ToList();

            return View("todos",list);
        }
Beispiel #9
0
        public ActionResult camperas()
        {
            Cookies.WriteCookie();
            ViewBag.TitleName = "Camperas y Buzos para bebes";
            var list = new ClouthManager()
                            .FindAll()
                            .Where(x => x.Category == Clouth.CATEGORY.BEBES)
                            .Where(x => x.SubCategory == Clouth.SUBCATEGORY.CAMPERAS )
                            .OrderBy(x => x.ShortDescription)
                            .ToList();

            return View("todos", list);
        }
Beispiel #10
0
        public ActionResult vestidos()
        {
            Cookies.WriteCookie();
            ViewBag.TitleName = "Vestidos para nenas";
            var list = new ClouthManager()
                .FindAll()
                .Where(x => x.Category == Clouth.CATEGORY.NENA)
                .Where(x => x.SubCategory == Clouth.SUBCATEGORY.VESTIDOS)
                .OrderBy(x => x.ShortDescription)
                .ToList();

            return View("todos", list);
        }