Пример #1
0
        public List <tblSubCategories> GetTblSubCategoriesList()
        {
            Itlize_Project_1Entities db            = new Itlize_Project_1Entities();
            List <tblSubCategories>  subcategories = db.tblSubCategories.ToList();

            return(subcategories);
        }
Пример #2
0
        public JsonResult AutoComplete(string prefix, string filterId)
        {
            Itlize_Project_1Entities db = new Itlize_Project_1Entities();
            List <tblSubCategories>  filteredSubCategoryList;

            if (filterId == "Category")
            {
                filteredSubCategoryList = db.tblSubCategories.ToList();
            }
            else
            {
                filteredSubCategoryList = db.tblSubCategories.Where(x => x.Category_ID == filterId).ToList();
            }



            Itlize_Project_1Entities entities = new Itlize_Project_1Entities();
            var suggestions = (from suggestion in filteredSubCategoryList
                               where suggestion.SubCategory_Name.StartsWith(prefix)
                               select new
            {
                label = suggestion.SubCategory_Name,
                val = suggestion.SubCategory_ID
            }).ToList();

            return(Json(suggestions));
        }
Пример #3
0
        public ActionResult Products(string CategoryId, string SubCategoryId, string initialPageLoader)
        {
            ProductRepo product = new ProductRepo(new Itlize_Project_1Entities());

            Itlize_Project_1Entities result = new Itlize_Project_1Entities();

            ViewData["CategoryId"]    = CategoryId;
            ViewData["SubCategoryId"] = SubCategoryId;

            //-------------------------------------------------------------------------------------------
            //case 1 = when user select nothing
            //(categoryid == category)
            //-------------------------------------------------------------------------------------------            //case 2 = when user only selct category
            //pass category id and output all in the category
            //-------------------------------------------------------------------------------------------
            //case 3 = when user only search
            // pass product with its categoryid and show all products in the category
            //-------------------------------------------------------------------------------------------
            //case 4 = normal search
            // find products belong to these categoryid and subcategoryId
            //and make a list of it
            // then pass to view in viewbag


            ViewData["initialPageLoader"] = initialPageLoader;

            List <Product> items;

            ViewBag.initialOutput = result.tblProducts.Where(x => x.SubCategory_ID == SubCategoryId).ToList();
            //this gets list of



            return(View());
        }
Пример #4
0
        public ActionResult GetFilteredSubCategories(string categoryId)
        {
            Itlize_Project_1Entities db = new Itlize_Project_1Entities();
            //int num = Int32.Parse(categoryId);
            List <tblSubCategories> filteredSubCategoryList;

            filteredSubCategoryList = db.tblSubCategories.Where(x => x.Category_ID == categoryId).ToList();

            ViewBag.SubOptions = new SelectList(filteredSubCategoryList, "SubCategory_ID", "SubCategory_Name");
            return(PartialView("SubOptionPartial"));
        }
Пример #5
0
        public ActionResult ProductResult(string Cate, string SubC,

                                          string AirFlowAmount1, string AirFlowAmount2,
                                          string MaxPowerAmount1, string MaxPowerAmount2,
                                          string MaxSoundAmount1, string MaxSoundAmount2,
                                          string FanAmount1, string FanAmount2,
                                          string HeightAmount1, string HeightAmount2,
                                          string FirmAmount1, string FirmAmount2,
                                          string GlobalAmount1, string GlobalAmount2
                                          )
        {
            IDictionary <string, int> dict = new Dictionary <string, int>();

            List <string>             idList = new List <string>();
            Itlize_Project_1Entities  result = new Itlize_Project_1Entities();
            List <Product>            items;
            List <tblTechSpecFilters> after_Tech_Spec = result.tblTechSpecFilters.ToList();


            // filter airflow
            foreach (tblTechSpecFilters tem in result.tblTechSpecFilters)
            {
                Console.WriteLine(tem.Property_ID, tem.SubCategory_ID, tem.Min_Value, tem.Max_Value);
                //to do
                // Subc == tem.Category_ID
                // tblTechSpecFilters.Property_ID ==1

                if (!dict.ContainsKey(tem.SubCategory_ID))
                {
                    dict[tem.SubCategory_ID] = 1;
                }
                else
                {
                    dict[tem.SubCategory_ID] += 1;
                }
            }

            //ViewBag.initialOutput = result.tblProducts.Where(x => x.SubCategory_ID == SubCategoryId).ToList();


            ViewBag.AirFlowAmount1 = AirFlowAmount1;
            ViewBag.AirFlowAmount2 = AirFlowAmount2;

            ViewBag.MaxPowerAmount1 = MaxPowerAmount1;
            ViewBag.MaxPowerAmount2 = MaxPowerAmount2;

            ViewBag.MaxSoundAmount1 = MaxSoundAmount1;
            ViewBag.MaxSoundAmount2 = MaxSoundAmount2;

            ViewBag.FanAmount1 = FanAmount1;
            ViewBag.FanAmount2 = FanAmount2;

            ViewBag.HeightAmount1 = HeightAmount1;
            ViewBag.HeightAmount2 = HeightAmount2;

            ViewBag.FirmAmount1 = FirmAmount1;
            ViewBag.FirmAmount2 = FirmAmount2;

            ViewBag.GlobalAmount1 = GlobalAmount1;
            ViewBag.GlobalAmount2 = GlobalAmount2;


            return(PartialView("ProductResult"));
        }