public ActionResult HopDongChuyenSua(HopDongChuyenModel model, bool continueEditing) { var hopdongchuyen = _hopdongchuyenService.GetChuyenDiHopDongById(model.Id); if (hopdongchuyen == null || hopdongchuyen.TrangThai == ENTrangThaiHopDongChuyen.HUY) { //No manufacturer found with the specified id return(RedirectToAction("ListHopDongChuyen")); } if (ModelState.IsValid) { DateTime _thoigiandonkhach = Convert.ToDateTime(model.ThoiGianDonKhach); model.ThoiGianDonKhach = model.ThoiGianDonKhach.Date.AddHours(model.GioDonKhach.Hour).AddMinutes(model.GioDonKhach.Minute); DateTime _thoigiantrakhach = Convert.ToDateTime(model.ThoiGianTraKhach); model.ThoiGianTraKhach = model.ThoiGianTraKhach.Date.AddHours(model.GioTraKhach.Hour).AddMinutes(model.GioTraKhach.Minute); //update phieu gui hang HopDongChuyenToEntity(hopdongchuyen, model); _hopdongchuyenService.UpdateChuyenDiHopDong(hopdongchuyen); // update hang hoa if (continueEditing) { return(RedirectToAction("HopDongChuyenSua", new { id = hopdongchuyen.Id })); } return(RedirectToAction("ListHopDongChuyen")); } return(View(model)); }
public ActionResult HopDongchuyenTao(HopDongChuyenModel model, bool continueEditing) { if (this.CheckNoAccessIntoNhaXe(_workContext, _permissionService, StandardPermissionProvider.CVHoatDongBanVe)) { return(AccessDeniedView()); } if (ModelState.IsValid) { var _hopdong = new HopDongChuyen(); DateTime _thoigiandonkhach = Convert.ToDateTime(model.ThoiGianDonKhach); model.ThoiGianDonKhach = model.ThoiGianDonKhach.Date.AddHours(model.GioDonKhach.Hour).AddMinutes(model.GioDonKhach.Minute); DateTime _thoigiantrakhach = Convert.ToDateTime(model.ThoiGianTraKhach); model.ThoiGianTraKhach = model.ThoiGianTraKhach.Date.AddHours(model.GioTraKhach.Hour).AddMinutes(model.GioTraKhach.Minute); HopDongChuyenToEntity(_hopdong, model); _hopdong.NgayTao = DateTime.Now; _hopdong.NguoiTaoId = _workContext.CurrentNhanVien.Id; _hopdong.TrangThaiId = (int)ENTrangThaiHopDongChuyen.MOI_DAT; _hopdong.NhaXeId = _workContext.NhaXeId; _hopdongchuyenService.InsertChuyenDiHopDong(_hopdong); SuccessNotification("Thêm mới hợp đồng chuyến thành công"); return(continueEditing ? RedirectToAction("HopDongChuyenSua", new { id = _hopdong.Id }) : RedirectToAction("ListHopDongChuyen")); } return(View(model)); }
public ActionResult HopDongChuyenTao() { if (this.CheckNoAccessIntoNhaXe(_workContext, _permissionService, StandardPermissionProvider.CVHoatDongBanVe)) { return(AccessDeniedView()); } var model = new HopDongChuyenModel(); model.ThoiGianDonKhach = DateTime.Now; model.ThoiGianTraKhach = DateTime.Now; model.GioDonKhach = DateTime.Now; model.GioTraKhach = DateTime.Now; model.HTThanhToans = this.GetCVEnumSelectList <ENHinhThucThanhToan>(_localizationService, model.HinhThucThanhToanId); return(View(model)); }
public static HopDongChuyenModel toModel(this HopDongChuyen e, ILocalizationService localizationService, List <KhachHangChuyen> khachhangs) { var m = new HopDongChuyenModel(); m.Id = e.Id; m.SoHopDong = e.SoHopDong; m.TenHopDong = e.TenHopDong; m.GiaTri = e.GiaTri; m.XeVanChuyenId = e.XeVanChuyenId; m.TenLaiXe = e.XeInfo != null ? e.XeInfo.BienSo : "---------"; m.ThoiGianDonKhach = e.ThoiGianDonKhach.Value; m.ThoiGianTraKhach = e.ThoiGianTraKhach.Value; m.GioDonKhach = m.ThoiGianDonKhach; m.GioTraKhach = m.ThoiGianTraKhach; m.DiemDonKhach = e.DiemDonKhach; m.DiemTraKhach = e.DiemTraKhach; m.LoTrinh = e.LoTrinh; m.ChieuVe = e.ChieuVe; m.NgayTao = e.NgayTao; m.HinhThucThanhToanId = e.HinhThucThanhToanId.GetValueOrDefault(); m.GhiChu = e.GhiChu; m.TrangThaiId = e.TrangThaiId; m.NguoiTaoId = e.NguoiTaoId; m.NguoiTao = e.NguoiTao.HoVaTen; m.NhaXeId = e.NhaXeId; m.LaiXeId = e.LaiXeId.GetValueOrDefault(0); m.TenLaiXe = e.laixe != null ? e.laixe.HoVaTen : ""; m.KmXuat = e.KmXuat; if (khachhangs != null) { foreach (var item in khachhangs) { m.KhachHangs.Add(item.toModel()); } } return(m); }
void HopDongChuyenToEntity(HopDongChuyen e, HopDongChuyenModel model) { e.SoHopDong = model.SoHopDong; e.TenHopDong = model.TenHopDong; e.XeVanChuyenId = model.XeVanChuyenId; e.ThoiGianDonKhach = model.ThoiGianDonKhach; e.ThoiGianTraKhach = model.ThoiGianTraKhach; e.DiemDonKhach = model.DiemDonKhach; e.DiemTraKhach = model.DiemTraKhach; e.GiaTri = model.GiaTri; e.LoTrinh = model.LoTrinh; e.ChieuVe = model.ChieuVe; e.GhiChu = model.GhiChu; e.HinhThucThanhToanId = model.HinhThucThanhToanId; if (model.LaiXeId > 0) { e.LaiXeId = model.LaiXeId; } else { e.LaiXeId = null; } e.KmXuat = model.KmXuat; }