public Model.VO.CarVO GetCarsByCustID(int custID) { CarData carData = new CarData(); CarVO carVO = new CarVO(); CarPO carPO = carData.GetCarsByCustID(custID); carVO = Mapper.Map<CarPO, CarVO>(carPO); return carVO; }
/// <summary> /// 添加客户提交 /// </summary> /// <param name="cusandcar"></param> /// <returns></returns> public JsonResult AddCustomerSub(CustomerAndCar cusandcar) { ICustomerMgm customerMgm = new CustomerMgm(); ICarMgm carMgm = new CarMgm(); CustomerVO customer = new CustomerVO() { Name = cusandcar.Name, Sex = cusandcar.Sex, ICNo = cusandcar.ICNo, Birthday = cusandcar.Birthday, MobileNO = cusandcar.MobileNo, CreatorID = Emp.UserName, LastModifierID = Emp.UserName, CreatedDate = DateTime.Now, LastModifiedDate = DateTime.Now, }; CarVO car = new CarVO() { CarNo = cusandcar.Carno, Brand = cusandcar.Brand, CarModel = cusandcar.Carmodel, Capacity = cusandcar.Capacity, Color = cusandcar.Color, FrameNo = cusandcar.FrameNo, EngineNo = cusandcar.EngineNo, MaintainKM = cusandcar.Maintainkm, InsureDate = cusandcar.Insuredate, ASDate = cusandcar.Asdate, CreatorID = Emp.UserName, LastModifierID = Emp.UserName, CreatedDate = DateTime.Now, LastModifiedDate = DateTime.Now, }; ReturnedData data = new ReturnedData(); try { car.CustomerID = customerMgm.AddAllCustomer(customer, car); //carMgm.AddCar(car); data.Message = "客户添加成功"; data.Success = true; } catch (Exception ex) { data.Success = false; data.Message = "客户添加失败"; data.Error = ex.ToString(); } return Json(data, JsonRequestBehavior.AllowGet); }
public int AddAllCustomer(CustomerVO cust, CarVO car) { CustomerData customerData = new CustomerData(); var result = customerData.AddAllCustomer(Mapper.Map<CustomerVO, CustomerPO>(cust), Mapper.Map<CarVO, CarPO>(car)); if (result <= 0) { throw new Exception("添加出现错误"); } return result; }
/// <summary> /// 汽车修改提交 /// </summary> /// <param name="car"></param> /// <returns></returns> public JsonResult CarEdiSub(CarVO car) { ICarMgm carMgm = new CarMgm(); ReturnedData data = new ReturnedData(); try { car.LastModifierID = Emp.UserName; car.LastModifiedDate = DateTime.Now; carMgm.EditCar(car); data.Message = "车辆信息修改成功"; data.Success = true; } catch (Exception ex) { data.Success = false; data.Message = "车辆信息修改失败"; data.Error = ex.ToString(); } return Json(data, JsonRequestBehavior.AllowGet); }
/// <summary> /// 模型转换 /// </summary> /// <param name="customer"></param> /// <param name="car"></param> /// <returns></returns> private CustomerAndCar GetcusAndcarObj(CustomerVO customer, CarVO car) { CustomerAndCar cusandcar = new CustomerAndCar(); cusandcar.Customerid = customer.CustomerID; cusandcar.Name = customer.Name; cusandcar.Sex = customer.Sex; cusandcar.ICNo = customer.ICNo; cusandcar.Birthday = customer.Birthday; cusandcar.Carno = car.CarNo; cusandcar.Brand = car.Brand; cusandcar.Carmodel = car.CarModel; cusandcar.Capacity = car.Capacity; cusandcar.Color = car.Color; cusandcar.FrameNo = car.FrameNo; cusandcar.EngineNo = car.EngineNo; cusandcar.Maintainkm = car.MaintainKM; cusandcar.Insuredate = car.InsureDate; cusandcar.Asdate = car.ASDate; cusandcar.MobileNo = customer.MobileNO; cusandcar.Carid = car.CarID; return cusandcar; }
/// <summary> /// 汽车信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult CusCarinfo(int id) { ////CarVO car = new CarVO(); ICarMgm carmgm = new CarMgm(); var result = carmgm.GetCarsByCustID(id); var car = new CarVO(); if (result.Count>0) { car = result.FirstOrDefault(); } car.CustomerID = id; return View(car); }
public int AddAllCustomer(CustomerVO customer, CarVO car) { throw new NotImplementedException(); }
public bool EditCustomer(CustomerVO cust, CarVO car) { throw new NotImplementedException(); }