public IQueryOver <Agency, Agency> Guide_AgencyGetAllGuideInDay(Role role, DateTime?date, Route route) { var query = _session.QueryOver <Agency>(); Role roleAlias = null; query = query.JoinAlias(x => x.Role, () => roleAlias); query = query.Where(() => roleAlias.Id == role.Id); if (!date.HasValue) { date = DateTime.Today; } Expense expenseAlias = null; query = query.JoinAlias(x => x.ListExpense, () => expenseAlias); query = query.Where(() => expenseAlias.Date == date.Value); Cruise cruiseAlias = null; query = query.JoinAlias(() => expenseAlias.Cruise, () => cruiseAlias); CruiseRoute cruiseRouteAlias = null; query = query.JoinAlias(() => cruiseAlias.ListCruiseRoute, () => cruiseRouteAlias); Route routeAlias = null; query = query.JoinAlias(() => cruiseRouteAlias.Route, () => routeAlias); query = query.Where(() => routeAlias.Id == route.Id); return(query); }
public IQueryOver <Expense, Expense> ExpenseGetAllByCriterion(Agency guide, DateTime?date, Route route) { var query = _session.QueryOver <Expense>(); Agency guideAlias = null; query = query.JoinAlias(x => x.Guide, () => guideAlias); if (guide != null) { query = query.Where(() => guideAlias.Id == guide.Id); } if (date != null) { query = query.Where(x => x.Date == date); } Cruise cruiseAlias = null; query = query.JoinAlias(x => x.Cruise, () => cruiseAlias); CruiseRoute cruiseRouteAlias = null; query = query.JoinAlias(() => cruiseAlias.ListCruiseRoute, () => cruiseRouteAlias); Route routeAlias = null; query = query.JoinAlias(() => cruiseRouteAlias.Route, () => routeAlias); if (route != null) { query = query.Where(() => routeAlias.Id == route.Id); } return(query); }
public IQueryOver <Booking, Booking> BookingGetAllByCriterionTransfer(BusType busType, Route route, string way, DateTime?date) { var query = _session.QueryOver <Booking>(); BusType busTypeAlias = null; query.JoinAlias(x => x.Transfer_BusType, () => busTypeAlias); if (busType != null && busType.Id > 0) { query = query.Where(() => busTypeAlias.Id == busType.Id); } Cruise cruiseAlias = null; query.JoinAlias(x => x.Cruise, () => cruiseAlias); CruiseRoute cruiseRouteAlias = null; query.JoinAlias(() => cruiseAlias.ListCruiseRoute, () => cruiseRouteAlias); Route routeAlias = null; query.JoinAlias(() => cruiseRouteAlias.Route, () => routeAlias); if (route != null) { query = query.Where(() => cruiseRouteAlias.Route.Id == route.Id); } if (!String.IsNullOrEmpty(way)) { query = query.Where(() => routeAlias.Way == way); } if (date != null) { if (way == "To") { query = query.Where(x => x.Transfer_DateTo == date); } if (way == "Back") { query = query.Where(x => x.Transfer_DateBack == date); } } return(query); }