public static string toMoTa(this HistoryXeXuatBen item) { if (item == null) { return(""); } return(string.Format("Tuyến: {3}-{4}; Xe: {0}; Lái xe: {1}; Ngày giờ chạy: {2}", item.xevanchuyen != null? item.xevanchuyen.BienSo:"----", item.ThongTinLaiPhuXe(0, true), item.NgayDi.ToString("dd/MM HH:mm"), item.NguonVeInfo.TenDiemDon, item.NguonVeInfo.TenDiemDen)); }
public static string ToText(this HistoryXeXuatBen item) { if (item == null) { return(""); } return(string.Format("{0}:Hành trình: {1} - {2}, Thời gian đi: {3}", item.Id, item.NguonVeInfo.TenDiemDon, item.NguonVeInfo.TenDiemDen, item.NgayDi.ToString("yyyy-MM-dd HH:mm"))); }
public virtual void UpdateHistoryXeXuatBen(HistoryXeXuatBen _item) { if (_item == null) { throw new ArgumentNullException("NhaXe"); } _historyxexuatbenRepository.Update(_item); }
public static string toMoTa(this HistoryXeXuatBen item) { if (item == null) { return(""); } string hanhtrinh = item.HanhTrinh != null ? item.HanhTrinh.MoTa : "[]"; return(string.Format("Hành trình: {0}; Xe: {1}; Lái: {2};Phụ: {3}; Giờ chạy: {4}", hanhtrinh, item.SoXe, item.LaiXe, item.PhuXe, item.NgayDi.ToString("dd/MM HH:mm"))); }
public static VeXeChuyenDiVeModel toModelVeChuyen(this HistoryXeXuatBen entity, ILocalizationService localizationService) { var model = new VeXeChuyenDiVeModel(); if (entity == null) { return(model); } XeXuatBentoModel(model, entity, localizationService); return(model); }
public static XeXuatBenItemModel toModel(this HistoryXeXuatBen entity, ILocalizationService localizationService) { var model = new XeXuatBenItemModel(); if (entity == null) { return(model); } XeXuatBentoModel(model, entity, localizationService); return(model); }
public static string ThongTinLaiPhuXe(this HistoryXeXuatBen item, int So = 0) { if (item == null) { return(""); } if (item.LaiPhuXes.Count > So) { return(item.LaiPhuXes.ElementAt(So).nhanvien.ThongTin(false)); } return(""); }
static void XeXuatBentoModel(XeXuatBenItemModel model, HistoryXeXuatBen entity, ILocalizationService localizationService) { model.Id = entity.Id; model.NguonVeId = entity.NguonVeId; model.XeVanChuyenId = entity.XeVanChuyenId; if (entity.xevanchuyen != null) { model.BienSo = entity.xevanchuyen.BienSo; } model.TrangThai = entity.TrangThai; model.TrangThaiText = entity.TrangThai.ToCVEnumText(localizationService); model.NgayDi = entity.NgayDi; model.SoNguoi = 0; model.NgayTao = entity.NgayTao; model.NguoiTaoId = entity.NguoiTaoId; if (entity.NguoiTao != null) { model.TenNguoiTao = entity.NguoiTao.HoVaTen; } model.GhiChu = entity.GhiChu; model.HanhTrinhId = entity.HanhTrinhId; if (entity.NguonVeInfo != null) { model.TuyenXeChay = entity.NguonVeInfo.GetHanhTrinh(); model.GioDi = entity.NguonVeInfo.ThoiGianDi.ToString("HH:mm"); model.GioDen = entity.NguonVeInfo.ThoiGianDen.ToString("HH:mm"); } model.laivaphuxes = entity.LaiPhuXes.Select(c => { return(new XeXuatBenItemModel.NhanVienLaiPhuXe(c.NhanVien_Id, c.nhanvien.ThongTin())); }).ToList(); model.nhatkys = entity.NhatKys.Select(c => { var item = new XeXuatBenItemModel.NhatKyXeXuatBen(); item.Id = c.Id; item.NgayTao = c.NgayTao; item.NguoiTaoId = c.NguoiTaoId; if (c.NguoiTao != null) { item.TenNguoiTao = c.NguoiTao.HoVaTen; } item.GhiChu = c.GhiChu; return(item); }).ToList(); //khong dc edit if (model.TrangThai == ENTrangThaiXeXuatBen.KET_THUC || model.TrangThai == ENTrangThaiXeXuatBen.HUY) { model.isEdit = false; } }
public virtual void InsertHistoryXeXuatBen(HistoryXeXuatBen _item) { if (_item == null) { throw new ArgumentNullException("NhaXe"); } _historyxexuatbenRepository.Insert(_item); var _log = new HistoryXeXuatBenLog(); _log.XeXuatBenId = _item.Id; _log.TrangThai = _item.TrangThai; _log.GhiChu = "Thiết đặt xe xuất bến"; _log.NguoiTaoId = _item.NguoiTaoId; InsertHistoryXeXuatBenLog(_log); }
string isAuthentication(int NhaXeId, int CustomerId, string apiToken, int XeXuatBenId) { string _isauthen = isAuthentication(NhaXeId, CustomerId, apiToken); if (!String.IsNullOrEmpty(_isauthen)) { return(_isauthen); } xexuatben = _nhaxeService.GetHistoryXeXuatBenId(XeXuatBenId); if (xexuatben == null) { return("Không tồn tại thông tin xe xuất bến"); } if (xexuatben.NguonVeInfo.NhaXeId != NhaXeId) { return("Xe xuất bến không thuộc nhà xe"); } return(String.Empty); }
public static string ThongTinLaiPhuXe(this HistoryXeXuatBen item, int So = 0, bool isHoVaTen = false) { if (item == null) { return(""); } if (item.LaiPhuXes.Count > So) { if (!isHoVaTen) { return(item.LaiPhuXes.OrderBy(c => c.KieuNhanVienID).ElementAt(So).nhanvien.ThongTin(false)); } else { return(item.LaiPhuXes.OrderBy(c => c.KieuNhanVienID).ElementAt(So).nhanvien.HoVaTen); } } return(""); }
public static string ThongTinLaiPhuXes(this HistoryXeXuatBen item, string ngancach = "; ") { if (item == null) { return(""); } var ret = ""; foreach (var nv in item.LaiPhuXes.OrderBy(c => c.KieuNhanVienID)) { if (string.IsNullOrEmpty(ret)) { ret = nv.nhanvien.HoVaTen; } else { ret = ret + ngancach + nv.nhanvien.HoVaTen; } } return(ret); }
public static string ThongTinLaiPhuXes(this HistoryXeXuatBen item, string ngancach = "; ") { if (item == null) { return(""); } var ret = ""; foreach (var nv in item.LaiPhuXes) { if (string.IsNullOrEmpty(ret)) { ret = nv.nhanvien.ThongTin(false); } else { ret = ret + ngancach + nv.nhanvien.ThongTin(false); } } return(ret); }
public static string toMoTa(this HistoryXeXuatBen item) { if (item == null) { return(""); } string bienso = ""; string diemden = ""; string diemdon = ""; if (item.xevanchuyen != null) { bienso = item.xevanchuyen.BienSo; } if (item.NguonVeInfo != null) { diemdon = item.NguonVeInfo.TenDiemDon; diemden = item.NguonVeInfo.TenDiemDen; } return(string.Format("Tuyến: {3}-{4}; Xe: {0}; Lái xe: {1}; Giờ chạy: {2}", bienso, item.ThongTinLaiPhuXe(0, true), item.NgayDi.ToString("dd/MM/yyyy HH:mm"), diemdon, diemden)); }
static void XeXuatBentoModel(XeXuatBenItemModel model, HistoryXeXuatBen entity, ILocalizationService localizationService) { model.Id = entity.Id; model.NguonVeId = entity.NguonVeId; model.XeVanChuyenId = entity.XeVanChuyenId.GetValueOrDefault(0); if (entity.xevanchuyen != null) { model.BienSo = entity.xevanchuyen.BienSo; } else { model.BienSo = "----"; } model.TrangThai = entity.TrangThai; model.TrangThaiText = entity.TrangThai.ToCVEnumText(localizationService); model.NgayDi = entity.NgayDi; model.SoNguoi = entity.SoNguoi; model.SoGhe = entity.NguonVeInfo.LichTrinhInfo.loaixeinfo.sodoghe.SoLuongGhe; model.NgayTao = entity.NgayTao; model.NguoiTaoId = entity.NguoiTaoId; if (entity.NguoiTao != null) { model.TenNguoiTao = entity.NguoiTao.HoVaTen; } model.GhiChu = entity.GhiChu; model.HanhTrinhId = entity.HanhTrinhId; if (model.BienSo.Length >= 4) { model.BienSoXe3So = model.BienSo.Substring(model.BienSo.Length - 4); } else { model.BienSoXe3So = "----"; } if (entity.NguonVeInfo != null) { model.TuyenXeChay = entity.NguonVeInfo.GetHanhTrinh(); model.GioDi = entity.NgayDi.ToString("HH:mm"); model.GioDen = entity.NgayDi.AddHours(4).ToString("HH:mm"); } model.laivaphuxes = entity.LaiPhuXes.Select(c => { return(new XeXuatBenItemModel.NhanVienLaiPhuXe(c.NhanVien_Id, c.nhanvien.HoVaTen)); }).ToList(); if (model.laivaphuxes.Count > 0) { model.LaiXeId = model.laivaphuxes[0].Id; model.TenLaiXe = model.laivaphuxes[0].TenLaiXe; if (model.laivaphuxes.Count > 1) { model.NTVId = model.laivaphuxes[1].Id; model.TenNTV = model.laivaphuxes[1].TenLaiXe; } } model.ThongTinLaiPhuXe = entity.ThongTinLaiPhuXes(); if (string.IsNullOrEmpty(model.ThongTinLaiPhuXe)) { model.ThongTinLaiPhuXe = "---------"; } if (model.laivaphuxes.Count > 1) { model.PhuXeId = model.laivaphuxes[1].Id; } model.nhatkys = entity.NhatKys.Select(c => { var item = new XeXuatBenItemModel.NhatKyXeXuatBen(); item.Id = c.Id; item.NgayTao = c.NgayTao; item.NguoiTaoId = c.NguoiTaoId; if (c.NguoiTao != null) { item.TenNguoiTao = c.NguoiTao.HoVaTen; } item.GhiChu = c.GhiChu; return(item); }).ToList(); //khong dc edit if (model.TrangThai == ENTrangThaiXeXuatBen.KET_THUC || model.TrangThai == ENTrangThaiXeXuatBen.HUY) { model.isEdit = false; } }
public ActionResult ChotKhach(int NhaXeId, int XeXuatBenId, string Email, string Password, int slpm, int sltt, string Latitude, string Longitude, string VitriChot, string apiToken) { var loginresult = _customerRegistrationService.ValidateCustomer(Email, Password); if (loginresult != CustomerLoginResults.Successful) { return(ErrorOccured("Tài khoản hoặc mật khẩu không đúng !")); } var tkchot = _customerService.GetCustomerByEmail(Email); //luu nhat ky _customerActivityService.InsertActivity("PublicStore.Login", "Tài khoản nhà xe đăng nhập để chốt khách", tkchot); //lay thong tin van phong var nhanvienchot = _nhanvienService.GetByCustomerId(tkchot.Id); if (nhanvienchot == null) { return(ErrorOccured("Thông tin người chốt không hợp lệ")); } if (!nhanvienchot.DiemDonId.HasValue) { return(ErrorOccured("Thông tin người chốt không hợp lệ")); } xexuatben = _nhaxeService.GetHistoryXeXuatBenId(XeXuatBenId); if (xexuatben == null) { return(ErrorOccured("Không tồn tại thông tin xe xuất bến")); } if (xexuatben.NguonVeInfo.NhaXeId != NhaXeId) { return(ErrorOccured("Xe xuất bến không thuộc nhà xe")); } //thuc hien thong tin chot khach //kiem tra co thong tin chot trc chua var lschotkhach = _nhaxeService.GetChotKhachs(NhaXeId, HistoryXeXuatBenId: XeXuatBenId); var itemck = new ChotKhach(); if (lschotkhach.Count > 0) { itemck = lschotkhach.FirstOrDefault(); } itemck.SoLuongThucTe = sltt; itemck.SoLuongPhanMem = slpm; itemck.NguoiChotId = nhanvienchot.Id; itemck.DiemDonId = nhanvienchot.DiemDonId.Value; itemck.NgayChot = DateTime.Now; itemck.NhaXeId = NhaXeId; itemck.HistoryXeXuatBenId = xexuatben.Id; itemck.Latitude = Convert.ToDecimal(Latitude) / 1000000000m; itemck.Longitude = Convert.ToDecimal(Longitude) / 1000000000m; itemck.ViTriChot = VitriChot; if (itemck.Id > 0) { _nhaxeService.UpdateChotKhach(itemck); } else { _nhaxeService.InsertChotKhach(itemck); } itemck = _nhaxeService.GetChotKhachById(itemck.Id); string ghichu = string.Format("Chốt khách tại {0} : SL khách thực tế/phần mềm: {1}/{2}; người chốt: {3}", itemck.diemchot.TenDiemDon, sltt, slpm, nhanvienchot.HoVaTen); var item = CreateHistoryXeXuatBenLog(xexuatben.TrangThai, ghichu, XeXuatBenId, nhanvienchot.Id); var nhatkyinfo = new { Id = item.Id, NgayTao = item.NgayTao.toStringDateTime(), GhiChu = item.GhiChu }; return(Successful(nhatkyinfo)); }