Пример #1
0
        void displayAllCaller()
        {
            var cityCaller = new myAPIcaller();
            var info       = cityCaller.GetAllCity();

            displayCity(info);
        }
Пример #2
0
        private void Btn_Delete_Click(object sender, EventArgs e)
        {
            var caller = new myAPIcaller();

            caller.DeleteCity(selectedId);

            displayAllCaller();

            foreach (Control tx in panel1.Controls)
            {
                if (tx is TextBox)
                {
                    tx.Text = "";
                }
            }
        }
Пример #3
0
        private void Btn_Create_Click(object sender, EventArgs e)
        {
            City c = new City();

            c.Name        = tx_CityName.Text;
            c.CountryCode = tx_CountryCode.Text;
            c.District    = tx_District.Text;
            c.Population  = tx_Population.Text;

            var caller = new myAPIcaller();

            caller.AddCity(c);
            displayAllCaller();

            foreach (Control tx in panel1.Controls)
            {
                if (tx is TextBox)
                {
                    tx.Text = "";
                }
            }
        }
Пример #4
0
        private void Tx_Search_TextChanged(object sender, EventArgs e)
        {
            var cityCaller = new myAPIcaller();

            if (tx_Search.Text == "" || tx_Search.Text == null)
            {
                var cityInfo = cityCaller.GetAllCity();
                displayCity(cityInfo);
            }
            else
            {
                try
                {
                    var cityInfo = cityCaller.GetCity(Int32.Parse(tx_Search.Text));
                    displayCity(cityInfo);
                }
                catch
                {
                    MessageBox.Show("Id does not exist!");
                }
            }
        }