private void Form1_Load(object sender, EventArgs e) { // ConnectionDatabase.connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=world.mdb;Persist Security Info=True"; // asub Program.cs failis List <Country> country = new List <Country>(); country = CountryDB.GetAllCountries(); DataTable table = new DataTable(); DataColumn idColumn = table.Columns.Add("Name", typeof(string)); table.Columns.Add("Code", typeof(string)); table.Columns.Add("Continent", typeof(string)); table.Columns.Add("Year", typeof(int)); table.PrimaryKey = new DataColumn[] { idColumn }; foreach (Country c in country) { table.Rows.Add(new object[] { c.Name, c.Code, c.Continent, c.InderYear }); } table.AcceptChanges(); dataGridViewCountry.DataSource = table; }
private void Form3_Load(object sender, EventArgs e) { List <Country> country = new List <Country>(); country = CountryDB.GetAllCountries(); foreach (Country c in country) { comboBox1.Items.Add(c.Code); } }
private void Form2_Load(object sender, EventArgs e) { // ConnectionDatabase.connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=world.mdb;Persist Security Info=True"; // asub Program.cs failis List <Country> country = new List <Country>(); country = CountryDB.GetAllCountries(); foreach (Country c in country) { comboBox1.Items.Add(c.Name); } }
private void Form4_Load(object sender, EventArgs e) { List <City> city = new List <City>(); city = CountryDB.GetAllCities(); foreach (City r in city) { comboBox1.Items.Add(new ComboBoxItem(r.Name, Convert.ToString(r.ID))); } List <Country> country = new List <Country>(); country = CountryDB.GetAllCountries(); foreach (Country r in country) { comboBox2.Items.Add(new ComboBoxItem(r.Name, r.Code)); } }
public IHttpActionResult Get() { try { Country[] temp = CountryDB.GetAllCountries().ToArray(); if (temp != null) { return(Ok(temp)); } else { return(Content(HttpStatusCode.NotFound, "Countries cannot be found!")); } } catch (Exception ex) { return(Content(HttpStatusCode.BadRequest, ex)); } }
/// <summary> /// To fetch all the Countries /// </summary> /// <returns>DataSet</returns> public DataSet GetAllCountries() { return(CountryDB.GetAllCountries()); }
public ICollection <Country> GetCountries() { CountryDB dataaccess = new CountryDB(); return(dataaccess.GetAllCountries()); }