public void Insert(StopOverAddressDTO stopOverAddress) { using (CarRentalEntities context = new CarRentalEntities()) { context.usp_StopOverAddress_Insert(stopOverAddress.id_Address, stopOverAddress.Id_Stop_Over, stopOverAddress.is_Departure); } }
public void Insert(int address, int idStopOver, byte isDeparture) { StopOverAddressDTO stopOverAddress = new StopOverAddressDTO { id_Address = address, Id_Stop_Over = idStopOver, is_Departure = isDeparture }; stopOverAddressEngine.Insert(stopOverAddress); }
public ActionResult PartialListBooking() { int id = (int)Session["userID"]; BookingIndexViewsModel vm = new BookingIndexViewsModel(); List <Booking> bookings = new List <Booking>(); var requestBookings = requestBookingLogic.List(id); if (requestBookings.Count > 0) { foreach (RequestBookingDTO requestBooking in requestBookingLogic.List(id)) { BookingDTO booking = bookingLogic.GetByRequestBooking(requestBooking.id); StopOverDTO stopOver = stopOverLogic.GetByBooking(booking.Id); List <UserDTO> passagersAller = utilisateurLogic.ListPassagers(booking.Id, 1); List <UserDTO> passagersRetour = utilisateurLogic.ListPassagers(booking.Id, 0); StatusDTO status = statusLogic.GetStatus(requestBooking.Id_Status); StopOverAddressDTO stopOverAddress = stopOverAddressLogic.GetStopOverAddress(stopOver.Id); UserDTO driverAller = utilisateurLogic.GetDriver(booking.Id, 1); UserDTO driverRetour = utilisateurLogic.GetDriver(booking.Id, 0); AddressDTO addressAller = addressLogic.GetAddress(booking.Id, 1); AddressDTO addressRetour = addressLogic.GetAddress(booking.Id, 0); UserDTO createdBy = utilisateurLogic.Get(requestBooking.CreateBy); bookings.Add(new Booking { booking = booking, requestBooking = requestBooking, stopOver = stopOver, passagersAller = passagersAller, passagerRetour = passagersRetour, status = status, stopOverAddress = stopOverAddress, driverAller = driverAller, driverRetour = driverRetour, addressRetour = addressRetour, addressAller = addressAller, createdBy = createdBy }); } } vm.Bookings = bookings; return(PartialView("_ListBookingPartial", vm)); }
public List <StopOverAddressDTO> MapToListStopOverAddressDTO(List <StopOverAddress> stopOverAddresses) { List <StopOverAddressDTO> retour = new List <StopOverAddressDTO>(); foreach (StopOverAddress stopOverAddress in stopOverAddresses) { StopOverAddressDTO newStopOverAddress = new StopOverAddressDTO { id_Address = stopOverAddress.id_Address, Id_Stop_Over = stopOverAddress.Id_Stop_Over, is_Departure = stopOverAddress.is_Departure }; retour.Add(newStopOverAddress); } return(retour); }
public ActionResult Validations() { BookingValidationsViewsModel vm = new BookingValidationsViewsModel(); List <Booking> bookings = new List <Booking>(); foreach (RequestBookingDTO requestBooking in requestBookingLogic.ListbyStatus(2)) { BookingDTO booking = bookingLogic.GetByRequestBooking(requestBooking.id); StopOverDTO stopOver = stopOverLogic.GetByBooking(booking.Id); List <UserDTO> passagersAller = utilisateurLogic.ListPassagers(booking.Id, 1); List <UserDTO> passagersRetour = utilisateurLogic.ListPassagers(booking.Id, 0); StatusDTO status = statusLogic.GetStatus(requestBooking.Id_Status); StopOverAddressDTO stopOverAddress = stopOverAddressLogic.GetStopOverAddress(stopOver.Id); UserDTO driverAller = utilisateurLogic.GetDriver(booking.Id, 1); UserDTO driverRetour = utilisateurLogic.GetDriver(booking.Id, 0); AddressDTO addressAller = addressLogic.GetAddress(booking.Id); AddressDTO addressRetour = addressLogic.GetAddress(booking.Id); UserDTO createdBy = utilisateurLogic.Get(requestBooking.CreateBy); bookings.Add(new Booking { booking = booking, requestBooking = requestBooking, stopOver = stopOver, passagersAller = passagersAller, passagerRetour = passagersRetour, status = status, stopOverAddress = stopOverAddress, driverAller = driverAller, driverRetour = driverRetour, addressRetour = addressRetour, addressAller = addressAller, createdBy = createdBy }); } vm.Bookings = bookings; return(View(vm)); }
public ActionResult Validation(int id) { BookingValidationViewsModel vm = new BookingValidationViewsModel(); RequestBookingDTO requestBooking = requestBookingLogic.GetByRequestBooking(id); BookingDTO booking = bookingLogic.GetByRequestBooking(requestBooking.id); StopOverDTO stopOver = stopOverLogic.GetByBooking(booking.Id); List <UserDTO> passagersAller = utilisateurLogic.ListPassagers(booking.Id, 1); List <UserDTO> passagersRetour = utilisateurLogic.ListPassagers(booking.Id, 0); StatusDTO status = statusLogic.GetStatus(requestBooking.Id_Status); StopOverAddressDTO stopOverAddress = stopOverAddressLogic.GetStopOverAddress(stopOver.Id); UserDTO driverAller = utilisateurLogic.GetDriver(booking.Id, 1); UserDTO driverRetour = utilisateurLogic.GetDriver(booking.Id, 0); AddressDTO addressAller = addressLogic.GetAddress(booking.Id); AddressDTO addressRetour = addressLogic.GetAddress(booking.Id); UserDTO createdBy = utilisateurLogic.Get(requestBooking.CreateBy); Booking _booking = new Booking { booking = booking, requestBooking = requestBooking, stopOver = stopOver, passagerRetour = passagersRetour, passagersAller = passagersRetour, status = status, stopOverAddress = stopOverAddress, driverAller = driverAller, driverRetour = driverRetour, addressRetour = addressRetour, addressAller = addressAller, createdBy = createdBy }; vm.Booking = _booking; return(View(vm)); }
public JsonResult AddRequestBooking(RequestBookingDTO requestBooking, int[] _passagers, int driver, int driver2, StopOverDTO stopOver, int addressDeparture, int addressArrival) { requestBooking.CreateBy = (int)Session["userID"]; RequestBookingDTO requestBooking2 = requestBookingLogic.Insert(requestBooking); BookingDTO booking = bookingLogic.Insert(0, null, requestBooking2.id); NotificationDTO notification = new NotificationDTO { // CreationDateTimestamp default getdate en base IdRequestBooking = requestBooking2.id, IsForNewRequest = 1, IsRead = 0, IsForAdmin = 0, }; // Ajout des passagers if (_passagers != null) { for (int i = 0; i < _passagers.Length; i++) { userBookingLogic.Insert(0, 1, booking.Id, _passagers[i]); userBookingLogic.Insert(0, 0, booking.Id, _passagers[i]); // Ajout des notification pour chaque passager notification.IdUser = _passagers[i]; notificationLogic.Insert(notification); } } // Ajout des conducteurs. Ne pas oublier d'jaouter le driver retour. userBookingLogic.Insert(1, 1, booking.Id, driver); userBookingLogic.Insert(1, 0, booking.Id, driver2); // Ajout des notification pour les conducteurs notification.IdUser = driver; notificationLogic.Insert(notification); if (driver2 != null && driver2 != notification.IdUser) { notification.IdUser = driver2; notificationLogic.Insert(notification); } // Ajout de l'étape de base stopOver.Id_Booking = booking.Id; stopOver.Id_Stop_Over_Type = 1; stopOver = stopOverLogic.Insert(stopOver); stopOverAddressLogic.Insert(addressDeparture, stopOver.Id, 1); stopOverAddressLogic.Insert(addressArrival, stopOver.Id, 0); List <UserDTO> passagersAller = utilisateurLogic.ListPassagers(booking.Id, 1); List <UserDTO> passagersRetour = utilisateurLogic.ListPassagers(booking.Id, 0); StatusDTO status = statusLogic.GetStatus(requestBooking.Id_Status); StopOverAddressDTO stopOverAddress = stopOverAddressLogic.GetStopOverAddress(stopOver.Id); UserDTO driverAller = utilisateurLogic.GetDriver(booking.Id, 1); UserDTO driverRetour = utilisateurLogic.GetDriver(booking.Id, 0); AddressDTO addressAller = addressLogic.GetAddress(booking.Id, 1); AddressDTO addressRetour = addressLogic.GetAddress(booking.Id, 0); Booking _booking = new Booking { booking = booking, requestBooking = requestBooking, stopOver = stopOver, passagersAller = passagersAller, passagerRetour = passagersRetour, status = status, stopOverAddress = stopOverAddress, driverAller = driverAller, driverRetour = driverRetour, addressRetour = addressAller, addressAller = addressRetour }; // Ajout des notifications pour les administrateurs List <UserDTO> admins = roleLogic.Get_Users_With_Role("Administrateur"); List <UserDTO> adminsToAdd = roleLogic.Get_Users_With_Role("Admin"); admins.AddRange(adminsToAdd); notification.IsForAdmin = 1; if (admins.Count > 0) { foreach (UserDTO admin in admins) { if (admin.Id != requestBooking.CreateBy) { notification.IdUser = admin.Id; notificationLogic.Insert(notification); } } } Session["notifs"] = notificationLogic.ListAllForUser((int)Session["userID"]).FindAll(n => n.IsRead == 0).Count; return(Json(_booking)); }
public void AddStopOverAddress(StopOverAddressDTO stopOverAddress) { stopOverAddressEngine.Insert(stopOverAddress); }