public PartialViewResult _CancelledByCustomerList(ReservationSC reservationSC, int?page = 1, int?pageSize = 10) { var Model = new PaginationResult <ReservationVM>(); if (page.GetValueOrDefault() == 0) { page = 1; } if (pageSize.GetValueOrDefault() == 0) { pageSize = 20; } reservationSC.ReservationStatusId = (int)SixtCancellationStatusEnum.CancelledByCustomer; if (reservationSC.ActionStepId == 5) //assign to me { reservationSC.AssignedToId = LoggedUserId; } try { var result = unitOfWork.VReservationListBL.GetAllReservations(reservationSC, page, pageSize); Model.Page = result.Page; Model.PageSize = result.PageSize; Model.Total = result.Total; Model.Items = result.Items.Select(r => new ReservationVM(r)).ToList(); return(PartialView(Model)); } catch (Exception e) { return(PartialView(null)); } }
private List <VReservationListModel> SearchCBySixt(ReservationSC reservationSC) { if (reservationSC.ActionStepId == 11) { reservationSC.AssignedToId = LoggedUserId; } reservationSC.ReservationStatusId = (int)SixtCancellationStatusEnum.CancelledBySixt; var model = unitOfWork.VReservationListBL.GetAllReservationsCancelBySixt(reservationSC); // var model = unitOfWork.ReservationBL.GetReservationWithDetails(reservationSC).Select(r => new ReservationVM(r)).ToArray(); return(model); }
public IActionResult NoShowDetails(int id) { ReservationSC reservationSC = new ReservationSC() { ReservationStatusId = (int)SixtCancellationStatusEnum.NoShow, ReservationId = id, }; var model = unitOfWork.VReservationListBL.GetReservationsNoShow(reservationSC).Select(r => new VReservationListVM(r)).LastOrDefault(); return(View(model)); }
public IActionResult CBySixtDetails(int id) { ReservationSC reservationSC = new ReservationSC() { ReservationStatusId = (int)SixtCancellationStatusEnum.CancelledBySixt, ReservationId = id, }; reservationSC.ReservationStatusId = (int)SixtCancellationStatusEnum.CancelledBySixt; var model = unitOfWork.VReservationListBL.GetAllReservationsCancelBySixt(reservationSC).Select(r => new VReservationListVM(r)).LastOrDefault(); return(View(model)); }
private List <VReservationListModel> SearchCByCustomer(ReservationSC reservationSC) { //if (reservationSC.AssignedToMe == true) //{ // reservationSC.AssignedToId = LoggedUserId; //} if (reservationSC.ActionStepId == 5) { reservationSC.AssignedToId = LoggedUserId; } reservationSC.ReservationStatusId = (int)SixtCancellationStatusEnum.CancelledByCustomer; var model = unitOfWork.VReservationListBL.GetReservations(reservationSC); // var model = unitOfWork.ReservationBL.GetReservationWithDetails(reservationSC).Select(r => new ReservationVM(r)).ToArray(); return(model); }
public FileResult ExportReservation(ReservationSC reservationSC) { var stream = new MemoryStream(); try { // call search function var sheet = SearchCByCustomer(reservationSC).Select(r => new ReservationExport(r)).ToArray(); var ReservationDT = Helper.GenerateDataTable(sheet.ToArray()); using (var wb = new XLWorkbook()) { wb.Worksheets.Add(ReservationDT, "Reservation"); wb.SaveAs(stream); return(File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Reservation.xlsx")); } } catch (Exception e) { return(File(stream.ToArray(), e.ToString())); } }
public List <Reservation> GetReservationWithDetails(ReservationSC reservationSC) { try { var query = Context.Reservation.Include(f => f.Customer) .Include(f => f.ReservationStatus) .Include(f => f) .AsQueryable(); if (reservationSC != null) { if (reservationSC.ReservationNum.HasValue && reservationSC.ReservationNum.Value > 0) { query = query.Where(r => r.ReservationNum == reservationSC.ReservationNum); } if (reservationSC.ReservationStatusId.HasValue && reservationSC.ReservationStatusId.Value > 0) { query = query.Where(r => r.ReservationStatusId == reservationSC.ReservationStatusId); } if (reservationSC.BookingDateFrom.HasValue && reservationSC.BookingDateFrom.Value != DateTime.MinValue) { query = query.Where(r => r.BookingDate >= reservationSC.BookingDateFrom); } if (reservationSC.BookingDateTo.HasValue && reservationSC.BookingDateTo.Value != DateTime.MinValue) { query = query.Where(r => r.BookingDate <= reservationSC.BookingDateTo); } if (reservationSC.PickUpDateFrom.HasValue && reservationSC.PickUpDateFrom.Value != DateTime.MinValue) { query = query.Where(r => r.PickUpDate >= reservationSC.PickUpDateFrom); } if (reservationSC.PickUpDateTo.HasValue && reservationSC.PickUpDateTo.Value != DateTime.MinValue) { query = query.Where(r => r.PickUpDate <= reservationSC.PickUpDateTo); } if (reservationSC.CancelDateFrom.HasValue && reservationSC.CancelDateFrom.Value != DateTime.MinValue) { query = query.Where(r => r.CancelledDate >= reservationSC.CancelDateFrom); } if (reservationSC.CancelDateTo.HasValue && reservationSC.CancelDateTo.Value != DateTime.MinValue) { query = query.Where(r => r.CancelledDate <= reservationSC.CancelDateTo); } if (reservationSC.DropOffDate.HasValue && reservationSC.DropOffDate.Value != DateTime.MinValue) { query = query.Where(r => r.DropOffDate <= reservationSC.DropOffDate); } if (!string.IsNullOrWhiteSpace(reservationSC.CustomerName)) { query = query.Where(r => r.Customer.Name.Contains(reservationSC.CustomerName)); } if (!string.IsNullOrWhiteSpace(reservationSC.VehicleAcriss)) { query = query.Where(r => r.VehicleAcriss == reservationSC.VehicleAcriss); } if (reservationSC.CancelledBeforePickUpInDays.HasValue && reservationSC.CancelledBeforePickUpInDays.Value > 0) { query = query.Where(r => r.CancelledBeforeBickUpInDays == reservationSC.CancelledBeforePickUpInDays); } if (reservationSC.PickUpBranchIds?.Length > 0 && !reservationSC.PickUpBranchIds.Contains(null)) { query = query.Where(r => reservationSC.PickUpBranchIds.Contains(r.PickUpBranchId.GetValueOrDefault())); } } return(query.ToList()); } catch (Exception e) { return(null); } }
public CByCustomerSearchVM() { SearchInfo = new ReservationSC(); PageData = new PagedData <T>(); }