public ActionResult Edit(int id) { var car = new CarDao().ViewDetail(id); SetViewBag(); return(View(car)); }
public ActionResult Detail(int id) { var car = new CarDao().ViewDetail(id); Session.Add("CarDetail", id); return(View(car)); }
// GET: Agency/Car public ActionResult Index(string searchString, int id, int page = 1, int pageSize = 10) { var dao = new CarDao(); var model = dao.ListAllPagingByAgency(searchString, id, page, pageSize); ViewBag.SearchString = searchString; return(View(model)); }
public ActionResult ViewDetail(int id) { var car = new CarDao().ViewDetail(id); ViewBag.carattribute = new CarAttributeDao().ListAll(); ViewBag.carattributedetail = new CarAttributeDetailDao().ListAll(); ViewBag.province = new ProvinceDao().ListAll(); SetViewBag(); return(View(car)); }
/// <summary> /// 绑定下拉控件数据集 /// </summary> public void BindList() { ListIsValid = new CarDao().GetList(); Properties.DataSource = ListIsValid; Properties.DisplayMember = "CarNo"; Properties.ValueMember = "CarID"; Properties.BestFitMode = BestFitMode.BestFitResizePopup; Properties.SearchMode = SearchMode.AutoFilter; Properties.CaseSensitiveSearch = true; Properties.AutoSearchColumnIndex = 2; }
/// <summary> /// 确认保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btnOK_Click(object sender, EventArgs e) { if (textCarNo.EditValue == null) { MessageBox.Show("请输入车牌号"); return; } Car model = new Car { CarNo = textCarNo.Text.Trim(), CarModel = textCarModel.Text.Trim(), CurrentKil = ValueConvert.ToNullableDecimal(textCurrentKil.EditValue), DepartmentID = ValueConvert.ToNullableInt32(cLookDepartment1.EditValue), BuyTime = ValueConvert.ToNullableDateTime(dateBuyTime.EditValue), LicenseCode = textLicenseCode.Text.Trim(), LicenseExpireDate = ValueConvert.ToNullableDateTime(dateLicenseExpireDate.EditValue), EmployeeID = ValueConvert.ToNullableInt32(cLookEmployeeID.EditValue), OwnerID = ValueConvert.ToNullableInt32(cLookOwnerID.EditValue), EngineNumber = textEngineNumber.Text.Trim(), ChassisNumber = textChassisNumber.Text.Trim(), YearCheckExpDate = ValueConvert.ToNullableDateTime(dateYearCheckExpDate.EditValue), OilExpenses = ValueConvert.ToNullableDecimal(textOilExpenses.EditValue), Note = ValueConvert.ToString(memoNote.EditValue), OperateID = Program.CurrentEmployee.EmployeeID, OperateTime = DateTime.Now }; if (!string.IsNullOrEmpty(comStatus.SelectedIndex.ToString())) { model.Status = comStatus.SelectedIndex + 1; } bool result = false; if (FormState == DS.MSClient.FormState.Modify) { model.CarID = curCar.CarID; result = new CarDao().Update(model); } else { model.CarID = new CommonDAO().GetIntUniqueNumber("t_car"); result = new CarDao().Add(model); } if (result) { MessageBox.Show("保存成功"); this.DialogResult = DialogResult.OK; } }
// GET: Home public ActionResult Index(int?province, int page = 1, int pagesize = 6) { if (province != null) { return(RedirectToAction("Index", "FindCar")); } var carDao = new CarDao(); var contentDao = new ContentDao(); ViewBag.NewCars = carDao.ListNewCar(4); ViewBag.ListFeatureCars = carDao.ListFeartureCar(8); ViewBag.ListNewContents = contentDao.ListNewContent(4); ViewBag.province = new ProvinceDao().ListAll(); return(View()); }
public ActionResult Edit(Car car) { if (ModelState.IsValid) { var dao = new CarDao(); var result = dao.Update(car); if (result) { return(RedirectToAction("Index", "Car")); } else { ModelState.AddModelError("", "Cập nhật Xe không thành công"); } } SetViewBag(car.ProvinceId); return(View()); }
public ActionResult Create(Car car) { if (ModelState.IsValid) { var dao = new CarDao(); long id = dao.Insert(car); if (id > 0) { SetAlert("Thêm Xe thành công", "success"); return(RedirectToAction("Index", "Car")); } else { ModelState.AddModelError("", "Thêm Xe không thành công"); } } return(View("Index")); }
// GET: FindCar public ActionResult Index(int?province, string pickup_date, string dropoff_date, int page = 1, int pagesize = 6) { var carDao = new CarDao(); var model = carDao.SearchAll(province, page, pagesize); if (pickup_date != null && dropoff_date != null) { DateTime ngaypickup = Convert.ToDateTime(pickup_date); DateTime ngaydropoff = Convert.ToDateTime(dropoff_date); foreach (var item in model) { var result = new OrderDetailDao().CheckList(item.ID, ngaypickup, ngaydropoff); if (result == 0) { item.Remove(item); } } } ViewBag.ListPriceCars = carDao.ListPriceCar(5); ViewBag.carattribute = new CarAttributeDao().ListAll(); ViewBag.carattributedetail = new CarAttributeDetailDao().ListAll(); ViewBag.province = new ProvinceDao().ListAll(); return(View(model)); }
public CarService() { this.subjectDao = new CarDao(); }