Example #1
0
        public void CheckRecByLocation()
        {
            couponsEntities ce = new couponsEntities();
            List<Coupon> lst = new List<Coupon>();
            ByPreference bl = new ByPreference("Shopping");
            lst = bl.findCoupons();
            List<Coupon> compareList = ce.Coupons.ToList();
            foreach (Coupon c in compareList)
            {
                if (!c.Category.Name.Equals("Shopping"))
                {
                    compareList.Remove(c);
                }
            }

            Assert.IsTrue(compareList.Count == lst.Count); //check
        }
Example #2
0
        //Sets new Reccomandatin Method to the user
        /*
        protected void btn_SetRecommandation_Click(object sender, EventArgs e)
        {
            string longt = userLongitude.Text;
            string lat = userLatitude.Text;
            string rec = CheckBoxList2.SelectedValue;
            switch(rec)
            {
                case "Location":
                    {
                        IRecommandation loc = new ByLocation();

                        Session["RecommandationSystem"] = new ByLocation();

                        break;
                    }

                case "Category":
                    {
                        Session["RecommandationSystem"] = new ByPreference((string)Session["FavoriteCategory"]);
                        break;
                    }
                case "Combined":
                    {
                        Session["RecommandationSystem"] = new ByCombination((string)Session["FavoriteCategory"]);
                        break;
                    }
            }

        }
         */
        private void setReccomndation()
        {
            string longt = userLongitude.Text;
            string lat = userLatitude.Text;
            Session["Lat"] = lat;
            Session["Long"] = longt;
            string rec = CheckBoxList2.SelectedValue;
            switch(rec)
            {
                case "Location":
                    {
                        //IRecommandation loc = new ByLocation(Convert.ToDouble(longt),Convert.ToDouble(lat));

                        Session["RecommandationSystem"] = new ByLocation(Convert.ToDouble(longt), Convert.ToDouble(lat));

                        break;
                    }

                case "Category":
                    {
                        Session["RecommandationSystem"] = new ByPreference((string)Session["FavoriteCategory"]);
                        break;
                    }
                case "Combined":
                    {
                        Session["RecommandationSystem"] = new ByCombination((string)Session["FavoriteCategory"], Convert.ToDouble(longt), Convert.ToDouble(lat));
                        break;
                    }
            }
        }