Example #1
0
        private void init_combo()
        {
            CCity city;

            try
            {
                comboBoxCity.Items.Clear();

                city = new CCity(connect);

                List <STCity> list_c = city.GetListCity();

                string text = null;

                foreach (STCity item in list_c)
                {
                    comboBoxCity.Items.Add(item.name);

                    if (item.name == "Минск")
                    {
                        text = "Минск";
                    }
                }

                if (text != null)
                {
                    comboBoxCity.Text = text;;
                    CCity citys = new CCity(connect, text);
                    set_disl(citys.stFullCity);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }
        }
Example #2
0
        private void init_list()
        {
            dataGridViewCity.Rows.Clear();

            list = clCity.GetListCity();

            CRegion region;

            try
            {
                if (list.Count > 0)
                {
                    g_f = true;

                    dataGridViewCity.Rows.Add(list.Count);

                    for (int i = 0; i < list.Count; i++)
                    {
                        dataGridViewCity.Rows[i].Cells[0].Value = (i + 1).ToString();

                        dataGridViewCity.Rows[i].Cells[1].Value = list[i].name;

                        region = new CRegion(connect, list[i].idreg);

                        dataGridViewCity.Rows[i].Cells[2].Value = region.stFullReg.name;
                        dataGridViewCity.Rows[i].Cells[3].Value = region.stFullReg.shortnamecountry;

                        if (flawour.Equals(list[i]))
                        {
                            gpos = i;
                        }
                    }

                    dataGridViewCity.AllowUserToAddRows = false;
                }
                else
                {
                    dataGridViewCity.AllowUserToAddRows = false;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }