Пример #1
0
        private void returnButton_Click(object sender, EventArgs e)
        {
            GuestPanel guestPanel = new GuestPanel(hotel);

            this.Hide();
            guestPanel.Show();
        }
Пример #2
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            if (ValidateName(nameTextBox) && ValidateDate(arrivalDateTimePicker, departureDateTimePicker))
            {
                Guest g = new Guest
                {
                    Login         = nameTextBox.Text,
                    ArrivalDate   = arrivalDateTimePicker.Value,
                    DepartureDate = departureDateTimePicker.Value
                };
                hotel.AddGuest(g);
                hotel.Save();

                GuestPanel guestPanel = new GuestPanel(hotel);
                this.Hide();
                guestPanel.Show();
            }
            else
            {
                nameTextBox.Clear();
                arrivalDateTimePicker.Value   = DateTime.Today - TimeSpan.FromDays(1);
                departureDateTimePicker.Value = DateTime.Today;
            }
        }