Ejemplo n.º 1
0
        public void SaveReservation(ReservationInfo resInfo)
        {
            Guest       guest       = GetGuest(resInfo);
            Reservation reservation = GetReservation(resInfo.Id);

            if (reservation == null)
            {
                Reservations.Add(new Models.Reservation(resInfo));
                Logging.Instance.WriteLine("Add reservation:");

                reservation = resInfo.ToReservation(this);
                Context.Reservations.Add(reservation);
            }
            else
            {
                Reservations[resInfo.Id - 1] = new Models.Reservation(resInfo);
                Logging.Instance.WriteLine("Edit reservation:");
                Logging.Instance.WriteLine($"Old: {reservation}", true);

                UpdateReservation(reservation, guest, resInfo);
            }
            Logging.Instance.WriteLine($"New: {reservation}", true);
            Context.SaveChanges();
            UpdateResInfos();
            OnReservationsChanged?.Invoke(this, EventArgs.Empty);
        }
 /// <summary>
 /// Adds persons reservation to the output.
 /// </summary>
 /// <param name="sb">StringBuilder instance.</param>
 /// <param name="reservation">Reservation to write.</param>
 private static void AppendReservation(ref StringBuilder sb, ReservationInfo reservation)
 {
     sb.AppendLine($"    Room number: {reservation.Apartment.Number}");
     sb.AppendLine($"    From {reservation.From:dd.MM.yyyy}");
     sb.AppendLine($"    To {reservation.To:dd.MM.yyyy}");
     sb.AppendLine();
 }
Ejemplo n.º 3
0
        public void CreateReservationsTable(object sender, EventArgs e)
        {
            Logging.Instance.WriteLine("Start adding Table cells...");
            Table.Children.Clear();
            DateTime startDate = StartDate.SelectedDate.GetValueOrDefault(DateTime.Today);

            for (int row = 0; row < rooms.Count; row++)
            {
                int room        = rooms.ElementAt(row).Key;
                int skipColumns = 0;
                for (int col = 0; col <= DaysToShow; col++)
                {
                    if (skipColumns-- > 0)
                    {
                        continue;
                    }
                    DateTime        nextDate  = startDate.AddDays(col);
                    DockPanel       dockPanel = new DockPanel();
                    ReservationInfo resInfo   = controller.GetReservationInfo(room, nextDate);
                    if (resInfo != null)
                    {
                        dockPanel.Children.Add(resInfo.SourceInt switch
                        {
                            0 => new ReservationIcon("Phone"),
                            1 => new ReservationIcon("Mail"),
                            2 => new ReservationIcon("Booking"),
                            3 => new ReservationIcon("HotelIconC"),
                            4 => new ReservationIcon("Friend"),
                            _ => new ReservationIcon("Phone")
                        });
Ejemplo n.º 4
0
        private void buttonPurchase_Click(object sender, RoutedEventArgs e)
        {
            ReservationInfo resinfo = new ReservationInfo();

            string[] spp = new string[listBoxBooking.Items.Count];
            for (int i = 0; i < spp.Length; i++)
            {
                spp[i] = listBoxBooking.Items[i].ToString();
            }
            if (spp.Length < 4)
            {
                MessageBox.Show("Please, enter all information");
            }
            else
            {
                resinfo.HotelName = spp[0];
                resinfo.CheckIn   = spp[1];
                resinfo.CheckOut  = spp[2];
                resinfo.RoomType  = spp[3];

                _reserv_repo.AddReservationInfo(resinfo);
                _repositoryp.CurrentSum = textBoxSum.Text;
                NavigationService.Navigate(new CreditCardPage(_reserv_repo, _repository, _repositoryp));

                RefreshListBox();
                textBoxSum.Visibility        = Visibility.Hidden;
                comboBoxRooms.IsEnabled      = false;
                buttonDateApproved.IsEnabled = false;
                buttonApproveAll.IsEnabled   = false;
            }
        }
Ejemplo n.º 5
0
            public override bool ReserveCar(DateTime startDateTime, int days)
            {
                var res = new ReservationInfo(CarSpecs)
                {
                    Duration      = days,
                    StartDateTime = startDateTime
                };

                if (vanInfo.ContainsKey(res.CarSpecs))
                {
                    var key     = vanInfo[res.CarSpecs].Last();
                    var endDate = key.StartDateTime.AddDays(key.Duration);
                    if (res.StartDateTime > endDate)
                    {
                        vanInfo[res.CarSpecs].Add(res);
                        OnCarReserved(res);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    vanInfo[res.CarSpecs] = new List <ReservationInfo> {
                        res
                    };
                    OnCarReserved(res);
                }
                return(true);
            }
Ejemplo n.º 6
0
 void OnReservationCancelled(object sender, ReservationInfo r)
 {
     Activity.RunOnUiThread(async delegate
     {
         await OnRefreshViewAsync();
     });
 }
Ejemplo n.º 7
0
        public bool ReservationMSMQ()
        {
            bool success = false;
            clsReservationMSMQ myResMSMQ = new clsReservationMSMQ();
            ReservationInfo    myRI      = new ReservationInfo();
            clsMSMQ            myMSMQ    = new clsMSMQ();

            myRI = myMSMQ.LireMSMQ();

            int resVol   = vol.reservationVol(myRI.nom, myRI.prenom, myRI.idVol);
            int resHotel = hotel.reservationHotel(myRI.nom, myRI.prenom, myRI.idHotel);

            if (resHotel != -1 && resVol != -1)
            {
                vol.commit();
                hotel.commit();
                myMSMQ.receive();
            }
            else
            {
                vol.rollback();
                hotel.rollback();
            }

            myMSMQ.close();
            success = true;
            return(success);
        }
Ejemplo n.º 8
0
        private void sendReservationMail(int servicePId)
        {
            ServicePassenger sP         = Current.Context.ServicePassenger.FirstOrDefault(d => d.Id == servicePId);
            User             mailToUser = Current.Context.User.FirstOrDefault(f => f.Id == sP.AddUserId);
            vwCarList        carDetail  = Current.Context.vwCarList.FirstOrDefault(d => d.Id == sP.ServiceId);

            if (!string.IsNullOrEmpty(mailToUser.Email))
            {
                ReservationInfo newLayout = new ReservationInfo
                {
                    Name        = mailToUser.Name + " " + mailToUser.Surname,
                    DateString  = ((DateTime)carDetail.DepartureDate).ToString("dd/MM/yyyy"),
                    TimeString  = carDetail.DepartureHour,
                    Destination = carDetail.DestinationBox,
                    Address     = carDetail.Address
                };

                string ContentMessage = ViewRenderer.RenderView("~/Views/Shared/MailLayouts/Reservation.cshtml",
                                                                newLayout, ControllerContext);

                Mail newMail = new Mail
                {
                    MailTo      = mailToUser.Id,
                    MailFrom    = 1,
                    MailContent = ContentMessage,
                    Status      = Constants.MAIL_STATUS_WAITING,
                    MailSubject = "Rezervasyon Bilgisi"
                };
                Current.Context.Mail.Add(newMail);
                Current.Context.SaveChanges();
                SecimMail.MailGonder(mailToUser.Id, "Rezervasyon Bilgisi", ContentMessage, newMail.id);
            }
        }
Ejemplo n.º 9
0
        public IActionResult ChooseData(string lastName)
        {
            var reservation = new ReservationInfo();

            reservation.lastNameTherapist = lastName;
            return(View(reservation));
        }
Ejemplo n.º 10
0
        public string SaveReservationInfo(ReservationInfo r)
        {
            List <ReservationInfo> res = new List <ReservationInfo>();

            res.Add(r);

            DataTable dtReservationInfo = CollectionHelper.ConvertTo <ReservationInfo>(res, "flightPlan");
            DataTable dtFlightPlan      = CollectionHelper.ConvertTo <FlightPlan>(r.flightPlan, "");

            SqlParameter[] param = { new SqlParameter("@AWBInfo",      SqlDbType.Structured)
                                     {
                                         SqlValue = dtReservationInfo
                                     },
                                     new SqlParameter("@FlightPlan",   SqlDbType.Structured)
                                     {
                                         SqlValue = dtFlightPlan
                                     },
                                     new SqlParameter("@CreatedBy",   1),
                                     new SqlParameter("@ErrorMessage", SqlDbType.VarChar)
                                     {
                                         Direction = ParameterDirection.Output,Size = 250
                                     } };
            DataSet        ds = SqlHelper.ExecuteDataset(DMLConnectionString.WebConfigConnectionString, CommandType.StoredProcedure, "spReservation_SaveInfo", param);

            if (!string.IsNullOrEmpty(param[param.Length - 1].Value.ToString()))
            {
                return(param[param.Length - 1].Value.ToString());
            }
            else
            {
                return("");
            }
        }
        /// <summary>
        /// Manages the reservation workflow for the entire park
        /// </summary>
        /// <param name="park">The park information the reservtion is for</param>
        private void DisplayParkWideReservation(ParkItem park)
        {
            ReservationInfo reservationInfo = new ReservationInfo();
            List <SiteInfo> siteInfos       = new List <SiteInfo>();

            try
            {
                reservationInfo = GetReservationInfo(reservationInfo);
                var campgrounds = _db.GetCampgrounds(park.Id);
                foreach (var campground in campgrounds)
                {
                    reservationInfo.CampgroundId = campground.Id;
                    var sites = _db.GetSites(reservationInfo);
                    foreach (var site in sites)
                    {
                        siteInfos.Add(site.CreateSiteInfo(campground.DailyFee, campground.Name));
                    }
                }

                ReservationItem item = new ReservationItem();
                item.SiteId = GetSiteSelection(siteInfos, reservationInfo, "", true);
                DisplayCompleteReservation(reservationInfo, item);
                throw new ExitToMainException();
            }
            catch (ExitException)
            {
                // do nothing, the user cancelled the reservation process
            }
        }
Ejemplo n.º 12
0
        private void _returnButton_Click
        (
            object sender,
            EventArgs e
        )
        {
            ReservationInfo resource = CurrentResource;

            if (ReferenceEquals(resource, null))
            {
                return;
            }
            if (resource.Status == ReservationStatus.Free)
            {
                return;
            }

            Controller.Run
            (
                () =>
            {
                int index = _bindingSource.Position;
                resource  = Manager.ReleaseResource(resource);
                ReservationInfo[] array
                             = (ReservationInfo[])_bindingSource.DataSource;
                array[index] = resource;
            }
            );

            _bindingSource.ResetCurrentItem();
            Invalidate();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 根据给出的订座信息和OEM编号,生成订座指令字串。
        /// </summary>
        /// <param name="reservationInfo">订座信息</param>
        /// <param name="oemId">OEM编号</param>
        /// <returns>订座指令字串</returns>
        public static string GetBookingTicketsString(ReservationInfo reservationInfo, Guid oemId)
        {
            const ConfigUseType type = ConfigUseType.Reserve;
            var officeNumber         = GetOfficeNumber(oemId, type);

            return(CommandBuilderService.GetBookInstructionSet(reservationInfo, officeNumber));
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 机票预定
        /// </summary>
        /// <param name="reservationInfo">预订信息</param>
        /// <param name="oemId"> </param>
        /// <param name="officeNumber"> </param>
        /// <returns></returns>
        public static ExecuteResult <ReservedPnr> ReserveTickets(ReservationInfo reservationInfo, Guid oemId)
        {
            if (reservationInfo == null)
            {
                throw new ArgumentException("预订信息不能为空");
            }

            const ConfigUseType type = ConfigUseType.Reserve;
            var userName             = GetUserName(oemId, type);
            var officeNumber         = GetOfficeNumber(oemId, type);

            if (userName == null || officeNumber == null)
            {
                return(new ExecuteResult <ReservedPnr>
                {
                    Result = null,
                    Success = false,
                    Message = "OEM未设置可用配置,且没有设置使用平台配置。"
                });
            }

            var repository    = Factory.CreateCommandRepository();
            var executeResult = repository.Book(reservationInfo, officeNumber, userName);

            if (executeResult.Success)
            {
                var reservedPnr = executeResult.Result;
                var pnrHistory  = new PNRHistory(0, DateTime.Now, reservedPnr.PnrPair.PNR, reservedPnr.OfficeNo, 1);
                HistoryService.Save(pnrHistory);
                PidManagementService.SaveCounter(oemId, HasUsePlatformConfig(oemId, type));
            }

            return(executeResult);
        }
Ejemplo n.º 15
0
        public static void Navigate(Context context, ReservationInfo reservation)
        {
            Intent intent = new Intent(context, typeof(ReservationInfoActivity));

            intent.PutExtra("reservation", JsonConvert.SerializeObject(reservation));
            context.StartActivity(intent);
        }
Ejemplo n.º 16
0
 private void OnReservationCreated(object sender, ReservationInfo e)
 {
     Activity.RunOnUiThread(async delegate
     {
         await LoadReservations();
     });
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Transforms the <paramref name="listViewItem"/> to a reservation.
        /// </summary>
        /// <param name="listViewItem">Selected item to transform.</param>
        private void ListViewItemToReservation(ListViewItem listViewItem)
        {
            var email         = listViewItem.SubItems[3].Text;
            var reservationId = Convert.ToInt32(listViewItem.SubItems[0].Text);

            Person      = PersonProvider.GetPersonByEmail(email);
            Reservation = ReservationProvider.GetReservationById(reservationId);
        }
        public static ReservationInfo GetReservationInfo(RemoteWebDriver Driver, ReservationInfo info, bool IsTest = false)
        {
            string code = info.ReservationCode;

            // на страницу конкретного резерва
            //Driver.Navigate().GoToUrl(String.Format("https://www.airbnb.com/reservation/itinerary?code={0}", code));
            Driver.GoTo(String.Format("https://www.airbnb.com/reservation/itinerary?code={0}", code));

            WebDriverWait _wait = new WebDriverWait(Driver, new TimeSpan(0, 0, 30));

            // ждем пока загрузится
            _wait.Until(ExpectedConditions.ElementExists(By.Id("site-content")));

            //info.Item = Item;
            info.Code = code;

            // получаем даты и кол-во гостей
            var divTable = Driver.FindElementByCssSelector("div[class=\"row row-table row-space-2\"]");
            ReadOnlyCollection <IWebElement> dateDivs = divTable.FindElements(By.CssSelector("div[class=\"col-4 col-top\"]"));

            ReadOnlyCollection <IWebElement> checkInDivs = dateDivs[0].FindElements(By.CssSelector("div"));

            info.CheckIn = DateTime.Parse(checkInDivs[0].Text);
            ReadOnlyCollection <IWebElement> checkOutDivs = dateDivs[1].FindElements(By.CssSelector("div"));

            info.CheckOut = DateTime.Parse(checkOutDivs[0].Text);

            ReadOnlyCollection <IWebElement> numDivs   = divTable.FindElements(By.CssSelector("div[class=\"col-2 col-bottom\"]"));
            ReadOnlyCollection <IWebElement> adultDivs = numDivs[1].FindElements(By.CssSelector("div"));

            info.Adult = Int32.Parse(adultDivs[0].Text);

            // получаем денежные данные
            var payTable = Driver.FindElementByCssSelector("table[class=\"table payment-table\"]");
            ReadOnlyCollection <IWebElement> trs = payTable.FindElements(By.CssSelector("tr"));
            string strPrice = trs[0].FindElement(By.CssSelector("td")).Text;

            info.Price = Int32.Parse(strPrice.Substring(1));
            string strCleaning = trs[1].FindElement(By.CssSelector("td")).Text;

            info.CleaningFee = Int32.Parse(strCleaning.Substring(1));
            string strArnbnbFee = trs[2].FindElement(By.CssSelector("td")).Text;

            info.ArnbnbFee = Int32.Parse(strArnbnbFee.Substring(2).Substring(0, strArnbnbFee.Length - 3));
            string strTotal = trs[3].FindElement(By.CssSelector("td")).Text;

            info.TotalAmount = Int32.Parse(strTotal.Substring(1));

            // получаем имя юзера
            var mediaBodyDiv = Driver.FindElementByCssSelector("div[class=\"media-body\"]");
            var userLink     = mediaBodyDiv.FindElement(By.CssSelector("a"));

            string[] usernameParts = userLink.Text.Split(new char[] { ' ' });
            info.GuestFirstName = usernameParts[0];
            info.GuestLastName  = usernameParts[1];

            return(info);
        }
        /// <summary>
        /// Gets the reservation info from the user
        /// </summary>
        /// <param name="reservation">This is the object to add reservation info to. It already has campsite id populated.</param>
        /// <returns>The passed in reservation info with extra fields populated</returns>
        private ReservationInfo GetReservationInfo(ReservationInfo reservation)
        {
            bool validSelection = false;

            while (!validSelection)
            {
                reservation.FromDate = CLIHelper.GetDateTime("What is the arrival date  (mm/dd/yyyy)?");
                if (reservation.FromDate < DateTime.Now)
                {
                    Console.WriteLine("The arrival date cannot be earlier than today.");
                    var isTryAgain = CLIHelper.GetString(Message_ReEnterArrivalDate);
                    if (isTryAgain.ToLower() == "n")
                    {
                        throw new ExitException();
                    }
                }
                else
                {
                    validSelection = true;
                }
            }

            validSelection = false;
            while (!validSelection)
            {
                reservation.ToDate = CLIHelper.GetDateTime("What is the departure date (mm/dd/yyyy)?");
                if (reservation.ToDate < reservation.FromDate)
                {
                    Console.WriteLine("The departure date cannot be earlier than the arrival date.");
                    var isTryAgain = CLIHelper.GetString(Message_ReEnterDepartureDate);
                    if (isTryAgain.ToLower() == "n")
                    {
                        throw new ExitException();
                    }
                }
                else if ((reservation.ToDate - reservation.FromDate).Days <= 0)
                {
                    Console.WriteLine("The reservation length must be at least 1 day or more.");
                    var isTryAgain = CLIHelper.GetString(Message_ReEnterDepartureDate);
                    if (isTryAgain.ToLower() == "n")
                    {
                        throw new ExitException();
                    }
                }
                else
                {
                    validSelection = true;
                }
            }

            reservation.Occupancy    = CLIHelper.GetInteger("What are your occupancy requirements (1-55)?", 1, 55);
            reservation.IsAccessible = CLIHelper.GetBool("Do you need handicap accessiblity (true/false)?");
            reservation.HasUtilities = CLIHelper.GetBool("Do you need utilities (true/false)?");
            reservation.RvLength     = CLIHelper.GetInteger("What is your minimum RV length requirements (0-35)?", 0, 35);

            return(reservation);
        }
        /// <summary>
        /// Creates new instance of AddReservationReviewForm.
        /// </summary>
        /// <param name="person">Person's data to display.</param>
        /// <param name="apartment">Apartment data to display.</param>
        /// <param name="reservation">Reservation details to display.</param>
        public AddReservationReviewForm(PersonInfo person, ApartmentInfo apartment, ReservationInfo reservation)
        {
            InitializeComponent();

            Person      = person;
            Apartment   = apartment;
            Reservation = reservation;

            InitializeLabelsText();
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Allows user to input their info to make a reservation
        /// </summary>
        private void MakeReservation(ReservationInfo info, List <Site> sites)
        {
            bool makeReservation = false;

            while (!makeReservation)
            {
                Console.WriteLine(SiteInfo(sites));
                Console.WriteLine("Please enter the number of the site you wish to book, 0 to cancel");
                int siteNumber = -1;
                try
                {
                    siteNumber = Convert.ToInt32(Console.ReadLine());
                }
                catch (FormatException)
                {
                    Console.WriteLine("");
                }
                if (VerifySite(siteNumber, sites))
                {
                    Console.WriteLine("Please enter your name for our reservation records...");
                    string nameEntered = Console.ReadLine();
                    Console.Clear();
                    Console.WriteLine("Does your reservation information appear correct?");
                    Console.WriteLine();
                    Console.WriteLine("Name: {0}| For Site# {1} | For {2} to {3}", nameEntered,
                                      siteNumber, _arrivalDate.ToString("MM/dd/yyyy"), _departureDate.ToString("MM/dd/yyyy"));
                    Console.WriteLine();
                    Console.WriteLine("Enter Y to confirm, any other key to cancel");
                    string confirmReservation = Console.ReadLine().ToUpper();
                    if (confirmReservation == "Y")
                    {
                        var confirmationNum = _campgroundDAO.CreateReservation(siteNumber, nameEntered, info, sites);
                        Console.WriteLine($"Thank you! Your confirmation number is {confirmationNum}");
                        Console.ReadKey();
                        makeReservation = true;
                    }
                    else
                    {
                        Console.WriteLine("Please press any key to continue...");
                        Console.ReadKey();
                        Console.Clear();
                    }
                }
                else if (siteNumber == 0)
                {
                    makeReservation = true;
                }
                else
                {
                    Console.WriteLine("You have chosen an invalid campsite, press any key to continue");
                    Console.ReadKey();
                    Console.Clear();
                }
            }
        }
Ejemplo n.º 22
0
        public void putInMSMQQueue(int idHotel, int idVol, string nom, string prenom)
        {
            ReservationInfo resService = new ReservationInfo();

            resService.idHotel = idHotel;
            resService.idVol   = idVol;
            resService.prenom  = prenom;
            resService.nom     = nom;
            MessageQueue MyMQ = new MessageQueue(@".\private$\ResaVolsHotels");

            MyMQ.Send(resService, "EnregistrementVolsHotels");
            MyMQ.Close();
        }
Ejemplo n.º 23
0
        public void AddReservation(ReservationInfo reservation)
        {
            string   cs       = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            Car      car      = carMethods.GetCarByRegnum(reservation.Regnumber);
            Customer customer = customerMethods.GetCustomer("lastname", reservation.LastName);

            using (SqlConnection con = new SqlConnection(cs))
            {
                SqlCommand cmd = new SqlCommand("spAddNewReservation", con);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter parameterCarId = new SqlParameter
                {
                    ParameterName = "@CarId",
                    Value         = car.Id
                };
                cmd.Parameters.Add(parameterCarId);

                SqlParameter parameterCustomerId = new SqlParameter
                {
                    ParameterName = "@CustomerId",
                    Value         = customer.Id
                };
                cmd.Parameters.Add(parameterCustomerId);

                SqlParameter parameterStartDate = new SqlParameter
                {
                    ParameterName = "@StartDate",
                    Value         = reservation.StartDate
                };
                cmd.Parameters.Add(parameterStartDate);

                SqlParameter parameterEndDate = new SqlParameter
                {
                    ParameterName = "@EndDate",
                    Value         = reservation.EndDate
                };
                cmd.Parameters.Add(parameterEndDate);

                SqlParameter parameterReturned = new SqlParameter
                {
                    ParameterName = "@Returned",
                    Value         = reservation.Returned
                };
                cmd.Parameters.Add(parameterReturned);

                con.Open();
                cmd.ExecuteNonQuery();
            }
        }
Ejemplo n.º 24
0
        public ListReservationsInfo GetAvailableCars(ReservationRequestByDate request)
        {
            if (request.LicenseKey != "SuperSecret123")
            {
                throw new WebFaultException <string>(
                          "Wrong license key",
                          HttpStatusCode.Forbidden);
            }
            else
            {
                ICollection <Reservation>     reservations = new List <Reservation>();
                ICollection <ReservationInfo> ri           = new List <ReservationInfo>();

                string cs = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

                using (SqlConnection con = new SqlConnection(cs))
                {
                    SqlCommand cmd = new SqlCommand("spGetAvailableCars", con);
                    cmd.CommandType = CommandType.StoredProcedure;

                    SqlParameter parameterStartdate = new SqlParameter();
                    SqlParameter parameterEnddate   = new SqlParameter();
                    parameterStartdate.ParameterName = "@Startdate";
                    parameterEnddate.ParameterName   = "@Enddate";
                    parameterStartdate.Value         = Convert.ToDateTime(request.Startdate);
                    parameterEnddate.Value           = Convert.ToDateTime(request.Enddate);

                    cmd.Parameters.Add(parameterStartdate);
                    cmd.Parameters.Add(parameterEnddate);


                    con.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        ReservationInfo reserv = new ReservationInfo()
                        {
                            Brand     = reader["Brand"].ToString(),
                            Model     = reader["Model"].ToString(),
                            Regnumber = reader["Regnumber"].ToString(),
                            Year      = Convert.ToInt32(reader["Year"]),
                            StartDate = Convert.ToDateTime(reader["StartDate"]),
                            EndDate   = Convert.ToDateTime(reader["EndDate"])
                        };
                        ri.Add(reserv);
                    }
                }
                return(new ListReservationsInfo(ri));
            }
        }
Ejemplo n.º 25
0
 public void UpdateReservation(Reservation reservation, Guest guest, ReservationInfo resInfo)
 {
     reservation.LastVersionJson = JsonHandler.SerializeToJson(reservation);
     reservation.State           = (State)resInfo.StateInt;
     reservation.Source          = (Source)resInfo.SourceInt;
     reservation.Room            = Context.Rooms.FirstOrDefault(r => r.FullRoomNumber == resInfo.Room);
     reservation.Guest           = guest;
     reservation.StartDate       = resInfo.StartDate;
     reservation.EndDate         = resInfo.EndDate;
     reservation.TotalSum        = resInfo.TotalSum;
     reservation.NumberOfGuests  = resInfo.NumberOfGuests;
     reservation.Notes           = resInfo.Notes;
     reservation.DateModified    = DateTime.Now;
 }
Ejemplo n.º 26
0
        private async Task DigestActionInput(DialogContext dc, ReservationInfo reservationInfo, CancellationToken cancellationToken)
        {
            var state = await _conversationStateAccessor.GetAsync(dc.Context, () => new RestaurantBookingState(), cancellationToken);

            state.Booking.Category        = reservationInfo.FoodType;
            state.Booking.ReservationDate = DateTime.Parse(reservationInfo.Date);
            state.Booking.ReservationTime = DateTime.Parse(reservationInfo.Time);
            state.Booking.AttendeeCount   = reservationInfo.AttendeeCount;

            // Note: Now there is no actual action to book a place. So we only save Name.
            state.Booking.BookingPlace = new BookingPlace()
            {
                Name = reservationInfo.RestaurantName
            };
        }
Ejemplo n.º 27
0
 public ReservationWindow(ReservationInfo resInfo, MainController controller)
     : this(controller, resInfo.StateInt, resInfo.SourceInt, resInfo.Room, resInfo.StartDate)
 {
     id    = resInfo.Id;
     Title = $"Редактиране на резервация номер: {id}";
     GuestName.AutoTextBox.Text     = resInfo.GuestName;
     GuestReferrer.AutoTextBox.Text = resInfo.GuestReferrer;
     EndDate.SelectedDate           = resInfo.EndDate;
     Nights.IntBox.Text             = $"{(resInfo.EndDate - resInfo.StartDate).Days}";
     GuestsInRoom.IntBox.Text       = $"{resInfo.NumberOfGuests}";
     TotalPrice.DecimalBox.Text     = $"{resInfo.TotalSum}";
     PaidSum.DecimalBox.Text        = $"{resInfo.PaidSum}";
     RemainingSum.DecimalBox.Text   = $"{resInfo.TotalSum - resInfo.PaidSum}";
     Notes.Text = resInfo.Notes;
 }
        /// <summary>
        /// Displays the reservation info to the user
        /// </summary>
        /// <param name="reservation">The reservation info used to filter the campsite selection options</param>
        /// <param name="item">The reservation details</param>
        private void DisplayCompleteReservation(ReservationInfo reservation, ReservationItem item)
        {
            item.Name = CLIHelper.GetString("What name should the reservation be made under?");

            item.FromDate    = reservation.FromDate;
            item.ToDate      = reservation.ToDate;
            item.CreatedDate = DateTime.UtcNow;

            var confirmationId = _db.MakeReservation(item, _userMgr.User.Id);

            Console.WriteLine();
            Console.WriteLine($"The reservation has been made and the confirmation id is {confirmationId}");
            Console.WriteLine(Message_PressKeyContinue);
            Console.ReadKey();
        }
Ejemplo n.º 29
0
        public Reservation(ReservationInfo resInfo)
        {
            Period period = new Period(resInfo.StartDate, resInfo.EndDate);
            Sums   sums   = new Sums(resInfo.TotalSum, resInfo.PaidSum);

            Id           = resInfo.Id;
            State        = (State)resInfo.StateInt;
            Source       = (Source)resInfo.SourceInt;
            Room         = resInfo.Room;
            GuestName    = resInfo.GuestName;
            Period       = period;
            GuestsInRoom = resInfo.NumberOfGuests;
            Sums         = sums;
            Notes        = resInfo.Notes;
        }
        public void WhenCreated_DateTimeGetsSetRight_WhenHourSelected()
        {
            Location        startLocaion    = Location.Antwerpen;
            Location        endLocation     = Location.Antwerpen;
            Arrangement     arrangement     = Arrangement.Airport;
            DateTime        startDay        = new DateTime(2020, 5, 9);
            DateTime        endDay          = new DateTime(2020, 5, 9);
            DeliveryAddress deliveryAddress = new DeliveryAddress();
            int             startH          = 8;
            int             endH            = 14;
            ReservationInfo r = new ReservationInfo(startLocaion, endLocation, startDay, arrangement, endDay, deliveryAddress, startH, endH);

            r.StartTime.Hour.ShouldBe(startH);
            r.EndTime.Hour.ShouldBe(endH);
        }