Ejemplo n.º 1
0
 public void Load()
 {
     if (continueApp() == null)
     {
         StartAppTime = DateTime.Today.Date;
         //the first time the program opens
         //that is, if there is no recorded history
         firstBoot();
     }
     else
     {
         obj       = (App)continueApp();
         obj.admin = Administration.getInstance(obj);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// auto adds hotels
        /// default 30 otel and random Rooms
        /// </summary>
        private void firstBoot()
        {
            //added default instance
            hotels = new List <Hotel>();
            users  = new List <User>();
            admin  = Administration.getInstance("admin1", "password1", "Mustafa Firat", "YILMAZ", "21");
            users.Add(new User("user001", "password001", "name", "surname", "99"));
            users.Add(new User("user002", "password002", "name", "surname", "99"));
            users.Add(new User("user003", "password003", "name", "surname", "99"));
            users.Add(new User("user004", "password004", "name", "surname", "99"));
            users.Add(new User("user005", "password005", "name", "surname", "99"));

            int    n = 1;
            string defaultHotelName = "Hotel" + n;

            //added hotel
            Random random = new Random();
            int    k;
            string type = null;

            string[] data = { "ISTANBUL", "CANAKKALE", "IZMIR", "KOCAELI", "ANKARA", "ANTALYA", "MUGLA", "VAN", "KARS", "ESKISEHIR" };
            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    k    = random.Next(1, 6);
                    type = null;

                    switch (k)
                    {
                    case 1:
                    {
                        type = "Hostel";
                        break;
                    }

                    case 2:
                    {
                        type = "BoutiqueHotel";
                        break;
                    }

                    case 3:
                    {
                        type = "AllInHotel";
                        break;
                    }

                    case 4:
                    {
                        type = "HolidayVillage";
                        break;
                    }

                    case 5:
                    {
                        type = "UltraLuxuryHotel";
                        break;
                    }
                    }
                    hotels.Add(HotelFactory.GetHotel(type, data[i], defaultHotelName));

                    n++;
                    defaultHotelName = "Hotel" + n;
                }
            }
            //added Rooms
            for (int i = 0; i < hotels.Count; i++)
            {
                addRoom(hotels[i]);
            }
        }