private void btnCheckUserExist_Click(object sender, EventArgs e)
        {
            pcbSuccess.Visible = false;
            string    passengerID = tbxUserSecureNumber.Text;
            Passenger passenger   = passengerManager.Get(x => x.IdentitySerie == passengerID);

            if (passenger == null)
            {
                MessageBox.Show("Qeyd Etdiyiniz Isimde Sernisin Movcud Deyil !", "Sernisin Yoxlama Melumati", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                CurrentModel.Passenger          = passenger;
                rbtnIsChecked.Text              = "YOXLANILIB";
                rbtnIsChecked.Checked           = true;
                gbxPassengerCard.Visible        = true;
                gbxAirTraectory.Visible         = true;
                pbxPassengerImage.SizeMode      = PictureBoxSizeMode.StretchImage;
                pbxPassengerImage.ImageLocation = "C:/Users/Developer/source/repos/SecureEntrance/SecureEntrance.DesktopUI/" + passenger.Image;
                lblTurnedFromCity.Text          = countryManager.Get(x => x.ID == CurrentModel.CountryID).CountryName;
                cmbxToTheCity.Items.Clear();
                foreach (var item in countryManager.ListAll(x => x.IsDeleted == false))
                {
                    cmbxToTheCity.Items.Add(item.CountryName);
                }
                lblTurnedName.Text        = passenger.Name;
                lblTurnedSurname.Text     = passenger.Surname;
                lblTurnedNationality.Text = passenger.Nationality.CountryName;
                lblTurnedAge.Text         = passenger.Age.ToString();
                lblTurnedGender.Text      = passenger.Gender == true ? "Kisi" : "Qadin";
            }
        }
Ejemplo n.º 2
0
        public void Country_Manager_Test()
        {
            CountryManager   tempCountry   = new CountryManager(new UnitOfWork(new DataContext("test")));
            ContinentManager tempContinent = new ContinentManager(new UnitOfWork(new DataContext("test")));

            tempCountry.RemoveAll();
            tempContinent.RemoveAll();

            tempContinent.Add(new Continent("test-Continent"));
            tempContinent.Add(new Continent("test-Continent1"));
            List <Continent> continents = tempContinent.GetAll();

            Assert.AreEqual(2, continents.Count);
            Assert.AreEqual("test-Continent", continents[0].Name);

            tempCountry.Add(new Country("test", 500, 200, continents[0]));
            tempCountry.Add(new Country("test-Country1", 50, 20, continents[0]));

            List <Country> countries = tempCountry.GetAll();
            Country        country1  = tempCountry.Get(countries[0].ID);
            Country        country2  = tempCountry.Get(countries[1].ID);

            Assert.AreEqual(2, countries.Count);
            Assert.AreEqual("test", country1.Name);
            Assert.AreEqual("test-Country1", country2.Name);

            Assert.AreEqual(500, country1.Population);
            Assert.AreEqual(50, country2.Population);

            Assert.AreEqual(200, country1.Surface);
            Assert.AreEqual(20, country2.Surface);

            tempCountry.Update(country1, "test-Country", 2000, 10, continents[1]);
            countries = tempCountry.GetAll();
            country1  = tempCountry.Get(countries[0].ID);
            country2  = tempCountry.Get(countries[1].ID);

            Assert.AreEqual(2, countries.Count);
            Assert.AreEqual("test-Country", country1.Name);
            Assert.AreEqual("test-Country1", country2.Name);

            Assert.AreEqual(2000, country1.Population);
            Assert.AreEqual(50, country2.Population);

            Assert.AreEqual(10, country1.Surface);
            Assert.AreEqual(20, country2.Surface);

            tempCountry.Remove(country1.ID);

            countries = tempCountry.GetAll();
            Assert.AreEqual(1, countries.Count);

            tempCountry.RemoveAll();
            tempContinent.RemoveAll();
        }
        private void FormPassengerAbout_Load(object sender, EventArgs e)
        {
            Passenger passenger = CurrentModel.Passenger;

            lblTurnedName.Text               = passenger.Name;
            lblTurnedSurname.Text            = passenger.Surname;
            lblTurnedNationality.Text        = passenger.Nationality.CountryName;
            lblTurnedGender.Text             = passenger.Gender == true ? "Kisi" : "Qadin";
            lblPassportCity.Text             = countryManager.Get(x => x.ID == passenger.NowCountryID).CountryName;
            lblCurrentCity.Text              = countryManager.Get(x => x.ID == CurrentModel.CountryID).CountryName;
            pbxTurnedImportant.SizeMode      = PictureBoxSizeMode.StretchImage;
            pbxTurnedImportant.ImageLocation = "C:/Users/Developer/source/repos/SecureEntrance/SecureEntrance.DesktopUI/" + passenger.Image;
        }
Ejemplo n.º 4
0
 public ActionResult <SampleCity> Delete(int id, int country_id, int city_id)
 {
     try
     {
         var tempCon = ContinentManager.Get(id);
         var tempCou = CountryManager.Get(country_id);
         if (tempCon.Name == tempCou.Continent.Name)
         {
             var temp = CityManager.Get(city_id);
             if (temp == null)
             {
                 return(NotFound("City not found in Country"));
             }
             else
             {
                 logger.LogInformation("CityController : Delete => " + DateTime.Now);
                 CityManager.Remove(city_id);
                 return(NoContent());
             }
         }
         else
         {
             return(NotFound("Country not found in Continent"));
         }
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 5
0
 public ActionResult <SampleCity> Get(int id, int country_id, int city_id)
 {
     try
     {
         var tempCon = ContinentManager.Get(id);
         var tempCou = CountryManager.Get(country_id);
         if (tempCon.Name == tempCou.Continent.Name)
         {
             var temp = CityManager.Get(city_id);
             if (temp == null)
             {
                 return(NotFound("City not found in Country"));
             }
             else
             {
                 logger.LogInformation("CityController : Get => " + DateTime.Now);
                 return(new SampleCity {
                     ID = temp.ID, name = temp.Name, Capital = temp.IsCapital, Country = $"https://localhost:5001/api/Continent/{id}/Country/{country_id}", Population = temp.Population
                 });
             }
         }
         else
         {
             return(NotFound("Country not found in Continent"));
         }
     }catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 6
0
 public ActionResult Post(int id, int country_id, [FromBody] SampleCity con)
 {
     try
     {
         var tempCon = ContinentManager.Get(id);
         var tempCou = CountryManager.Get(country_id);
         if (tempCon.Name == tempCou.Continent.Name)
         {
             var temp = new City(con.name, con.Population, tempCou, con.Capital);
             if (CityManager.CalculatePopulationCheck(temp))
             {
                 CityManager.Add(temp);
                 logger.LogInformation("CityController : Post => " + DateTime.Now);
                 return(CreatedAtAction(nameof(Get), new { id = tempCon.ID, country_id = tempCou.ID, city_id = temp.ID }, temp));
             }
             else
             {
                 return(BadRequest("Too much population for Country"));
             }
         }
         else
         {
             return(NotFound("Country not found in Continent"));
         }
     }catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 7
0
 private void btnModify_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtCountryName.Text == "")
         {
             MessageBox.Show("You Must Enter Country Name");
             return;
         }
         Country co = country.Get(int.Parse(txtCountryCode.Text));
         co.Country_Name = txtCountryName.Text;
         country.Update(co);
         int ModifiedRowIndex = RowFocusedIndex;
         MessageBox.Show("Selected Country Successfully Modified");
         FRM_Country_Load(null, null);
         GetFocusedRowData(ModifiedRowIndex);
         CountryView.FocusedRowHandle = ModifiedRowIndex;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 8
0
 public ActionResult <SampleCity> Put(int id, int country_id, int city_id, [FromBody] SampleCity con)
 {
     try
     {
         var tempCon       = ContinentManager.Get(id);
         var tempCou       = CountryManager.Get(country_id);
         var getNewCountry = CountryManager.Get(Int32.Parse(con.Country));
         if (tempCon.Name == tempCou.Continent.Name)
         {
             var temp = CityManager.Get(city_id);
             if (temp == null)
             {
                 return(NotFound("City not found in Country"));
             }
             else
             {
                 if (getNewCountry != null)
                 {
                     CityManager.Update(temp, con.name, con.Population, con.Capital, getNewCountry);
                     logger.LogInformation("CityController : Put => " + DateTime.Now);
                     return(Ok());
                 }
                 else
                 {
                     return(NotFound("Country input not found"));
                 }
             }
         }
         else
         {
             return(NotFound("Country not found in Continent"));
         }
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 9
0
        public void City_Manager_Test()
        {
            CityManager      tempCity      = new CityManager(new UnitOfWork(new DataContext("test")));
            CountryManager   tempCountry   = new CountryManager(new UnitOfWork(new DataContext("test")));
            ContinentManager tempContinent = new ContinentManager(new UnitOfWork(new DataContext("test")));

            tempCity.RemoveAll();
            tempCountry.RemoveAll();
            tempContinent.RemoveAll();

            tempContinent.Add(new Continent("test-Continent"));
            tempContinent.Add(new Continent("test-Continent1"));
            List <Continent> continents = tempContinent.GetAll();

            Assert.AreEqual(2, continents.Count);

            tempCountry.Add(new Country("test", 500, 200, continents[0]));
            tempCountry.Add(new Country("test-Country1", 50, 20, continents[0]));

            List <Country> countries = tempCountry.GetAll();
            Country        country1  = tempCountry.Get(countries[0].ID);
            Country        country2  = tempCountry.Get(countries[1].ID);

            Assert.AreEqual(2, countries.Count);
            Assert.AreEqual("test", country1.Name);
            Assert.AreEqual("test-Country1", country2.Name);

            Assert.AreEqual(500, country1.Population);
            Assert.AreEqual(50, country2.Population);

            Assert.AreEqual(200, country1.Surface);
            Assert.AreEqual(20, country2.Surface);

            tempCity.Add(new City("test-city", 50, country1, true));
            tempCity.Add(new City("test-city1", 150, country1, false));
            tempCity.Add(new City("test-city2", 200, country1, false));
            tempCity.Add(new City("test-city3", 10, country1, false));

            var  cities = tempCity.GetAll();
            City city   = tempCity.Get(cities[0].ID);
            City city1  = tempCity.Get(cities[1].ID);
            City city2  = tempCity.Get(cities[2].ID);
            City city3  = tempCity.Get(cities[3].ID);

            Assert.AreEqual(city.Name, "test-city");
            Assert.AreEqual(city1.Name, "test-city1");
            Assert.AreEqual(city2.Name, "test-city2");
            Assert.AreEqual(city3.Name, "test-city3");

            Assert.AreEqual(city.IsCapital, true);
            Assert.AreEqual(city1.IsCapital, false);
            Assert.AreEqual(city2.IsCapital, false);
            Assert.AreEqual(city3.IsCapital, false);

            Assert.AreEqual(city.Population, 50);
            Assert.AreEqual(city1.Population, 150);
            Assert.AreEqual(city2.Population, 200);
            Assert.AreEqual(city3.Population, 10);

            tempCity.Update(city3, "test", 50, false, country2);

            cities = tempCity.GetAll();
            city   = tempCity.Get(cities[0].ID);
            city1  = tempCity.Get(cities[1].ID);
            city2  = tempCity.Get(cities[2].ID);
            city3  = tempCity.Get(cities[3].ID);

            Assert.AreEqual(4, cities.Count);
            Assert.AreEqual(city.Name, "test-city");
            Assert.AreEqual(city1.Name, "test-city1");
            Assert.AreEqual(city2.Name, "test-city2");
            Assert.AreEqual(city3.Name, "test");

            Assert.AreEqual(city.IsCapital, true);
            Assert.AreEqual(city1.IsCapital, false);
            Assert.AreEqual(city2.IsCapital, false);
            Assert.AreEqual(city3.IsCapital, false);

            Assert.AreEqual(city.Population, 50);
            Assert.AreEqual(city1.Population, 150);
            Assert.AreEqual(city2.Population, 200);
            Assert.AreEqual(city3.Population, 50);

            tempCity.Remove(city.ID);
            cities = tempCity.GetAll();
            Assert.AreEqual(3, cities.Count);
            tempCountry.Update(country1, country1.Name, 350, 250, country1.Continent);


            tempCity      = new CityManager(new UnitOfWork(new DataContext("test")));
            tempCountry   = new CountryManager(new UnitOfWork(new DataContext("test")));
            tempContinent = new ContinentManager(new UnitOfWork(new DataContext("test")));
            tempCity.RemoveAll();
            tempCountry.RemoveAll();
            tempContinent.RemoveAll();
        }
Ejemplo n.º 10
0
        public void River_Manager_Test()
        {
            CountryManager   tempCountry   = new CountryManager(new UnitOfWork(new DataContext("test")));
            ContinentManager tempContinent = new ContinentManager(new UnitOfWork(new DataContext("test")));
            RiverManager     tempRiver     = new RiverManager(new UnitOfWork(new DataContext("test")));

            tempRiver.RemoveAll();
            tempCountry.RemoveAll();
            tempContinent.RemoveAll();

            tempContinent.Add(new Continent("test-Continent"));
            tempContinent.Add(new Continent("test-Continent1"));
            List <Continent> continents = tempContinent.GetAll();

            Assert.AreEqual(2, continents.Count);
            Assert.AreEqual("test-Continent", continents[0].Name);

            tempCountry.Add(new Country("test", 500, 200, continents[0]));
            tempCountry.Add(new Country("test-Country1", 50, 20, continents[0]));

            List <Country> countries = tempCountry.GetAll();
            Country        country1  = tempCountry.Get(countries[0].ID);
            Country        country2  = tempCountry.Get(countries[1].ID);

            Assert.AreEqual(2, countries.Count);
            Assert.AreEqual("test", country1.Name);
            Assert.AreEqual("test-Country1", country2.Name);

            Assert.AreEqual(500, country1.Population);
            Assert.AreEqual(50, country2.Population);

            Assert.AreEqual(200, country1.Surface);
            Assert.AreEqual(20, country2.Surface);

            tempRiver.Add(new River("test-river", 250, countries));

            var rivers = tempRiver.GetAll();
            var river  = tempRiver.Get(rivers[0].ID);

            Assert.AreEqual(1, rivers.Count);
            Assert.AreEqual("test-river", river.Name);
            Assert.AreEqual(250, river.Lenght);
            country1 = tempCountry.Get(countries[0].ID);
            Assert.AreEqual(1, country1.Rivers.Count);

            Assert.AreEqual(2, river.Countries.Count);
            Assert.AreEqual("test", river.Countries[0].Name);
            Assert.AreEqual("test-Country1", river.Countries[1].Name);

            Assert.AreEqual(500, river.Countries[0].Population);
            Assert.AreEqual(50, river.Countries[1].Population);

            Assert.AreEqual(200, river.Countries[0].Surface);
            Assert.AreEqual(20, river.Countries[1].Surface);

            tempRiver.Update(river, "test", 50, countries);

            rivers = tempRiver.GetAll();
            river  = tempRiver.Get(rivers[0].ID);

            Assert.AreEqual("test", river.Name);
            Assert.AreEqual(50, river.Lenght);

            tempRiver.Remove(river.ID);
            rivers = tempRiver.GetAll();
            Assert.AreEqual(0, rivers.Count);
            tempCountry   = new CountryManager(new UnitOfWork(new DataContext("test")));
            tempContinent = new ContinentManager(new UnitOfWork(new DataContext("test")));
            tempRiver     = new RiverManager(new UnitOfWork(new DataContext("test")));
            tempRiver.RemoveAll();
            tempCountry.RemoveAll();
            tempContinent.RemoveAll();
        }