private void buttonCheckOut_Click(object sender, EventArgs e)
 {
     if (dgvBooking.CurrentRow != null)
     {
         Int32 bookingId = Convert.ToInt32(dgvBooking.CurrentRow.Cells[0].Value);
         RegisterStayHelper.checkout(bookingId);
         MessageBox.Show("Se genero el checkout de la reserva correctamente", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         TextBoxHelper.clean(this);
         DataGridViewHelper.clean(dgvBooking);
         this.buttonCheckOut.Enabled = false;
     }
     else
     {
         MessageBox.Show("Debe seleccionar un reserva para generarle el checkout", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            if (textBoxBookingId.Text == String.Empty)
            {
                MessageBox.Show("Debe ingresar un numero de reserva a registrar");
                return;
            }

            Int32 bookingId = Convert.ToInt32(textBoxBookingId.Text);

            RegisterStayHelper.search(bookingId, dgvBooking);

            buttonCheckIn.Enabled  = false;
            buttonCheckOut.Enabled = false;
            if (dgvBooking.RowCount < 1)
            {
                BookingStatus status = RegisterStayHelper.bookingStatus(bookingId);
                showMessageError(status);
                Boolean isBookingMustBeCancelForNoPresentation = RegisterStayHelper.checkIsMustBeCancelled(bookingId);
                if (isBookingMustBeCancelForNoPresentation)
                {
                    MessageBox.Show("Se cancelo la reserva por pasarse del tiempo del checkIn", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                Boolean existFullStay = RegisterStayHelper.existFullStay(bookingId);
                if (!existFullStay)
                {
                    Boolean forCheckIn = RegisterStayHelper.isForCheckIn(bookingId);
                    if (forCheckIn)
                    {
                        buttonCheckIn.Enabled = true;
                    }
                    else
                    {
                        buttonCheckOut.Enabled = true;
                    }
                }
                else
                {
                    MessageBox.Show("Ya existe un checkin y un checkout para esta reserva");
                }
            }
        }
Example #3
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            Boolean isValid = checkIfCountPersonIsCorrect();

            if (isValid)
            {
                isValid = checkIfNotRepeteadClient();
                if (isValid)
                {
                    Int32 stayId = RegisterStayHelper.generateStay(bookingId);

                    RegisterStayHelper.saveStayClients(stayId, getClientsIds());

                    MessageBox.Show("Se ha generado la estadia correctamente", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.closeWindow();
                }
                else
                {
                    MessageBox.Show("Existen numeros de clientes repetidos", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }