예제 #1
0
 public AnimalCentre()
 {
     animalFactory    = new AnimalFactory();
     hotelFactory     = new HotelFactory();
     procedureFactory = new ProcedureFactory();
     hotel            = hotelFactory.CreateHotel();
 }
        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;
                }
            }
        }
예제 #3
0
        public void checkDelTour()
        {
            countries contr = new countries();

            countries.dataCountries.Rows.Add("1", "Америка");
            Countries_Col obj = new Countries_Col();

            hotels hot = new hotels();

            hotels.dataHotels.Rows.Add("1", "hotel", "****", "12000");
            HotelFactory hotelfac = new HotelFactory();

            tours formTour = new tours();

            tours.dataTours.Rows.Add("1", "tour", "VIP туры", "Россия", "True", "hotel", "Автобус", "BB", "12000", "Рубль");
            tours.dataTours.Rows.Add("2", "tour", "VIP туры", "Россия", "True", "hotel", "Автобус", "BB", "12000", "Рубль");
            tours.dataTours.Rows.Add("3", "tour", "VIP туры", "Россия", "True", "hotel", "Автобус", "BB", "12000", "Рубль");

            FoodCol      food     = new FoodCol();
            TransportCol tr       = new TransportCol();
            TourTypeCol  tourtype = new TourTypeCol();

            TourFactory factTour = new TourFactory();
            int         a        = TourFactory.count();

            TourFactory.DeleteTour(1);
            Assert.AreEqual(a - 1, TourFactory.count());
        }
예제 #4
0
        public void PrintOutput(List <string> lines)
        {
            var requests = BookingService.BuildSearchRequest(lines);
            var result   = requests.Select(_ => Booking.GetCheapestHotel(_, HotelFactory.GetHotelFactory()));

            foreach (var hotel in result)
            {
                Console.WriteLine($"{hotel.Hotel.Name}");
            }
        }
예제 #5
0
        public void checkAddOrder()
        {
            string[] order = new string[7];
            order[0] = "225";
            order[1] = "Petr";
            order[2] = "Vasya";
            order[3] = "12 may 2013";
            order[4] = "tour";

            clients formCL = new clients();

            clients.dataClients.Rows.Add("1", "Pet", "*****@*****.**", "88-88", "12 may 1990", "true", "VIP");
            ClientTypeCol col    = new ClientTypeCol();
            ClientFactory factCl = new ClientFactory();

            managers formMan = new managers();

            managers.dataManagers.Rows.Add("1", "Petya", "8888", "Менеджер", "petya");
            ManagerTypeCol coll    = new ManagerTypeCol();
            ManagerFactory factMan = new ManagerFactory();

            orders formOrd = new orders();

            orders.dataOrders.Rows.Add("Pet", "Petya", "12 may 2015", "1", "tour1");
            orders.dataOrders.Rows.Add("Pet", "Petya", "13 may 2014", "2", "tou2");
            orders.dataOrders.Rows.Add("Pet", "Petya", "14 may 2014", "3", "tou3");

            countries contr = new countries();

            countries.dataCountries.Rows.Add("1", "Россия");
            Countries_Col obj = new Countries_Col();

            hotels hot = new hotels();

            hotels.dataHotels.Rows.Add("1", "hotel", "****", "12000");
            HotelFactory hotelfac = new HotelFactory();

            FoodCol      food     = new FoodCol();
            TransportCol tr       = new TransportCol();
            TourTypeCol  tourtype = new TourTypeCol();

            tours formTour = new tours();

            tours.dataTours.Rows.Add("1", "tour", "VIP туры", "Россия", "true", "hotel", "Автобус", "BB", "12000", "Рубль");
            TourFactory  factTour = new TourFactory();
            OrderFactory fact     = new OrderFactory();
            int          a        = OrderFactory.count();

            OrderFactory.AddOrder(order);
            Assert.AreEqual(a + 1, OrderFactory.count());
        }
예제 #6
0
        /// <summary>
        /// Create hotel on basis of user input
        /// </summary>
        static void CreateHotel()
        {
            Console.WriteLine("Creating Hotel..");
            Console.WriteLine("Enter Number of Floors");
            var floors = Console.ReadLine();

            Console.WriteLine("Main Corridors per floor");
            var mainCorridors = Console.ReadLine();

            Console.WriteLine("Sub Corridors per floor");
            var subCorridors = Console.ReadLine();

            HotelFactory.CreateHotel(Convert.ToInt32(floors), Convert.ToInt32(mainCorridors), Convert.ToInt32(subCorridors));
        }
예제 #7
0
        public void GetCheapestHotel_ValidInput_ReturnCheapestHotelName(string input, string expected)
        {
            //Arrange
            BookingRequest bookingRequest = BookingService.BuildBookingRequest(input);
            IList <Hotel>  defaultHotels  = HotelFactory.GetHotelFactory();

            //Act
            var result = Booking
                         .GetCheapestHotel(bookingRequest, defaultHotels)
                         .Hotel
                         .Name;

            //Assert
            Assert.Equal(result, expected);
        }
예제 #8
0
        private void AddTour_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < HotelFactory.count(); i++)
            {
                comboBox2.Items.Add(HotelFactory.array_Hotels[i]._name);
            }

            for (int i = 0; i < TourTypeCol.count(); i++)
            {
                comboBox1.Items.Add(TourTypeCol.list[i].Name);
            }

            for (int i = 0; i < Countries_Col.count(); i++)
            {
                comboBox5.Items.Add(Countries_Col.Coll_of_country[i].Name);
            }
        }
예제 #9
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 = "";
            }
        }
예제 #10
0
        public void checkAddTour()
        {
            string[] tour = new string[10];
            tour[0] = "2";
            tour[1] = "tour1";
            tour[2] = "VIP туры";
            tour[3] = "true";
            tour[4] = "hotel";
            tour[5] = "Авиа";
            tour[6] = "HB";
            tour[7] = "35500";
            tour[8] = "Доллар";
            tour[9] = "Америка";

            countries contr = new countries();

            countries.dataCountries.Rows.Add("1", "Америка");
            Countries_Col obj = new Countries_Col();

            hotels hot = new hotels();

            hotels.dataHotels.Rows.Add("1", "hotel", "****", "12000");
            HotelFactory hotelfac = new HotelFactory();

            tours formTour = new tours();

            tours.dataTours.Rows.Add("1", "tour", "VIP туры", "Россия", "True", "hotel", "Автобус", "BB", "12000", "Рубль");

            FoodCol      food     = new FoodCol();
            TransportCol tr       = new TransportCol();
            TourTypeCol  tourtype = new TourTypeCol();

            TourFactory factTour = new TourFactory();
            int         a        = TourFactory.count();

            TourFactory.Add_Tour(tour);
            Assert.AreEqual(a + 1, TourFactory.count());
        }
예제 #11
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);
        }