Example #1
0
        private string GetSql(string insertPoiSql, string poiSql, string provicePinYin)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine();
            var first = true;

            for (int i = 0; i < this.cmbCity.Items.Count; i++)
            {
                var name = ((ComboboxItem)this.cmbCity.Items[i]).Text.TrimEnd('市');
                if (name == "请选择")
                {
                    continue;
                }
                var pinYin = Hz2Py.GetPinyin(name).ToLower();

                if (first)
                {
                    stringBuilder.AppendFormat(poiSql, provicePinYin, pinYin).AppendLine();
                    first = false;
                }
                else
                {
                    stringBuilder.AppendFormat(insertPoiSql, provicePinYin, pinYin).AppendLine();
                }
            }
            stringBuilder.AppendLine().AppendLine();
            return(stringBuilder.ToString());
        }
Example #2
0
        /// <summary>
        /// 生成全省数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button12_Click(object sender, EventArgs e)
        {
            var provice       = ((ComboboxItem)this.cmbProvice.SelectedItem).Text.TrimEnd('省');
            var provicePinYin = Hz2Py.GetPinyin(provice).ToLower();

            this.richTextBox1.Text = "";

            this.richTextBox1.AppendText(GetPoiSql(provicePinYin));
            this.richTextBox1.AppendText(GetRoadNetSql(provicePinYin));
            this.richTextBox1.AppendText(GetRoadCrossSql(provicePinYin));
        }
Example #3
0
        /// <summary>
        /// 批量配置文件生成
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button15_Click(object sender, EventArgs e)
        {
            StringBuilder stringBuilder = new StringBuilder();
            var           provice       = ((ComboboxItem)this.cmbProvice.SelectedItem).Text.TrimEnd('省');

            for (int i = 0; i < this.cmbCity.Items.Count; i++)
            {
                var item = this.cmbCity.Items[i] as ComboboxItem;
                if (item != null && !item.Text.Equals("请选择", StringComparison.CurrentCultureIgnoreCase))
                {
                    var city          = item.Text.TrimEnd('市');
                    var provicePinYin = Hz2Py.GetPinyin(string.Format("{0}_{1}", provice, city)).ToLower();
                    stringBuilder.AppendFormat("{0}&{1}&{2}&", provice, city, provicePinYin).AppendLine();
                }
            }
            this.richTextBox1.Text = stringBuilder.ToString();
            Clipboard.SetDataObject(stringBuilder.ToString());
            MessageBox.Show("配置已生成");
        }
Example #4
0
        private void button13_Click(object sender, EventArgs e)
        {
            var           provice       = ((ComboboxItem)this.cmbProvice.SelectedItem).Text.TrimEnd('省');
            var           provicePinYin = Hz2Py.GetPinyin(provice).ToLower();
            StringBuilder message       = new StringBuilder();

            new string[] { "{0}_roadnet", "{0}_poi", "{0}_roadcross", }.ToList().ForEach(
                m =>
            {
                var cmd = string.Format(
                    "pg_dump -h {1} -U {2} -t {0} -f  sql/{4}省/{0}.sql  {3}",
                    string.Format(m, provicePinYin),
                    "192.168.60.242",
                    "postgres",
                    "routing",
                    provice);
                message.AppendLine(cmd);
            });
            this.richTextBox1.Text = message.ToString();
        }