Exemplo n.º 1
0
        private void CheckReservationBtn_Click(object sender, EventArgs e)
        {
            if (StartDateTimePicker.Value < EndDateTimePicker.Value && CategorylistBox.SelectedItem != null && NumOfBedlistBox.SelectedItem != null && NationalIDtextBox.Text != null)
            {
                ReservationData = new CheckReservationData {
                    StartDate    = StartDateTimePicker.Value,
                    EndDate      = EndDateTimePicker.Value,
                    CategoryID   = ((Category)CategorylistBox.SelectedItem).CategoryId,
                    NumOfBedId   = ((BedNum)NumOfBedlistBox.SelectedItem).BedsId,
                    NationaltyID = NationalIDtextBox.Text
                };

                RestRequest request = new RestRequest("admin/CheckReservation", DataFormat.Json);
                request.AddJsonBody(ReservationData);
                var response = Global.client.Post(request);

                ConfirmReservationData Data = JsonConvert.DeserializeObject <ConfirmReservationData>(response.Content);

                if (Data.Room.RoomId != 0)
                {
                    ReservationForm reservationFormData = new ReservationForm {
                        NationalID = NationalIDtextBox.Text,
                        StartDate  = StartDateTimePicker.Value,
                        EndDate    = EndDateTimePicker.Value,
                        RoomID     = Data.Room.RoomId,
                        TotalPrice = Data.TotalPrice,
                        RoomNum    = Data.Room.RoomNum
                    };

                    if (Data.GuestCode != 0)
                    {
                        reservationFormData.GuestCode    = Data.GuestCode;
                        reservationFormData.GuestAddress = Data.GuestAddress;
                        reservationFormData.GuestName    = Data.GuestName;
                        reservationFormData.Nationality  = Data.Nationality;
                        reservationFormData.PhoneNumber  = Data.PhoneNumber;
                        reservationFormData.Gender       = Data.Gender;
                    }

                    ConfirmReservation ReservationForm = new ConfirmReservation(reservationFormData);
                    ReservationForm.Show();
                }
                else
                {
                    DateMsgLabel.Text = "UnAvailable Rooms ";
                }
            }
            else
            {
                DateMsgLabel.Text = "Incorrect  Date ";
            }
        }
Exemplo n.º 2
0
        private void NewBtn_Click(object sender, EventArgs e)
        {
            if (StratDateTimePicker.Value < EndDateTimePicker.Value && NationalIDtextBox != null)
            {
                NewRoomReservation NewReservationData = new NewRoomReservation
                {
                    StartDate  = StratDateTimePicker.Value,
                    EndDate    = EndDateTimePicker.Value,
                    RoomId     = Room.RoomId,
                    NationalId = NationalIDtextBox.Text
                };

                RestRequest request = new RestRequest("admin/RoomNewReservation", DataFormat.Json);
                request.AddJsonBody(NewReservationData);
                var response = Global.client.Post(request);


                ConfirmReservationData Data = JsonConvert.DeserializeObject <ConfirmReservationData>(response.Content);


                if (Data.Room.RoomId != 0)
                {
                    ReservationForm reservationFormData = new ReservationForm
                    {
                        NationalID = NationalIDtextBox.Text,
                        StartDate  = StratDateTimePicker.Value,
                        EndDate    = EndDateTimePicker.Value,
                        RoomID     = Data.Room.RoomId,
                        TotalPrice = Data.TotalPrice,
                        RoomNum    = Data.Room.RoomNum
                    };

                    if (Data.GuestCode != 0)
                    {
                        reservationFormData.GuestCode    = Data.GuestCode;
                        reservationFormData.GuestAddress = Data.GuestAddress;
                        reservationFormData.GuestName    = Data.GuestName;
                        reservationFormData.Nationality  = Data.Nationality;
                        reservationFormData.PhoneNumber  = Data.PhoneNumber;
                        reservationFormData.Gender       = Data.Gender;
                    }

                    ConfirmReservation ReservationForm = new ConfirmReservation(reservationFormData);
                    ReservationForm.Show();
                    this.Close();
                }
            }
        }
 public ConfirmReservation(ReservationForm _Data)
 {
     InitializeComponent();
     Data = _Data;
     Start();
 }