public ActionResult BookedDetails(HotelBooking booking) { try { CreateSession(); SearchInfo info = searchManager.GetSearchInfo(); booking.BookingDate = DateTime.Now; booking.TotalCost = (decimal)TempData["TotalCost"]; booking.HotelBookingContacts = new HotelBookingContact() { ContactName = booking.HotelBookingContacts.ContactName, EmailID = booking.HotelBookingContacts.EmailID, PhoneNo = booking.HotelBookingContacts.PhoneNo }; booking.SearchInfos = new SearchInfo() { CheckInDate = info.CheckInDate, CheckOutDate = info.CheckOutDate, NoOfNight = info.NoOfNight, NoOfPeople = info.NoOfPeople, NoOfRooms = info.NoOfRooms, HotelId = info.HotelId, ExtraCost = info.ExtraCost }; searchManager.SaveBookingDummy(booking); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("CreatePayment", "Payment")); }
public async Task AddAsync(HotelBooking entity) { var spParameters = new SqlParameter[4]; spParameters[0] = new SqlParameter() { ParameterName = "UserId", Value = entity.UserId }; spParameters[1] = new SqlParameter() { ParameterName = "HotelId", Value = entity.HotelId }; spParameters[2] = new SqlParameter() { ParameterName = "CheckIn", Value = entity.UserCheckInDate }; spParameters[3] = new SqlParameter() { ParameterName = "CheckOut", Value = entity.UserCheckOutDate }; await DbContextManager.StoreProc <StoreProcResult>("[dbo].spHotelBooking ", spParameters); try { await DbContextManager.CommitAsync(); } catch (Exception) { DbContextManager.RollbackTransaction(); } }
/// <summary> /// Method To Cancel A Booking /// </summary> /// <param name="id"></param> public void CancelBooking(int id) { HotelBooking booking = bookingRepository.Find(id); booking.IsCanceled = true; bookingRepository.Update(booking); }
private async Task <IEnumerable <Hotel> > GetHotelsAsync(HotelBooking searchQuery) { var hotels = new List <Hotel>(); string[] hotelImage = new string[] { "https://media-cdn.tripadvisor.com/media/photo-s/0f/72/3e/04/the-grand-hotel-excelsior.jpg", "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRlXXP7iOnz4wNHi1ra4ZL7XZxTSjUKs6Ml4i08lYw67Xq4OKRhvw", "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQodHJ-ISO9Vx_4Jm5Ez4fqxx3JzLPop5fEdO78G4KAj-3WkjBcJA", "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQRdYGFOORzq-UW0RFmVNxh0XvU4jzlI1rAhzxKdeSgLsrRhLV6", "http://www.thehotel-brussels.be/d/brussels/images/page_home-feature-1.jpg?1498727489" }; // Filling the hotels results manually just for demo purposes for (int i = 1; i <= 5; i++) { var random = new Random(i); Hotel hotel = new Hotel() { Name = $"{searchQuery.location} Hotel {i}", Location = searchQuery.location, Rating = random.Next(1, 5), NumberOfReviews = random.Next(0, 5000), PriceStarting = random.Next(80, 450), Image = hotelImage[i - 1] }; hotels.Add(hotel); } hotels.Sort((h1, h2) => h1.PriceStarting.CompareTo(h2.PriceStarting)); return(hotels); }
public ActionResult CancelBookingDetails(CancelBookingHotel cancelbooking) { HotelBooking booking = hotelbookingManager.FindBookingByID(cancelbooking); if (booking.HotelBookingContacts.EmailID == cancelbooking.EmailId) { return(View(booking)); } else { TempData["errorMsg"] = "Email-ID or Booking Id Not Match"; return(RedirectToAction("CancelBooking")); } }
/// <summary> /// Use strategy pattern: When you want to define d a class that will have one behaviour that is similar to other behaviour in a list /// Advantages: /// -Reduces long list of conditionals /// -Avaoid duplicate code /// -Keeps class changes from forcing other class changes /// -Can hide complicated secret code from the user /// Disadvantage: /// -Increased number of object/ classes /// </summary> private static void ExecuteStrategyDesignPattern() { Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("STRATEGY PATTERN \n"); Console.ForegroundColor = ConsoleColor.White; Booking hotel = new HotelBooking(new Traveller("Papa", "Bengu")); Booking flight = new FlightBooking(new Traveller("Dikeledi", "Ngqwemla")); Console.WriteLine(hotel.ToString()); Console.WriteLine(""); Console.WriteLine(flight.ToString()); Console.WriteLine("------------------- \n"); }
/// <summary> /// Action/Method To Store Booking Details /// </summary> /// <returns></returns> public ActionResult Get() { HotelBooking HBooking = null; try { CreateSession(); HotelBooking ho = searchManager.GetBooking(); hotelbookingManager.SaveBooking(ho); HBooking = hotelbookingManager.FindLastBookingDetails(); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(View(HBooking)); }
public void OrderHotel(HotelOrderDTO orderDTO) { Hotel hotel = Database.Hotels.GetByID(orderDTO.HotelId); if (hotel == null) { throw new ValidationException("Отель не найден", ""); } if ((orderDTO.EvictionDate - orderDTO.EntranceDate).TotalDays <= 0) { throw new ValidationException("Проверьте правильность введённых дат", ""); } HotelBooking hotelBooking = Mapper.Map <HotelOrderDTO, HotelBooking>(orderDTO); hotelBooking.Sum = new Price(hotel.Stars, orderDTO.EvictionDate, orderDTO.EntranceDate).CalculatePrice(); Database.HotelOrders.Insert(hotelBooking); Database.Save(); }
public ResponseResult SearchHotel(int Id) { ResponseResult responseObject = new ResponseResult(); Status statusObject = new Status(); responseObject.StatusObject = statusObject; try { HotelBooking ValueObject = new HotelBooking(); int loop; for (loop = 0; loop < DataValues.Count; loop++) { if (DataValues[loop].Id == Id) { ValueObject.Id = Id; ValueObject.Name = DataValues[loop].Name; ValueObject.NumberOfAvailableRooms = DataValues[loop].NumberOfAvailableRooms; ValueObject.LocationCode = DataValues[loop].LocationCode; break; } } if (loop == DataValues.Count) { throw new Exception("File Not Found"); } responseObject.StatusObject.actionStatus = "Sucess"; responseObject.StatusObject.Code = 200; responseObject.StatusObject.responseMessage = "Hotel Found"; responseObject.hotelObject = ValueObject; return(responseObject); } catch (Exception e) { responseObject.StatusObject.actionStatus = "Failure"; responseObject.StatusObject.Code = 404; responseObject.StatusObject.responseMessage = "No Hotel Found with this ID"; responseObject.hotelObject = null; return(responseObject); } }
public ResponseResult DeleteHotel(int Id) { ResponseResult responseResult = new ResponseResult(); Status statusObject = new Status(); responseResult.StatusObject = statusObject; int i; try { HotelBooking obj = new HotelBooking(); for (i = 0; i < DataValues.Count; i++) { if (DataValues[i].Id == Id) { obj = DataValues[i]; break; } } if (i == DataValues.Count) { throw new Exception("File Not Found"); } responseResult.StatusObject.actionStatus = "Success"; responseResult.StatusObject.Code = 200; responseResult.StatusObject.responseMessage = "Hotel Deleted Successful"; responseResult.hotelObject = obj; DataValues.Remove(obj); return(responseResult); } catch (Exception) { responseResult.StatusObject.actionStatus = "Failure"; responseResult.StatusObject.Code = 404; responseResult.StatusObject.responseMessage = "Hotel not Found"; responseResult.hotelObject = null; return(responseResult); } }
public IActionResult Predict() { HotelBooking hotelBooking = new HotelBooking() { HotelBookingData = new WebApplicationML3ML.Model.ModelInput() { Lead_time = 0, Arrival_date_month = "July", Arrival_date_day_of_month = 1, Stays_in_weekend_nights = 0, Stays_in_week_nights = 2, Adults = 2, Children = 0, Reserved_room_type = 0 }, HotelBookingRate = new WebApplicationML3ML.Model.ModelOutput() { Score = 0 } }; return(View(hotelBooking)); }
public ResponseResult MakeABooking(int id, [FromBody] int NumberOfRooms) { ResponseResult responseResult = new ResponseResult(); Status statusObject = new Status(); responseResult.StatusObject = statusObject; try { int loop; HotelBooking obj = new HotelBooking(); for (loop = 0; loop < DataValues.Count; loop++) { if (DataValues[loop].Id == id) { DataValues[loop].NumberOfAvailableRooms = DataValues[loop].NumberOfAvailableRooms - NumberOfRooms; break; } } if (loop == DataValues.Count) { throw new Exception("Hotel not Found"); } responseResult.StatusObject.actionStatus = "Success"; responseResult.StatusObject.Code = 200; responseResult.StatusObject.responseMessage = "Booking Made Successfully"; responseResult.hotelObject = DataValues[loop]; return(responseResult); } catch (Exception e) { responseResult.StatusObject.actionStatus = "Failure"; responseResult.StatusObject.Code = 404; responseResult.StatusObject.responseMessage = "Booking Failed as Hotel not Found"; responseResult.hotelObject = null; return(responseResult); } }
public async Task <IActionResult> Post([FromBody] Update update) { if (update == null) { return(Ok()); } var commands = _botClient.Commands; var chatId = update.Message?.Chat?.Id ?? update.CallbackQuery.From.Id; if (!_botClient.CurrentStates.TryGetValue(chatId, out _)) { _botClient.CurrentStates.TryAdd(chatId, new StartCommand(_telegramBotClient)); } if (!_botClient.Bookings.TryGetValue(chatId, out _)) { var hotels = new HotelBooking(); // await using (var context = new DataContext(_configuration.GetConnectionString("Db"))) // { // // } _botClient.Bookings.TryAdd(chatId, hotels); } foreach (var command in commands.Where(command => command.Contains(update, _botClient.CurrentStates[chatId]))) { await command.Execute(update, _botClient); _botClient.CurrentStates[chatId] = command; break; } return(Ok()); }
public ResponseResult CreateHotel(HotelBooking AddHotel) { ResponseResult responseResult = new ResponseResult(); Status statusObject = new Status(); responseResult.StatusObject = statusObject; try { DataValues.Add(AddHotel); responseResult.StatusObject.actionStatus = "Success"; responseResult.StatusObject.responseMessage = "Hotel Details Added Successfully"; responseResult.StatusObject.Code = 201; responseResult.hotelObject = AddHotel; return(responseResult); } catch (Exception e) { responseResult.StatusObject.actionStatus = "Failure"; responseResult.StatusObject.responseMessage = "Hotel Details Not Added"; responseResult.StatusObject.Code = 500; responseResult.hotelObject = null; return(responseResult); } }
public async Task <Unit> Handle(Command request, CancellationToken cancellationToken) { var user = await _userManager.FindByNameAsync(_userAccessor.GetCurrentUsername()); var booking = new HotelBooking { HotelBookingId = request.hotelBookingid, BookingDate = DateTime.Now, ProductId = Guid.Parse(request.ProductId), ClientName = user != null ? user.UserName : request.ClientName, StartingFromDate = DateTime.Parse(request.StartingFromDate), EndingDate = DateTime.Parse(request.EndingDate) }; _context.HotelBookings.Add(booking); var success = await _context.SaveChangesAsync() > 0; if (success) { return(Unit.Value); } throw new System.Exception("Problem saving changes"); }
/// <summary> /// Method To FindBooking By Booking ID /// </summary> /// <param name="cancelbooking"></param> /// <returns></returns> public Models.HotelBooking FindBookingByID(Models.CancelBookingHotel cancelbooking) { HotelBooking booking = bookingRepository.Find(cancelbooking.BookingIdNo); return(booking); }
public HotelBookingVM(HotelBooking hotelBooking) { this._hotelBooking = hotelBooking; }
public HotelBookingVM() { _hotelBooking = new HotelBooking(); }
public Task DeleteAsync(HotelBooking parameters) { throw new NotImplementedException(); }
public Task <HotelBookedResponse> CreateBookingAsync(BookingSchema requestBody, string ama_Client_Ref, AcceptEncoding?accept_Encoding) { return(HotelBooking.CreateBookingAsync(requestBody, ama_Client_Ref, accept_Encoding, System.Threading.CancellationToken.None)); }
public ResponseModel Insert(HotelBooking hotelBooking) { return(_hotelBookingRepository.Insert(hotelBooking)); }
public ResponseModel Delete(HotelBooking hotelBooking) { return(_hotelBookingRepository.Delete(hotelBooking)); }
public HashSet <string> UpdateValidation(HotelBooking entity) { return(ValidationMessages); }
public Task <object> GetBy(HotelBooking parameters) { throw new NotImplementedException(); }
/// <summary> /// 打印 /// </summary> /// <param name="id"></param> /// <returns></returns> public ViewResult Print(string id) { Item result = BusinessTravelBll.GetBusinessTravelObjById(inn, id); BusinessTravelModel model = new BusinessTravelModel(); model.Id = result.getProperty("id"); model.b_DocumentNo = result.getProperty("b_documentno"); model.b_CompanyCode = result.getProperty("b_companycode"); model.b_Location = result.getProperty("b_location"); model.b_ApplicationDate = DateTime.Parse(result.getProperty("b_applicationdate")).ToString("yyyy-MM-dd"); model.b_TripType = result.getProperty("b_triptype"); model.b_Type = result.getProperty("b_type"); model.b_Preparer = result.getProperty("b_preparer"); model.b_Employee = result.getProperty("b_employee"); model.b_StaffNo = result.getProperty("b_staffno"); model.b_Position = result.getProperty("b_position"); model.b_Dept = result.getProperty("b_dept"); model.b_CostCenter = result.getProperty("b_costcenter"); model.b_Mobile = result.getProperty("b_mobile"); model.b_ProjectName = result.getProperty("b_projectname"); model.b_Destination = result.getProperty("b_destination"); model.b_SeniorManager = result.getProperty("b_seniormanager"); model.b_Director = result.getProperty("b_director"); model.b_VP = result.getProperty("b_vp"); model.b_TravelDate = DateTime.Parse(result.getProperty("b_traveldate")).ToString("yyyy-MM-dd"); model.b_EstimatedReturnDate = DateTime.Parse(result.getProperty("b_estimatedreturndate")).ToString("yyyy-MM-dd"); model.b_Purpose = result.getProperty("b_purpose"); model.b_TravelSchedule = result.getProperty("b_travelschedule"); model.b_TravelBudget = !string.IsNullOrEmpty(result.getProperty("b_travelbudget")) ? decimal.Parse(result.getProperty("b_travelbudget")) : 0; model.b_FlightIsssue = result.getProperty("b_flightisssue"); model.b_FlightBooking = result.getProperty("b_flightbooking"); model.b_HotelBooking = result.getProperty("b_hotelbooking"); model.b_Didi = result.getProperty("b_didi"); model.b_Others = result.getProperty("b_others"); model.b_OtherContent = result.getProperty("b_othercontent"); model.b_IsHangUp = result.getProperty("b_ishangup") == "1" ? true : false; model.b_HangUpActivityName = result.getProperty("b_hangupactivityname"); model.OldRemark = result.getProperty("b_remark"); model.b_TrafficExpense = !string.IsNullOrEmpty(result.getProperty("b_trafficexpense")) ? decimal.Parse(result.getProperty("b_trafficexpense")) : 0; model.b_HotelExpense = !string.IsNullOrEmpty(result.getProperty("b_hotelexpense")) ? decimal.Parse(result.getProperty("b_hotelexpense")) : 0; model.b_FixedSubsidy = !string.IsNullOrEmpty(result.getProperty("b_fixedsubsidy")) ? decimal.Parse(result.getProperty("b_fixedsubsidy")) : 0; model.b_OtherExpenses = !string.IsNullOrEmpty(result.getProperty("b_otherexpenses")) ? decimal.Parse(result.getProperty("b_otherexpenses")) : 0; model.b_DidiMoney = !string.IsNullOrEmpty(result.getProperty("b_didimoney")) ? decimal.Parse(result.getProperty("b_didimoney")) : 0; model.b_DidiAddMoney = !string.IsNullOrEmpty(result.getProperty("b_didiaddmoney")) ? decimal.Parse(result.getProperty("b_didiaddmoney")) : 0; //机票代订 Item Relation = result.getRelationships("R_FlightBooking"); if (Relation.getItemCount() > 0) { model.FlightBookingItems = new List <FlightBooking>(); for (int i = 0; i < Relation.getItemCount(); i++) { Item ItemObJ = Relation.getItemByIndex(i).getRelatedItem(); FlightBooking itemModel = new FlightBooking(); itemModel.Id = ItemObJ.getProperty("id"); itemModel.b_FirstName = ItemObJ.getProperty("b_firstname"); itemModel.b_LastName = ItemObJ.getProperty("b_lastname"); itemModel.b_IDType = ItemObJ.getProperty("b_idtype"); itemModel.b_IDCardNo = ItemObJ.getProperty("b_idcardno"); itemModel.b_Nationality = ItemObJ.getProperty("b_nationality"); itemModel.b_PassportNumber = ItemObJ.getProperty("b_passportnumber"); itemModel.b_Dateofexpiration = !string.IsNullOrEmpty(ItemObJ.getProperty("b_dateofexpiration")) ? DateTime.Parse(ItemObJ.getProperty("b_dateofexpiration")).ToString("yyyy-MM-dd") : ""; itemModel.b_Dateofbirth = ItemObJ.getProperty("b_dateofbirth"); itemModel.b_Address = ItemObJ.getProperty("b_address"); itemModel.b_Gooff = ItemObJ.getProperty("b_gooff"); itemModel.b_Goplace = ItemObJ.getProperty("b_goplace"); itemModel.b_Flightnumber = ItemObJ.getProperty("b_flightnumber"); model.FlightBookingItems.Add(itemModel); } } //酒店代订 Item HotelRelation = result.getRelationships("R_HotelBooking"); if (HotelRelation.getItemCount() > 0) { model.HotelBookingItems = new List <HotelBooking>(); for (int i = 0; i < HotelRelation.getItemCount(); i++) { Item ItemObJ = HotelRelation.getItemByIndex(i).getRelatedItem(); HotelBooking itemHote = new HotelBooking(); itemHote.Id = ItemObJ.getProperty("id"); itemHote.b_Checkindate = !string.IsNullOrEmpty(ItemObJ.getProperty("b_checkindate")) ? DateTime.Parse(ItemObJ.getProperty("b_checkindate")).ToString("yyyy-MM-dd") : ""; itemHote.b_Leavedate = !string.IsNullOrEmpty(ItemObJ.getProperty("b_leavedate")) ? DateTime.Parse(ItemObJ.getProperty("b_leavedate")).ToString("yyyy-MM-dd") : ""; itemHote.b_Specificaddress = ItemObJ.getProperty("b_specificaddress"); model.HotelBookingItems.Add(itemHote); } } //日志信息 model.HistoryList = GetBusinessTravelHistoryList(id); foreach (var item in model.HistoryList) { item.Created_on = item.Create_onStr.GetValueOrDefault().ToString("yyyy-MM-dd HH:mm:ss"); } return(View("~/Views/BusinessTravel/PrintBusinessTravel.cshtml", model)); }
public IActionResult Predict(HotelBooking hotelBooking) { hotelBooking.HotelBookingRate = ConsumeModel.Predict(hotelBooking.HotelBookingData); return(View(hotelBooking)); }
public ResponseModel Update(HotelBooking hotelBooking) { return(_hotelBookingRepository.Update(hotelBooking)); }
public HashSet <string> DeleteValidation(HotelBooking parameters) { return(ValidationMessages); }
public async Task UpdateAsync(HotelBooking entity) { await Uow.RegisterDirtyAsync(entity); await Uow.CommitAsync(); }
public void SaveBookingDummy(HotelBooking booking) { hotelbooking = booking; }