public bool BusTypeCheckHaveNoBooking(BusType busType, Route route, DateTime?date) { var haveNoBooking = false; var listBooking = TransferRequestByDateBLL.BookingGetAllByCriterionTransfer(busType, route, date) .Future().ToList(); if (listBooking.Count == 0) { haveNoBooking = true; } return(haveNoBooking); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var busTypeStandard = TransferRequestByDateBLL.BusTypeGetAll() .Future() .ToList() .Where(x => x.Name == "Standard").SingleOrDefault(); rptTransportBookingStandard.DataSource = TransferRequestByDateBLL.BookingGetAllByCriterionTransfer(busTypeStandard, Route, Way, Date) .Future().ToList() .Where(x => x.ListBookingBusByDate .Where(y => y.BusByDate != null && y.BusByDate.Route.Way == Route.Way && y.BusByDate.Route.Group == Route.Group) .ToList() .Count <= 0).ToList(); rptTransportBookingStandard.DataBind(); } }
public bool BusTypeCheckBookingHaveNoGroup(BusType busType, Route route, DateTime?date) { var haveBookingNoGroup = false; var listBooking = TransferRequestByDateBLL.BookingGetAllByCriterionTransfer(busType, route, date) .Future().ToList(); listBooking.ForEach(booking => { var listBookingBusByDate = TransferRequestByDateBLL.BookingBusByDateGetAllByCriterion(booking) .Future().ToList().Where(x => x.BusByDate.Route.Id == route.Id).ToList(); if (listBookingBusByDate.Count == 0) { haveBookingNoGroup = true; return; } }); return(haveBookingNoGroup); }
protected void rptBusType_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var busType = (BusType)e.Item.DataItem; var route = (Route)((RepeaterItem)e.Item.Parent.Parent).DataItem; var rptTransportBooking = (Repeater)e.Item.FindControl("rptTransportBooking"); var listTransportBooking = TransferRequestByDateBLL .BookingGetAllByCriterionTransfer(busType, route, route.Way, Date) .Future() .ToList(); if (busType.Name == "Standard") { var listBookingUpgraded = new List <Booking>(); listTransportBooking.ForEach(standardBooking => { var bookingUpgraded = standardBooking.ListBookingBusByDate .Any(x => x.BusByDate != null && x.BusByDate.BusType.Id != standardBooking.Transfer_BusType.Id); if (bookingUpgraded) { listBookingUpgraded.Add(standardBooking); } }); listTransportBooking = listTransportBooking.Except(listBookingUpgraded).ToList(); } if (busType.Name == "Limousine") { var standardBusType = TransferRequestByDateBLL.BusTypeGetAll() .Future() .ToList() .Where(x => x.Name == "Standard") .SingleOrDefault(); var listStandardTransportBooking = TransferRequestByDateBLL.BookingGetAllByCriterionTransfer(standardBusType, route, route.Way, Date) .Future() .ToList() .Where(x => x .ListBookingBusByDate .Where(y => y.BusByDate != null && y.BusByDate.BusType.Name == "Limousine" && y.BusByDate.Route.Way == route.Way && y.BusByDate.Route.Group == route.Group) .ToList() .Count > 0) .ToList(); listStandardTransportBooking.ForEach(standardTransportBooking => { standardTransportBooking.Transfer_Upgraded = true; listTransportBooking.Add(standardTransportBooking); }); } rptTransportBooking.DataSource = listTransportBooking.Where(x => x.Status == StatusType.Approved) .Where(x => x.Deleted == false).ToList(); rptTransportBooking.DataBind(); var trBusType = (HtmlTableRow)e.Item.FindControl("trBusType"); if (busType.Name != "Standard" && listTransportBooking.Count <= 0) { trBusType.Visible = false; } if (BusType != null && BusType.Id > 0) { trBusType.Visible = false; } if (listTransportBooking.Any(x => x.ListBookingBusByDate.Count <= 0)) { trBusType.Attributes.Add("class", "custom-text-danger"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var listTransportBooking = TransferRequestByDateBLL.BookingGetAllByCriterionTransfer(BusType, Route, Way, Date) .Future() .ToList() .Where(x => x.ListBookingBusByDate .Where(y => y.BusByDate != null && y.BusByDate.Route.Way == Route.Way && y.BusByDate.Route.Group == Route.Group && y.BusByDate.Group == Group) .ToList().Count > 0).ToList(); if (BusType.Name == "Standard") { var listBookingUpgraded = new List <Booking>(); listTransportBooking.ForEach(standardBooking => { var bookingUpgraded = standardBooking.ListBookingBusByDate .Any(x => x.BusByDate.BusType.Id != standardBooking.Transfer_BusType.Id); if (bookingUpgraded) { listBookingUpgraded.Add(standardBooking); } }); listTransportBooking = listTransportBooking.Except(listBookingUpgraded).ToList(); } if (BusType.Name == "Limousine") { var standardBusType = TransferRequestByDateBLL.BusTypeGetAll() .Future() .ToList() .Where(x => x.Name == "Standard") .SingleOrDefault(); var listStandardTransportBooking = TransferRequestByDateBLL.BookingGetAllByCriterionTransfer(standardBusType, Route, Way, Date) .Future() .ToList() .Where(x => x.ListBookingBusByDate .Where(y => y.BusByDate != null && y.BusByDate.BusType.Name == "Limousine" && y.BusByDate.Route.Way == Route.Way && y.BusByDate.Route.Group == Route.Group && y.BusByDate.Group == Group) .ToList() .Count > 0).ToList(); listStandardTransportBooking.ForEach(standardTransportBooking => { standardTransportBooking.Transfer_Upgraded = true; listTransportBooking.Add(standardTransportBooking); }); } rptTransportBooking.DataSource = listTransportBooking; rptTransportBooking.DataBind(); rptTransportBookingWithoutGroup.DataSource = TransferRequestByDateBLL.BookingGetAllByCriterionTransfer(BusType, Route, Way, Date) .Future() .ToList() .Where(x => x.ListBookingBusByDate.Count <= 0).ToList(); rptTransportBookingWithoutGroup.DataBind(); btnSave.Enabled = !LockingTransferBoolean; var driverExpense = BusByDate.ListExpense.Where(x => x.Type == "Drivers").FirstOrDefault(); if (driverExpense != null) { hidExpenseDriverId.Value = driverExpense.Id.ToString(); var expenseService = TransferRequestByDateBLL.ExpenseServiceGetByExpenseId(driverExpense.Id); txtDriverName.Text = BusByDate.Driver_Name; txtDriverPhone.Text = BusByDate.Driver_Phone; txtDriverCost.Text = expenseService.Cost.ToString("#,##0.##"); } } }