Esempio n. 1
0
        public DAO.CarM GetModel(string id)
        {
            string sql = "select * from CarM where id={0} ";

            DAO.CarM m = db.Database.SqlQuery <DAO.CarM>(string.Format(sql, id)).FirstOrDefault();
            return(m);
        }
Esempio n. 2
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));
        }
Esempio n. 3
0
        public DAO.CarM GetModel(string brand, string model, string year)
        {
            string sql = "select * from CarM where Brand='{0}' and Model='{1}' and  ProYear='{2}' ";

            DAO.CarM m = db.Database.SqlQuery <DAO.CarM>(string.Format(sql, brand, model, year)).FirstOrDefault();
            return(m);
        }
Esempio n. 4
0
        /// <summary>
        /// 增加一条汽车记录
        /// </summary>
        /// <param name="car">汽车实体</param>
        /// <returns></returns>
        public bool AddCar(DAO.CarM car)
        {
            db.CarM.Add(car);
            int i = db.SaveChanges();

            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
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));
        }
Esempio n. 6
0
        /// <summary>
        /// 修改汽车
        /// </summary>
        /// <param name="car"></param>
        /// <returns></returns>
        public bool updateCar(DAO.CarM car)
        {
            DAO.CarM c = db.CarM.Where(m => m.id == car.id).FirstOrDefault();
            c.Model           = car.Model;
            c.Oil             = car.Oil;
            c.ProYear         = car.ProYear;
            c.State           = car.State;
            c.Brand           = car.Brand;
            c.Engine          = car.Engine;
            db.Entry(c).State = System.Data.EntityState.Modified;
            int result = db.SaveChanges();

            if (result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 7
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));
            }
        }