예제 #1
0
 public async Task <IHttpActionResult> GetAllCountries()
 {
     try
     {
         return(Ok((await CountryService.GetAllCountries()).AsQueryable()));
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #2
0
        private void FillDropDowns()
        {
            this.ddlCountry.Items.Clear();
            CountryCollection countryCollection = CountryManager.GetAllCountries();

            foreach (Country country in countryCollection)
            {
                ListItem ddlCountryItem2 = new ListItem(country.Name, country.CountryId.ToString());
                this.ddlCountry.Items.Add(ddlCountryItem2);
            }
        }
예제 #3
0
        protected void FillCountryDropDowns()
        {
            this.ddlShippingOriginCountry.Items.Clear();
            ListItem selectCountryItem = new ListItem(GetLocaleResourceString("Admin.ShippingSettings.OriginCountry.SelectCountry"), "0");

            this.ddlShippingOriginCountry.Items.Add(selectCountryItem);
            var countryCollection = CountryManager.GetAllCountries();

            foreach (Country country in countryCollection)
            {
                ListItem ddlCountryItem2 = new ListItem(country.Name, country.CountryId.ToString());
                this.ddlShippingOriginCountry.Items.Add(ddlCountryItem2);
            }
        }
예제 #4
0
        protected void FillCountryDropDowns()
        {
            this.ddlTaxDefaultCountry.Items.Clear();
            ListItem noCountryItem = new ListItem(GetLocaleResourceString("Admin.TaxSettings.TaxDefaultCountry.SelectCountry"), "0");

            this.ddlTaxDefaultCountry.Items.Add(noCountryItem);
            CountryCollection countryCollection = CountryManager.GetAllCountries();

            foreach (Country country in countryCollection)
            {
                ListItem ddlCountryItem2 = new ListItem(country.Name, country.CountryID.ToString());
                this.ddlTaxDefaultCountry.Items.Add(ddlCountryItem2);
            }
        }
예제 #5
0
        protected void FillEUVATCountryDropDowns()
        {
            var countries = CountryManager.GetAllCountries().Where(country => country.SubjectToVAT).ToList();

            this.ddlEUVatShopCountry.Items.Clear();
            ListItem noCountryItem2 = new ListItem(GetLocaleResourceString("Admin.TaxSettings.EUVatShopCountry.SelectCountry"), "0");

            this.ddlEUVatShopCountry.Items.Add(noCountryItem2);
            foreach (Country country in countries)
            {
                ListItem ddlCountryItem2 = new ListItem(country.Name, country.CountryId.ToString());
                this.ddlEUVatShopCountry.Items.Add(ddlCountryItem2);
            }
        }
예제 #6
0
    private void loadCountry()
    {
        ListItem li = new ListItem("Select Country...", "0");

        ddlCountry.Items.Add(li);

        List <Country> countries = new List <Country>();

        countries = CountryManager.GetAllCountries();
        foreach (Country country in countries)
        {
            ListItem item = new ListItem(country.CountryName.ToString(), country.CountryID.ToString());
            ddlCountry.Items.Add(item);
        }
    }
예제 #7
0
        public void CityManagerTest()
        {
            CityManager      cityManager      = new CityManager(new UnitOfWork(new DataContext()));
            CountryManager   countryManager   = new CountryManager(new UnitOfWork(new DataContext()));
            ContinentManager continentManager = new ContinentManager(new UnitOfWork(new DataContext()));

            //Verwijder alles in tabels
            cityManager.RemoveAll();
            countryManager.RemoveAllCountries();
            continentManager.RemoveAll();

            //Aanmaak Continent
            continentManager.Add(new Continent("TestContinent"));
            List <Continent> continents = continentManager.GetAllContinents();
            Continent        continent  = continents[0];

            Assert.AreEqual(1, continents.Count);

            //Toevoegen van Country
            countryManager.Add(new Country("TestCountry", continent, 100, 10));

            List <Country> countries = countryManager.GetAllCountries();
            Country        country   = countries[0];

            Assert.AreEqual(1, countries.Count);
            Assert.AreEqual("TestCountry", country.Name);

            //Toevoegen van City
            cityManager.Add(new City("TestCity", 5000, country, true));

            List <City> cities = cityManager.GetAllCities();
            City        city   = cities[0];

            Assert.AreEqual(1, cities.Count);
            Assert.AreEqual("TestCity", city.Name);

            cityManager.RemoveCityById(city.ID);

            List <City> citiesAangepast = cityManager.GetAllCities();

            Assert.AreEqual(0, citiesAangepast.Count);

            //Verwijder alles in tabels
            cityManager.RemoveAll();
            countryManager.RemoveAllCountries();
            continentManager.RemoveAll();
        }
        private void GetAllCountries()
        {
            List <CountriesViewModel> all = nCountryManager.GetAllCountries();

            if (all.Count == 0)
            {
                msgDisplayLabel.Text = "<span class='label label-warning label-mini'>Data Not Found!</span>";
                countryDisplayGridView.DataSource = null;
                countryDisplayGridView.DataBind();
            }
            else
            {
                msgDisplayLabel.Text = String.Empty;
                countryDisplayGridView.DataSource = all;
                countryDisplayGridView.DataBind();
            }
        }
        protected void LoadAllCountryInDropDownList()
        {
            Country country = new Country();

            country.Id   = -1;
            country.Name = "Select Country....";

            List <Country> listOfCountry = countryManager.GetAllCountries();

            listOfCountry.Insert(0, country);
            countryDropDownList.DataSource = listOfCountry;

            countryDropDownList.DataTextField =

                countryDropDownList.DataTextField = "Name";
            countryDropDownList.DataValueField    = "Name";
            countryDropDownList.DataBind();
        }
        protected void BindGridview()
        {
            //DataSet ds = new DataSet();
            //using (SqlConnection con = new SqlConnection(connectionString))
            //{
            //    con.Open();
            //    SqlCommand cmd = new SqlCommand("select * from country", con);
            //    SqlDataAdapter da = new SqlDataAdapter(cmd);
            //    da.Fill(ds);
            //    con.Close();
            //    countryListGridView.DataSource = ds;
            //    countryListGridView.DataBind();
            //}

            List <Country> countryList = countryManager.GetAllCountries();

            countryListGridView.DataSource = countryList;
            countryListGridView.DataBind();
        }
        private void FillDropDowns()
        {
            ddlShippingMethod.Items.Clear();
            ShippingMethodCollection shippingMethodCollection = ShippingMethodManager.GetAllShippingMethods();

            foreach (ShippingMethod shippingMethod in shippingMethodCollection)
            {
                ListItem item = new ListItem(shippingMethod.Name, shippingMethod.ShippingMethodID.ToString());
                ddlShippingMethod.Items.Add(item);
            }

            ddlCountry.Items.Clear();
            CountryCollection countryCollection = CountryManager.GetAllCountries();

            foreach (Country country in countryCollection)
            {
                ListItem item = new ListItem(country.Name, country.CountryID.ToString());
                ddlCountry.Items.Add(item);
            }
        }
        protected void gvShippingByWeightAndCountry_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ShippingByWeightAndCountry shippingByWeightAndCountry = (ShippingByWeightAndCountry)e.Row.DataItem;

                Button btnUpdate = e.Row.FindControl("btnUpdate") as Button;
                if (btnUpdate != null)
                {
                    btnUpdate.CommandArgument = e.Row.RowIndex.ToString();
                }

                DropDownList ddlShippingMethod = e.Row.FindControl("ddlShippingMethod") as DropDownList;
                ddlShippingMethod.Items.Clear();
                ShippingMethodCollection shippingMethodCollection = ShippingMethodManager.GetAllShippingMethods();
                foreach (ShippingMethod shippingMethod in shippingMethodCollection)
                {
                    ListItem item = new ListItem(shippingMethod.Name, shippingMethod.ShippingMethodID.ToString());
                    ddlShippingMethod.Items.Add(item);
                    if (shippingByWeightAndCountry.ShippingMethodID == shippingMethod.ShippingMethodID)
                    {
                        item.Selected = true;
                    }
                }


                DropDownList ddlCountry = e.Row.FindControl("ddlCountry") as DropDownList;
                ddlCountry.Items.Clear();
                CountryCollection countryCollection = CountryManager.GetAllCountries();
                foreach (Country country in countryCollection)
                {
                    ListItem item = new ListItem(country.Name, country.CountryID.ToString());
                    ddlCountry.Items.Add(item);
                    if (shippingByWeightAndCountry.CountryID == country.CountryID)
                    {
                        item.Selected = true;
                    }
                }
            }
        }
예제 #13
0
 protected void LoadAllCountryGridview()
 {
     allCountryGridView.DataSource = countryManager.GetAllCountries();
     allCountryGridView.DataBind();
 }
 private void showCountryGrid()
 {
     gvCountry.DataSource = CountryManager.GetAllCountries();
     gvCountry.DataBind();
 }
예제 #15
0
 public void LoadCountries()
 {
     List<Country> countriesList = countryManager.GetAllCountries();
     countryGridView.DataSource = countriesList;
     countryGridView.DataBind();
 }