Exemplo n.º 1
0
        public ActionResult TypeListByCar(string t, string b, string m, string y)
        {
            string tid = HttpUtility.HtmlEncode(t);
            string bb  = HttpUtility.HtmlEncode(b);
            string mm  = HttpUtility.HtmlEncode(m);
            string yy  = HttpUtility.HtmlEncode(y);

            Cparts_Service.CarBll carBll  = new Cparts_Service.CarBll();
            DAO.CarM carinfo              = carBll.GetModel(bb, mm, yy);
            TypeListByCarViewModel vm     = new TypeListByCarViewModel();
            ProductBll             proBll = new ProductBll();

            if (carinfo != null)
            {
                vm.childenrCate = proBll.GetChildenCateListByType(t, carinfo.id.ToString());
            }
            if (t == "-1")
            {
                CommonModule.CommonBll bll = new CommonModule.CommonBll();
                vm.topCate = bll.GetList();
            }
            vm.parentCate = proBll.GetParentCateListByType(t);
            vm.Carinfo    = carinfo;
            return(View(vm));
        }
Exemplo n.º 2
0
        public ActionResult GetCarList()
        {
            List <Carinfo> cars = new List <Carinfo>();

            Cparts_Service.CarBll carBll  = new Cparts_Service.CarBll();
            List <DAO.CarM>       carList = carBll.GetList();
            List <string>         brand   = carList.GroupBy(m => m.Brand).Select(g => g.Key).ToList();

            foreach (var item in brand)
            {
                List <CarModel> cmList = new List <CarModel>();
                Carinfo         c      = new Carinfo();
                c.brand = item;
                List <string> models = carList.Where(m => m.Brand == item).GroupBy(m => m.Model).Select(g => g.Key).ToList();
                foreach (var i in models)
                {
                    CarModel cm = new CarModel();
                    cm.model = i;
                    //List<string> years = carList.Where(m => m.Brand == item && m.Model == i).Select(g => g.ProYear).ToList();
                    List <string> years = carList.Where(m => m.Brand == item && m.Model == i).OrderByDescending(g => g.ProYear).Select(g => g.ProYear).ToList();
                    cm.year = years;
                    cmList.Add(cm);
                }
                c.models = cmList;
                cars.Add(c);
            }
            return(Json(cars, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public ActionResult List(string id, string b, string m, string y)
        {
            // string tid = HttpUtility.HtmlEncode(t);
            string bb     = HttpUtility.HtmlEncode(b);
            string mm     = HttpUtility.HtmlEncode(m);
            string yy     = HttpUtility.HtmlEncode(y);
            string typeId = HttpUtility.HtmlEncode(id);
            string car    = "";

            if (!string.IsNullOrEmpty(b) && !string.IsNullOrEmpty(m) && !string.IsNullOrEmpty(y))
            {
                Cparts_Service.CarBll carBll = new Cparts_Service.CarBll();
                DAO.CarM carinfo             = carBll.GetModel(bb, mm, yy);
                car = carinfo.id.ToString();
            }

            ProductBll  proList = new ProductBll();
            ProductList list    = proList.GetListByType(typeId, car, null);

            return(View(list));
        }
Exemplo n.º 4
0
        public ActionResult TypeListByCar2(string t, string c)
        {
            string tid = HttpUtility.HtmlEncode(t);

            Cparts_Service.CarBll carBll = new Cparts_Service.CarBll();
            DAO.CarM carinfo             = carBll.GetModel(c);
            // select *  FROM  Parts   where tocars like '%,1,%' and  [state]=1
            TypeListByCarViewModel vm     = new TypeListByCarViewModel();
            ProductBll             proBll = new ProductBll();

            vm.childenrCate = proBll.GetChildenCateListByType(t);
            if (vm.childenrCate != null && vm.childenrCate.Count == 1)
            {
                if (vm.childenrCate[0].ID.ToString() == t)
                {
                    vm.childenrCate = null;
                }
            }
            vm.parentCate = proBll.GetParentCateListByType(t);
            vm.Carinfo    = carinfo;
            return(View("TypeListByCar", vm));
        }
Exemplo n.º 5
0
        public ActionResult cList(string t, string b, string m, string y, string h)
        {
            if (b == "0" && m == "0" && y == "0" && h != "0")
            {
                ProductBll  proList = new ProductBll();
                ProductList list    = proList.GetListByType(t, null, h);

                return(View("~/Views/Product/pList.cshtml", list));
            }
            string tid = HttpUtility.HtmlEncode(t);
            string bb  = HttpUtility.HtmlEncode(b);
            string mm  = HttpUtility.HtmlEncode(m);
            string yy  = HttpUtility.HtmlEncode(y);

            Cparts_Service.CarBll carBll  = new Cparts_Service.CarBll();
            DAO.CarM carinfo              = carBll.GetModel(bb, mm, yy);
            TypeListByCarViewModel vm     = new TypeListByCarViewModel();
            ProductBll             proBll = new ProductBll();

            if (carinfo != null)
            {
                vm.childenrCate = proBll.GetChildenCateListByType(t, carinfo.id.ToString());
            }
            if (vm.childenrCate.Count > 0)
            {
                CommonModule.CommonBll bll = new CommonModule.CommonBll();
                vm.topCate    = bll.GetList();
                vm.parentCate = proBll.GetParentCateListByType(t);
                vm.Carinfo    = carinfo;
                return(View(vm));
            }
            else
            {
                ProductBll  proList = new ProductBll();
                ProductList list    = proList.GetListByType(t, carinfo.id.ToString(), null);
                return(View("~/Views/Product/pList.cshtml", list));
            }
        }