Пример #1
0
        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;
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
        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));
     }
 }
Пример #6
0
 /// <summary>
 /// To fetch all the Countries
 /// </summary>
 /// <returns>DataSet</returns>
 public DataSet GetAllCountries()
 {
     return(CountryDB.GetAllCountries());
 }
Пример #7
0
        public ICollection <Country> GetCountries()
        {
            CountryDB dataaccess = new CountryDB();

            return(dataaccess.GetAllCountries());
        }