Ejemplo n.º 1
0
        private int GetCurrentCityTablesCout(ProviceCity currentCity)
        {
            var sql = string.Format(
                "SELECT count(1) FROM INFORMATION_SCHEMA.TABLES WHERE  TABLE_NAME in ('{0}_poi','{0}_roadcross','{0}_roadnet')",
                currentCity.CityPinyin);

            return(int.Parse(dbcon.ExecuteScalar(sql).ToString()));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 自动任务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button14_Click(object sender, EventArgs e)
        {
            var dialog = new OpenFileDialog();
            var list   = new List <ProviceCity>();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                using (var reader = new StreamReader(dialog.FileName, Encoding.UTF8))
                {
                    var value = reader.ReadLine();
                    while (value != null)
                    {
                        if (!string.IsNullOrEmpty(value))
                        {
                            list.Add(ProviceCity.Resolve(value));
                        }
                        value = reader.ReadLine();
                    }
                }
            }
            var thread = new Thread(
                () =>
            {
                list.ForEach(
                    m =>
                {
                    if (Directory.GetFiles(m.GetCityDirectory(), "*.sql").Length == 0)
                    {
                        m.AutoRun(this.SetSatus);
                    }
                });
                this.SetSatus("处理完毕");
            });

            thread.IsBackground = true;
            thread.Start();
            MessageBox.Show("批量下载开始执行!");
        }