Beispiel #1
0
        private void btnSelectClient_Click(object sender, EventArgs e)
        {
            FormSearchClient frmSearchClient = new FormSearchClient();

            frmSearchClient.ShowDialog();
            _client = frmSearchClient.client;
            for (int i = 0; i < _checkInBLL.GetByActiveState().Data.Count; i++)
            {
                if (_checkInBLL.GetByActiveState().Data[i].ClientID == _client.ID)
                {
                    MessageBox.Show("Esse cliente já efetuou o check in.");
                    return;
                }
            }

            if (_client.ID != 0)
            {
                SelectClient();
            }
            for (int i = 0; i < _reservationBLL.GetByActiveState().Data.Count; i++)
            {
                if (_reservationBLL.GetByActiveState().Data[i].ClientID == _client.ID)
                {
                    DialogResult result = MessageBox.Show("Você possui uma reserva, deseja fazer o check in dessa reserva?", "", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {
                        FormSearchReservation frmSearchReservation = new FormSearchReservation(_client.CPF);
                        frmSearchReservation.ShowDialog();
                        _room               = frmSearchReservation.room;
                        _client             = frmSearchReservation.client;
                        _reservation        = frmSearchReservation.reservation;
                        _reservation.Active = false;
                        Response response = _reservationBLL.Update(_reservation);
                        if (!response.Success)
                        {
                            MessageBox.Show(response.Message);
                            return;
                        }
                        SelectClient();
                        SelectRoom();
                        SelectDate();
                    }
                }
            }
        }
Beispiel #2
0
 public static void VerifyReservation(object sender, ElapsedEventArgs e)
 {
     QueryResponse <List <Reservation> > response = _reservationBLL.GetByActiveState();
     {
         foreach (var reservation in response.Data)
         {
             if (DateTime.Now > reservation.EntryDate)
             {
                 reservation.Active = false;
                 _reservationBLL.Update(reservation);
             }
         }
     }
 }
Beispiel #3
0
        private void UpdateGrid()
        {
            dgvSearch.Rows.Clear();
            QueryResponse <List <Reservation> > response = _reservationBLL.GetByActiveState();

            if (!response.Success)
            {
                MessageBox.Show(response.Message);
                return;
            }
            List <Reservation> reservations = new List <Reservation>(response.Data);

            ConvertReservationGrid(reservations);

            InsertGrid(_reservationsGrid);
        }