Example #1
0
        /// <summary>
        /// Constractor Of Test Center To Create Facade And Token For Basic Users.
        /// </summary>
        public TestCenter()
        {
            adminFacade = new LoggedInAdministratorFacade();
            adminToken  = FlyingCenterConfig.basicToken;

            adminFacade.CreateNewCountry(adminToken, new Country()
            {
                Country_Name = "Israel",
            });


            airlineFacade = new LoggedInAirlineFacade();
            airlineToken  = new LoginToken <AirlineCompany> {
                User = new AirlineCompany(GetRandomNameForTestUsers(), "Airline " + GetRandomNameForTestUsers(), "123", (int)adminFacade.GetCountryByName("Israel").Id)
            };
            adminFacade.CreateNewAirline(adminToken, airlineToken.User);
            airlineToken.User = adminFacade.GetAirlineByUserName(adminToken, airlineToken.User.User_Name);

            customerFacade = new LoggedInCustomerFacade();
            customerToken  = new LoginToken <Customer> {
                User = new Customer("TestCustomer", "Ben Sadon", "Customer" + "Customer" + GetRandomNameForTestUsers(), "123", "Neria 28", "050", "3317")
            };
            adminFacade.CreateNewCustomer(adminToken, customerToken.User);
            customerToken.User = adminFacade.GetCustomerByUserName(adminToken, customerToken.User.User_Name);
        }
Example #2
0
        // 2. Read Random Country From API Web (Foriegn Key For Companies).
        public void ReadCountriesFromAPI(int times)
        {
            int success = 0;

            MainWindow.m_Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, new ThreadStart(new Action(() => ViewModel.Logger.Add("Start Create Countries..."))));
            for (int i = 0; i < times; i++)
            {
                HttpResponseMessage response = client.GetAsync("").Result;
                if (response.IsSuccessStatusCode)
                {
                    APIUser countryAPI = response.Content.ReadAsAsync <APIUser>().Result;
                    adminFacade.CreateNewCountry(adminToken, new Country(countryAPI.results[0].name.first));
                    MainWindow.m_Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, new ThreadStart(new Action(() => ViewModel.Logger[ViewModel.Logger.Count - 1] = $"- {i + 1}/{times} Countries Was Generated.")));
                    success++;
                }
                ViewModel.HowMuchCreated++;
            }
            if (times > 0)
            {
                log.Info($"\n{success} Countries Were Created And {times - success} Failed.\n");
                MainWindow.m_Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, new ThreadStart(new Action(() => ViewModel.Logger.Add($"- Countries Generator Is Over. ({success} Were Created And {times - success} Failed)."))));
            }
            else
            {
                MainWindow.m_Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, new ThreadStart(new Action(() => ViewModel.Logger[ViewModel.Logger.Count - 1] = $"- No Creation Request For Countries.")));
            }
        }
        private void Init_Customer_Facade_Data()
        {
            _logger.Debug($"Start Init Customer Tests Data");

            string username = "******";
            string password = "******";

            system.TryLogin(username, password, out ILoginToken admin_token, out FacadeBase admin_facade);
            LoggedInAdministratorFacade loggedInAdministratorFacade = admin_facade as LoggedInAdministratorFacade;
            LoginToken <Administrator>  adminLoginToken             = admin_token as LoginToken <Administrator>;
            int country_id = loggedInAdministratorFacade.CreateNewCountry(adminLoginToken, TestData.Get_Countries_Data()[0]);

            loggedInAdministratorFacade.CreateNewCountry(adminLoginToken, TestData.Get_Countries_Data()[1]);
            loggedInAdministratorFacade.CreateNewCountry(adminLoginToken, TestData.Get_Countries_Data()[2]);
            loggedInAdministratorFacade.CreateNewCustomer(adminLoginToken, TestData.Get_Customers_Data()[0]);
            loggedInAdministratorFacade.CreateNewCustomer(adminLoginToken, TestData.Get_Customers_Data()[1]);

            AirlineCompany airlineCompany = TestData.Get_AirlineCompanies_Data()[0];

            airlineCompany.CountryId = country_id;
            loggedInAdministratorFacade.CreateNewAirlineCompany(adminLoginToken, airlineCompany);
            system.TryLogin(airlineCompany.User.UserName, airlineCompany.User.Password, out ILoginToken airline_token, out FacadeBase airline_facade);
            LoggedInAirlineFacade       loggedInAirlineFacade = airline_facade as LoggedInAirlineFacade;
            LoginToken <AirlineCompany> airlineLoginToken     = airline_token as LoginToken <AirlineCompany>;
            Flight flight  = TestData.Get_Flights_Data()[3];
            Flight flight2 = TestData.Get_Flights_Data()[4];
            Flight flight3 = TestData.Get_Flights_Data()[5];

            long flight_id  = loggedInAirlineFacade.CreateFlight(airlineLoginToken, flight);
            long flight_id2 = loggedInAirlineFacade.CreateFlight(airlineLoginToken, flight2);
            long flight_id3 = loggedInAirlineFacade.CreateFlight(airlineLoginToken, flight3);

            flight.Id  = flight_id;
            flight2.Id = flight_id2;
            flight3.Id = flight_id3;

            system.TryLogin(TestData.Get_Customers_Data()[1].User.UserName, TestData.Get_Customers_Data()[1].User.Password, out ILoginToken token, out FacadeBase facade);
            LoginToken <Customer>  cust_token  = token as LoginToken <Customer>;
            LoggedInCustomerFacade cust_facade = facade as LoggedInCustomerFacade;

            cust_facade.PurchaseTicket(cust_token, flight);

            Login(TestData.Get_Customers_Data()[0].User.UserName, TestData.Get_Customers_Data()[0].User.Password);

            _logger.Debug($"End Init Customer Tests Data");
        }
        public void Add_Country_Using_Level_Two_Admin_Should_Throw_NotAllowedAdminActionException()
        {
            Init_Admin_Level_One_And_Login();
            Execute_Test(() =>
            {
                Country demi_country = TestData.Get_Countries_Data()[0];

                Assert.ThrowsException <NotAllowedAdminActionException>(() => administrator_level_one_facade.CreateNewCountry(administrator_level_one_token, demi_country));
            });
        }
Example #5
0
        public AirlineCompany CreateAirlineCompanyForTests()
        {
            Country c = new Country("Israel");

            c.ID = 1;
            adminFacade.CreateNewCountry(adminToken, c);
            AirlineCompany a = new AirlineCompany("IsraAir", "IsraAirManager", "123456", c.ID);

            a.ID = 1;
            adminFacade.CreateNewAirline(adminToken, a);
            return(a);
        }
        public void FillDBForTest()
        {
            //Customer c = new Customer("Einat", "Mor", "Einat123", "12345", "Katzenelson", "0545552809", "123456789");
            //adminFacade.CreateNewCustomer(adminToken, c);
            Country country = new Country("Israel");

            adminFacade.CreateNewCountry(adminToken, country);
            // airLineToken.User = new AirlineCompany("Delta", "Delta", "22222", country.ID);

            //AirlineCompany a = new AirlineCompany("El_AL", "elalelal", "12345", adminFacade.GetCountryByName(adminToken, "Israel").ID);
            //adminFacade.CreateNewAirline(adminToken, a);
        }
        private void GenerateCountries(LoggedInAdministratorFacade facade, LoginToken <Administrator> loginToken)
        {
            List <Country> countries = new List <Country>();

            Converters.ConvertToCountry(RandomCountries, countries, CountriesAmount);
            for (int i = 0; i < CountriesAmount; i++)
            {
                try
                {
                    facade.CreateNewCountry(loginToken, countries[0]);
                    countries.RemoveAt(0);
                }
                catch (Exception e)
                {
                    MessageBox.Show($"Country {countries[i].CountryName} already exists", "Generator Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Example #8
0
 static public void PrepareDBForTests(out LoginToken <Administrator> token, out LoggedInAdministratorFacade facade)
 {
     using (SqlConnection conn = new SqlConnection(FlyingCenterConfig.CONNECTION_STRING))
     {
         conn.Open();
         using (SqlCommand cmd = new SqlCommand("Delete From Tickets;" +
                                                "Delete From Flights;" +
                                                "Delete From AirlineCompanies;" +
                                                "Delete From Customers;" +
                                                "Delete From Countries;" +
                                                "Delete From Administrators;", conn))
         {
             cmd.ExecuteNonQuery();
         }
     }
     defaultFacade.CreateNewCountry(defaultToken, new Country()
     {
         Country_Name = "Israel",
     });
     facade = defaultFacade;
     token  = defaultToken;
 }
Example #9
0
        // Create a random amount of countries
        public void CreateRandomCountries(int randomNum)
        {
            List <Country> countries = new List <Country>();
            Random         random    = new Random();

            for (int i = 0; i < randomNum; i++)
            {
                Country c = new Country
                {
                    CountryName = RandomString(false),
                };
                foreach (Country country in countries)
                {
                    if (country.CountryName == c.CountryName || adminF.GetCountryNameByName(adminT, country.CountryName) == c.CountryName)
                    {
                        i--;
                    }
                    continue;
                }
                adminF.CreateNewCountry(adminT, c);
                countries.Add(c);
            }
        }
Example #10
0
        public void AdminFacadeTest()
        {
            // Deleting database
            FlightCenterConfig.DeleteDataBase();
            //Creating DAO'S samples to test
            long             airlineCompanyId1 = 0, airlineCompanyId2 = 0, countryId1 = 0, countryId2 = 0, flightId1 = 0, customerId1 = 0;
            AirLineDAOMSSQL  adao = new AirLineDAOMSSQL();
            FlightDAOMSSQL   fdao = new FlightDAOMSSQL();
            CustomerDAOMSSQL cdao = new CustomerDAOMSSQL();
            CountryDAOMSSQL  cydao = new CountryDAOMSSQL();
            TicketDAOMSSQL   tdao = new TicketDAOMSSQL();

            // Adding new countries
            cydao.Add(new Country {
                COUNTRY_NAME = "Israel"
            });
            countryId1 = cydao.GetCountryId("Israel");

            cydao.Add(new Country {
                COUNTRY_NAME = "Germany"
            });
            countryId2 = cydao.GetCountryId("Germany");

            // Adding new Airline companies
            adao.Add(new AirlineCompany {
                AIRLINE_NAME = "IsrLines", USER_NAME = "ISR91", PASSWORD = "******", COUNTRY_CODE = countryId1
            });
            airlineCompanyId1 = adao.GetAirlineCompanyId("ISR91");

            adao.Add(new AirlineCompany {
                AIRLINE_NAME = "British Airlines", USER_NAME = "British555", PASSWORD = "******", COUNTRY_CODE = countryId2
            });
            airlineCompanyId2 = adao.GetAirlineCompanyId("British555");

            // Adding new Flight
            fdao.Add(new Flight {
                AIRLINECOMPANY_ID = airlineCompanyId1, ORIGIN_COUNTRY_CODE = countryId1, DESTINATION_COUNTRY_CODE = countryId2, DEPARTURE_TIME = new DateTime(2019, 05, 10, 10, 30, 00), LANDING_TIME = new DateTime(2019, 05, 10, 15, 05, 00), REMAINING_TICKETS = 15, AIRLINECOMPANY_NAME = "IsrLines", FLIGHT_NAME = "555"
            });
            flightId1 = fdao.GetFlightId("555");

            // Adding new Customer
            cdao.Add(new Customer {
                FIRST_NAME = "Efrat", LAST_NAME = "Patihi", USER_NAME = "Efrat_kapara", PASSWORD = "******", ADDRESS = "Netanya , Raziel 40", PHONE_NO = "05011554875", CREDIT_CARD_NUMBER = "123456789"
            });
            customerId1 = cdao.GetCustomerId("Efrat_kapara");

            // Adding new Ticket
            tdao.Add(new Tickets {
                CUSTOMER_ID = customerId1, FLIGHT_ID = flightId1
            });
            // Testing
            FlyingCenterSystem         fcs        = FlyingCenterSystem.GetInstance();
            LoginToken <Administrator> adminLogin = new LoginToken <Administrator>();

            adminLogin.User = new Administrator();
            adminLogin.User.AdminUserName = "******";
            adminLogin.User.Password      = "******";


            // Trying to login
            fcs.login.TryAdminLogin(adminLogin.User.AdminUserName, adminLogin.User.Password, out LoginToken <Administrator> adminToken);
            fcs.login.TryAirlineLogin("ISR91", "Is789", out LoginToken <AirlineCompany> airlineToken);
            fcs.login.TryCustomerLogin("Efrat_kapara", "Efi93", out LoginToken <Customer> customerToken);


            // Testing admin facade fucntions
            LoggedInAdministratorFacade adminFacadae = fcs.GetFacade(adminLogin) as LoggedInAdministratorFacade;

            adminFacadae.CreateNewCountry(adminLogin, new Country {
                COUNTRY_NAME = "Israel"
            });
            AirlineCompany airline = new AirlineCompany()
            {
                AIRLINE_NAME = "Nassa",
                USER_NAME    = "Nassa28",
                PASSWORD     = "******",
                COUNTRY_CODE = adminFacadae.GetCountryId("Israel")
            };

            adminFacadae.CreateNewAirline(adminLogin, airline);
            Assert.AreEqual(adminFacadae.GetAirlineByUserame("Nassa28"), airline);

            Customer cust = new Customer()
            {
                FIRST_NAME         = "Tal",
                LAST_NAME          = "Rdt",
                USER_NAME          = "TalGever",
                PASSWORD           = "******",
                ADDRESS            = "Hazfira 20, Pardes hanna",
                PHONE_NO           = "0505001245",
                CREDIT_CARD_NUMBER = "456123456789"
            };

            adminFacadae.CreateNewCustomer(adminLogin, cust);
            Assert.AreEqual(cust, adminFacadae.GetCustomerByUserName("TalGever")); // works
            adminFacadae.UpdateAirlineDetails(adminLogin, new AirlineCompany {
                AIRLINE_NAME = "Nasa4Life", USER_NAME = "Nassa28", PASSWORD = "******", COUNTRY_CODE = adminFacadae.GetCountryId("Israel")
            });
            adminFacadae.UpdateCustomerDetails(adminLogin, new Customer {
                FIRST_NAME = "Tal", LAST_NAME = "Rdt", USER_NAME = "TalGever", PASSWORD = "******", ADDRESS = "Raziel 50 , Netanya", PHONE_NO = "0505001245", CREDIT_CARD_NUMBER = "456123456789"
            });
            AirlineCompany airl = new AirlineCompany()
            {
                AIRLINE_NAME = "Nasa4Life",
                USER_NAME    = "Nassa28",
                PASSWORD     = "******",
                COUNTRY_CODE = adminFacadae.GetCountryId("Israel")
            };

            adminFacadae.RemoveAirline(adminLogin, airl);
        }
        public void Create_And_Get_New_Country()
        {
            Execute_Test(() =>
            {
                Country demi_country = TestData.Get_Countries_Data()[0];
                int country_id       = administrator_facade.CreateNewCountry(administrator_token, demi_country);
                Assert.AreEqual(country_id, 1);
                demi_country.Id         = country_id;
                Country country_from_db = administrator_facade.GetCountryById(country_id);

                TestData.CompareProps(country_from_db, demi_country);
            });
        }
Example #12
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            // Creating new customer.
            Customer newCustomer = new Customer
            {
                FIRST_NAME         = "Iliya",
                LAST_NAME          = "Tsvibel",
                USER_NAME          = "Iliya",
                PASSWORD           = "******",
                ADDRESS            = "Rishon",
                PHONE_NO           = "0546800559",
                CREDIT_CARD_NUMBER = "12345"
            };

            adminFacade.CreateNewCustomer(defaultToken, newCustomer);

            // Creating new country.
            Country country = null;

            country = new Country();
            for (int i = 0; i < ListOfCountries.CountryNames.Length; i++)
            {
                country = countryDAO.GetByName(ListOfCountries.CountryNames[i]);

                if (country == null)
                {
                    Country newCountry = new Country {
                        COUNTRY_NAME = ListOfCountries.CountryNames[i]
                    };
                    adminFacade.CreateNewCountry(defaultToken, newCountry);
                }
            }

            // Creating new administrator.
            Administrator newAdmin = new Administrator {
                FIRST_NAME = "Iliya", LAST_NAME = "Tsvibel", USER_NAME = "Admin", PASSWORD = "******"
            };

            adminFacade.CreateNewAdmin(defaultToken, newAdmin);

            //Creating new airline.
            //AirlineCompany newAirline = new AirlineCompany
            //{
            //    AIRLINE_NAME = "Aeroflot",
            //    USER_NAME = "Vladimir",
            //    COUNTRY_CODE = adminFacade.GetCountryByName("Germany").ID,
            //    PASSWORD = "******"
            //};
            //adminFacade.CreateNewAirline(defaultToken, newAirline);

            AirlineCompany airline = null;

            airline = new AirlineCompany();
            long countryStartID = 0;

            countryStartID = countryDAO.GetByName(ListOfCountries.CountryNames[0]).ID;
            for (int i = 0; i < ListOfAirlinesCompanies.AirlineNames.Length; i++)
            {
                airline = airlineDAO.GetAirlineByName(ListOfAirlinesCompanies.AirlineNames[i]);

                if (airline == null)
                {
                    AirlineCompany newAirline = new AirlineCompany {
                        AIRLINE_NAME = ListOfAirlinesCompanies.AirlineNames[i], USER_NAME = "UserName-" + ListOfAirlinesCompanies.AirlineNames[i], PASSWORD = random.Next(1000, 10000).ToString(), COUNTRY_CODE = random.Next(Convert.ToInt32(countryStartID), (Convert.ToInt32(countryStartID) + ListOfCountries.CountryNames.Length))
                    };
                    adminFacade.CreateNewAirline(defaultToken, newAirline);
                }
            }

            // Creating new flight.
            Flight flight = new Flight {
                AIRLINECOMPANY_ID = adminFacade.GetAirlineByName(adminToken, "SOLAR CARGO, C.A.").ID, DEPARTURE_TIME = DateTime.Now, LANDING_TIME = DateTime.Now + TimeSpan.FromHours(1), ORIGIN_COUNTRY_CODE = adminFacade.GetCountryByName("Germany").ID, DESTINATION_COUNTRY_CODE = adminFacade.GetCountryByName("Germany").ID, REMAINING_TICKETS = 250
            };

            //airlineFacade.CreateFlight(defaultAirlioneToken, flight);
            flightDAO.Add(flight);

            // Creating new ticket.
            Ticket tickets = new Ticket {
                FLIGHT_ID = anonFacade.GetFlightsByDestinationCountryForTest(adminFacade.GetCountryByName("Germany").ID).ID, CUSTOMER_ID = adminFacade.GetCustomerByUserName(adminToken, "Iliya").ID
            };

            //customerFacade.PurchaseTicket(defaultCustomerToken, tickets);
            ticketDAO.Add(tickets);
            MessageBox.Show($"All data successfully added");
        }
        public async Task InsertingDataBase(string AirlineNo, string CustomerNo, string FlightsPerCmpnyNo, string TicketsPerCustNo, string CountriesNo)
        {
            _bgWorker.DoWork += (s, e) =>
            {
                for (int i = 0; i < 101; i++)
                {
                    Thread.Sleep(100);
                    ProgressStatus = i;
                }
            };
            _bgWorker.RunWorkerAsync();
            int numberOfAirLines       = Int32.Parse(AirlineNo);
            int numberOfCustomers      = Int32.Parse(CustomerNo);
            int numberOfFlightsPerCmp  = Int32.Parse(FlightsPerCmpnyNo);
            int numberOfTicketsPerCust = Int32.Parse(TicketsPerCustNo);
            int numberOfCountries      = Int32.Parse(CountriesNo);

            try
            {
                await Task.Run(() =>
                {
                    restWorking = new WorkWithAPI();
                    List <Country> countriesFromRest = restWorking.CountriesApiWebWork();
                    int countryNoParsed  = Convert.ToInt32(CountriesNo);
                    int customerNoParsed = Convert.ToInt32(CustomerNo);
                    int flightNoParsed   = Convert.ToInt32(FlightsPerCmpnyNo);
                    int airlineNoParsed  = Convert.ToInt32(AirlineNo);
                    int ticketNoParsed   = Convert.ToInt32(TicketsPerCustNo);
                    ProggressBarMaxVal   = countryNoParsed + customerNoParsed + flightNoParsed + airlineNoParsed + ticketNoParsed;
                    for (int i = 0; i < countryNoParsed; i++)
                    {
                        afc.CreateNewCountry(new LoginToken <Administrator>(), countriesFromRest[i]);
                        ProggressBarVal += i;
                    }

                    List <AirlineCompany> airlines = restWorking.AirlineCompnyApiWork();
                    for (int i = 0; i < airlineNoParsed; i++)
                    {
                        afc.CreateNewAirline(new LoginToken <Administrator>(), airlines[i]);
                        ProggressBarVal += i;
                    }

                    List <Customer> customersREST = restWorking.CustomerApiWork();
                    for (int i = 0; i < customerNoParsed; i++)
                    {
                        afc.CreateNewCustomer(new LoginToken <Administrator>(), customersREST[i]);
                        ProggressBarVal += i;
                    }
                    flightsPerCompany       = new List <Flight>();
                    long airlineId          = 0;
                    long countryCode        = 0;
                    string airlineName      = null;
                    long secondCountryCode  = 0;
                    DateTime firstDate      = new DateTime();
                    DateTime secondDate     = new DateTime();
                    numberOfFlightsToCreate = RandomFlightToBeCreated();
                    for (int j = 0; j < airlineNoParsed; j++)
                    {
                        for (int i = 0; i < flightNoParsed; i++)
                        {
                            airlineId         = alf.GetRandomAirlineId();
                            airlineName       = alf.GetAirlineNameByID((int)airlineId);
                            countryCode       = alf.GetRandomCountryId();
                            secondCountryCode = alf.GetRandomCountryId();
                            firstDate         = RandomDate();
                            Thread.Sleep(10);
                            secondDate = RandomDate2(firstDate);
                            flightsPerCompany.Add(new Flight(airlineId, countryCode, secondCountryCode, firstDate, secondDate, RandomTickets(), airlineName, RandomString()));
                            ProggressBarVal += i;
                        }
                    }

                    foreach (var flight in flightsPerCompany)
                    {
                        alf.CreateFlight(airlineToken, flight);
                    }
                    Random rnd                 = new Random();
                    int numberOfIds            = 0, flightID = 0;
                    List <long> customerIds    = cfc.GetAllCustomerID();
                    LoginService customerLogin = new LoginService();

                    for (int i = 0; i < customerNoParsed; i++)
                    {
                        for (int j = 0; j < ticketNoParsed; j++)
                        {
                            numberOfIds    = rnd.Next(flightNoParsed);
                            Tickets ticket = new Tickets();
                            customerLogin.TryCustomerLogin(restWorking.CustomerApiWork()[i].USER_NAME, restWorking.CustomerApiWork()[i].PASSWORD, out customerToken);
                            flightID           = (int)alf.GetRandomFlightID();
                            ticket             = cfc.PurchaseTicket(customerToken, afc.GetFlightById(flightID));
                            ticket.CUSTOMER_ID = customerIds[i];
                            ticket.FLIGHT_ID   = flightID;
                            afc.AddTicket(ticket);
                            ProggressBarVal += j;
                        }
                    }
                });
            }
            catch (Exception)
            {
                throw new Exception("Something went wrong while trying to insert data...");
            }
        }
Example #14
0
        public void GenerateData()
        {
            log.Info("Creating admin user");
            MainWindowViewModel.ListForLog.Add("Creating admin user");
            //Creating admin user:
            IloginAdministrator     = FlyingCenterSystem.GetFlyingCenterSystemInstance().Login("admin", "9999");
            loginTokenAdministrator = IloginAdministrator as LoginToken <Administrator>;
            administratorFacade     = (LoggedInAdministratorFacade)FlyingCenterSystem.GetFlyingCenterSystemInstance().GetFacade(IloginAdministrator);

            //Adds the countries first (foreign key constrain considaration):
            log.Info("Adds the countries first");
            MainWindowViewModel.ListForLog.Add("Adds the countries first");
            for (int i = 0; i < _CountriesNoToAdd; i++)
            {
                administratorFacade.CreateNewCountry(loginTokenAdministrator,
                                                     new Country()
                {
                    CountryName = listOfThings.CountriesArray[rnd.Next(listOfThings.CountriesArray.Length)]
                });
                if (i >= listOfThings.CountriesArray.Length)
                {
                    administratorFacade.CreateNewCountry(loginTokenAdministrator,
                                                         new Country()
                    {
                        CountryName = RandomString(5)
                    });
                }
            }

            //Get All Countries and add country codes for filling the airline companies:
            log.Info("Adds the Airline Companies");
            MainWindowViewModel.ListForLog.Add("Adds the Airline Companies");
            IList <Country> countries = new List <Country>();

            countries = administratorFacade.GetAllCountries(loginTokenAdministrator);

            //Adds the Airline Companies:
            for (int i = 0; i < _AirlineCompaniesNo; i++)
            {
                administratorFacade.CreateNewAirline(loginTokenAdministrator, new AirlineCompany()
                {
                    AirLineName = RandomString(5),
                    CountryCode = countries[rnd.Next(0, countries.Count)].CountyID,
                    Password    = RandomString(6),
                    UserName    = RandomString(4)
                });
            }

            //Adds the Customers:
            log.Info("Adds the Customers");
            MainWindowViewModel.ListForLog.Add("Adds the Customers");
            //FillCustomerTableFromUserApi(CustomersNo); - will not use, site is down (although it's working)
            FillCustomerTableRandomly(rnd, _CustomersNo);

            //Get All AirlineCompanies for the id:
            IList <AirlineCompany> airlineCompanies = administratorFacade.GetAllAirLineCompanies();

            //Adds the Flights Per Company:
            log.Info("Adds the Flights Per Company");
            MainWindowViewModel.ListForLog.Add("Adds the Flights Per Company");
            for (int i = 0; i < _FlightsPerCompany; i++)
            {
                administratorFacade.CreateFlight(loginTokenAdministrator, new Flight()
                {
                    AirLineCompany_ID        = airlineCompanies[rnd.Next(0, airlineCompanies.Count)].Airline_ID,
                    Origin_Country_Code      = countries[rnd.Next(0, countries.Count)].CountyID,
                    Destination_Country_Code = countries[rnd.Next(0, countries.Count)].CountyID,
                    DepartureTime            = createRandomDate(),
                    LandingTime       = createRandomDate(),
                    Remaining_Tickets = rnd.Next(5, 51)
                });
            }

            log.Info("Adds the Tickets per Customer");
            MainWindowViewModel.ListForLog.Add("Adds the Tickets per Customer");
            //Get All customers:
            IList <Customer> customers = new List <Customer>();

            customers = administratorFacade.GetAllCustomers(loginTokenAdministrator);

            //Get All flights :
            IList <Flight> flights = new List <Flight>();

            flights = administratorFacade.GetAllFlights();

            //Adds the Tickets per Customer:
            for (int i = 0; i < _TicketsPerCustomer; i++)
            {
                administratorFacade.AddTicketsToCustomer(loginTokenAdministrator,
                                                         customers[rnd.Next(0, customers.Count)].Customer_ID,
                                                         flights[rnd.Next(0, flights.Count)].FlightID);
            }

            log.Info("Finished puting data in DB!");
            MainWindowViewModel.ListForLog.Add("Finished puting data in DB!");
        }