private void CreateFilesForm_Load(object sender, EventArgs e)
        {
            progressBar1.Step  = 1;
            progressBar1.Value = 0;
            int x = 100;
            int y = 100;

            list = ListOfResevations();
            foreach (ReservationType res in list)
            {
                id = res.hotelId;
                if (!CheckOpened(res.hotelId))
                {
                    frm = new ListenerForm(id, HotelFactory.GetHotelName(id), f);
                    frm.Show();
                    frm.Location = new Point(x, y);
                    listenerList.Add(frm);
                    x += 1200;
                }
                if (x == 2500)
                {
                    y += 300;
                    x  = 100;
                }
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool        foundR        = false;
            String      reservationid = reservationBox.Text.Trim();
            dezerialize d             = new dezerialize();

            reservations = d.dezerializeReservation();
            if (reservations == null)
            {
                found.Text        = "Reservation \n not Found";
                Hotellbl.Text     = "";
                costlbl.Text      = "";
                numNightslbl.Text = "";
                startDatelbl.Text = "";;
            }
            else
            {
                foreach (ReservationType reserv in reservations)
                {
                    if (reserv.reservationId.Equals(reservationid))
                    {
                        String year  = reserv.startDate.Substring(0, 4);
                        String month = reserv.startDate.Substring(4, 2);
                        String day   = reserv.startDate.Substring(6, 2);

                        Hotellbl.Text     = HotelFactory.GetHotelName(reserv.hotelId);
                        costlbl.Text      = "$" + reserv.cost.ToString() + ".00";
                        numNightslbl.Text = reserv.numDays.ToString();
                        startDatelbl.Text = month + "/" + day + "/" + year;
                        found.Text        = "Reservation Found";
                        foundR            = true;
                        break;
                    }
                }
            }
            if (!foundR)
            {
                found.Text        = "Reservation \n not Found";
                Hotellbl.Text     = "";
                costlbl.Text      = "";
                numNightslbl.Text = "";
                startDatelbl.Text = "";
            }
        }
Пример #3
0
        public ReservationType generation()
        {
            String           sd = monthCalendar1.SelectionStart.ToString("yyyyMMdd");
            String           cusID;
            randomGeneration ran = new randomGeneration();

            cusID = ran.getCustID();

            ReservationType reservation = new ReservationType(hotelID(), sd, getDateDifference(), cusID, hotelRoom());

            if (r.ReserveRoom(reservation))
            {
                String year  = reservation.startDate.Substring(0, 4);
                String month = reservation.startDate.Substring(4, 2);
                String day   = reservation.startDate.Substring(6, 2);

                MessageBox.Show("The reservation was: " + reservation.result + ".Customer " + reservation.customerId + "  RESERVERD  " + reservation.roomType + " ROOM  for  " + reservation.numDays + " days Starting   " + month + "/" + day + "/" + year + " - $" + reservation.cost);
                String email = EmailBox.Text;
                Console.WriteLine(email);
                MailMessage message = new MailMessage();
                SmtpClient  client  = new SmtpClient();
                client.Host        = "smtp.gmail.com";
                client.Port        = 587;
                client.EnableSsl   = true;
                client.Credentials = new NetworkCredential("*****@*****.**", "danielandmaria");

                String boo = "Hello " + nameBox.Text + "!!!\n You just reserved a room in " + HotelFactory.GetHotelName(reservation.hotelId) + "\n " + "Your reservation starts: " + month + "/" + day + "/" + year + " for " + reservation.numDays + " nights " + ". The total cost of your reservation is $" + reservation.cost + ".\nTo keep track of your reservation: " + reservation.reservationId + "\n We hope you have an amazing time and thanks for choosing us!!.";
                try
                {
                    MailMessage mail = new MailMessage();
                    mail.From = new MailAddress("*****@*****.**");
                    mail.To.Add(email);
                    mail.Subject = "Information from your reservation!!";
                    mail.Body    = boo;

                    client.Send(mail);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Cannot email the reservation");
                    //MessageBox.Show(ex.ToString());
                }
            }
            else
            {
                MessageBox.Show("Cannot reserve because: " + reservation.result);
            }

            return(reservation);
        }