Example #1
0
        public static StayStatus getStatus(Int32 bookingId)
        {
            StayStatus status = new StayStatus();

            status.isCheckIn  = isCheckIn(bookingId);
            status.isExist    = isExist(bookingId);
            status.isHotel    = RegisterStayHelper.isHotel(bookingId);
            status.wasCharged = wasCharged(bookingId);

            return(status);
        }
 private void showMessage(StayStatus status)
 {
     if (!status.isExist)
     {
         MessageBox.Show("No existe estadia para la reserva", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (!status.isHotel)
     {
         MessageBox.Show("La estadia de la reserva no pertenece a este hotel", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (status.isCheckIn)
     {
         MessageBox.Show("La estadia de la reserva solo tiene checkin", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (status.wasCharged)
     {
         MessageBox.Show("La estadia de la reserva ya fue facturada", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            if (textBoxBooking.Text == String.Empty)
            {
                MessageBox.Show("Debe ingresar un numero de reserva a facturar");
                return;
            }

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

            ChargeStayHelper.search(bookingId, dgvStay);

            buttonCharge.Enabled = false;
            if (dgvStay.RowCount < 1)
            {
                StayStatus status = ChargeStayHelper.getStatus(bookingId);
                showMessage(status);
            }
            else
            {
                buttonCharge.Enabled = true;
            }
        }