public List <Countries> GetCountries() { List <Countries> Countries = new List <Countries>(); Countries Country = new Countries(); using (var Con = new SqlConnection(GC.ConnectionString)) { Con.Open(); Querry = "select * from GeographyArea where Geo_Level = 1"; using (var Com = new SqlCommand(Querry, Con)) { Reader = Com.ExecuteReader(); while (Reader.Read()) { Country = new Geography.Countries(); Country.ID = Convert.ToInt32(Reader["Geo_Area_Id"].ToString()); Country.Name = Reader["Geo_Name"].ToString(); if (Reader["Parent_id"] == DBNull.Value) { } else { Country.ParentId = Convert.ToInt32(Reader["Parent_id"].ToString()); } Countries.Add(Country); } Com.Dispose(); } Con.Close(); } return(Countries); }
public void LoadData() { CountryDrop.Items.Clear(); SchoolCategoriesCombo.Items.Clear(); GenderDrop.Items.Clear(); ReligionDrop.Items.Clear(); Geography.Countries Countries = new Geography.Countries(); CosmoService Csm = new CosmoService(); foreach (Schools.EducationStructure Structure in Csm.getStructures()) { ListItem Li = new ListItem(Structure.SchoolCategory + " [" + Structure.SchoolDenomination + ']', Structure.CategoryId.ToString()); SchoolCategoriesCombo.Items.Add(Li); } foreach (Schools.Affilliations Afils in Csm.GetAffiliations("Religion")) { ListItem Li = new ListItem(Afils.Category, Afils.ID.ToString()); ReligionDrop.Items.Add(Li); } foreach (Schools.Affilliations Afils in Csm.GetAffiliations("School Genders")) { ListItem Li = new ListItem(Afils.Category, Afils.ID.ToString()); GenderDrop.Items.Add(Li); } foreach (Geography.Countries Country in Countries.GetCountries()) { ListItem Li = new ListItem(Country.Name, Country.ID.ToString()); CountryDrop.Items.Add(Li); } }
public List <Geography.Countries> GetCountries() { Geography.Countries GeogCount = new Geography.Countries(); return(GeogCount.GetCountries()); }