using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using DevComponents.DotNetBar; using GeoScene.Globe; using System.Collections; using GeoScene.Data; namespace PipeLine.Forms { public partial class FrmTongXunQuery : Office2007Form { private GSOGlobeControl globeControl1; private DevComponents.DotNetBar.Controls.DataGridViewX dataGridViewX1; private string pipeLineName = "通信管线"; public FrmTongXunQuery(GSOGlobeControl ctl, DevComponents.DotNetBar.Controls.DataGridViewX d) { this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.MinimizeBox = false; InitializeComponent(); globeControl1 = ctl; dataGridViewX1 = d; } private void btnSelTongXun_Click(object sender, EventArgs e) { dataGridViewX1.Visible = true; string sql = "select " + Utility.Query_Fields["通信"] + " from " + pipeLineName + ""; ArrayList filters = new ArrayList(); if (combType.SelectedIndex >0) { string sql1 = " 埋设方式='" + combType.SelectedItem.ToString() + "'"; filters.Add(sql1); } if (combMaterial.SelectedIndex > 0) { string sql2 = " 材质='" + combMaterial.SelectedItem.ToString() + "'"; filters.Add(sql2); } //if (comboStart.SelectedIndex > 0) //{ // string sql10 = " 线路起点='" + comboStart.SelectedItem.ToString() + "'"; // filters.Add(sql10); //} //if (comboEnd.SelectedIndex > 0) //{ // string sql11 = " 线路终点='" + comboEnd.SelectedItem.ToString() + "'"; // filters.Add(sql11); //} if (txtGuanJing.Text != "") { string sql7 = " 管径_毫米=" + txtGuanJing.Text + ""; filters.Add(sql7); } if (txtDeep1.Text != "") { string sql4 = " 起始埋深>=" + txtDeep1.Text + ""; filters.Add(sql4); } if (txtDeep1.Text != "") { string sql5 = "终止埋深>=" + txtDeep1.Text + ""; filters.Add(sql5); } if (combBuild1.SelectedIndex >0 && combBuild2.SelectedIndex >0) { string sql6 = "建设年代 between '" + combBuild1.SelectedItem.ToString() + "' and '" + combBuild2.SelectedItem.ToString() + "'"; filters.Add(sql6); } string[] aa = (string[])(filters.ToArray(typeof(string))); if (aa.Length > 0) sql += " where " + string.Join(" and ", aa); DataTable table = OledbHelper.QueryTable(sql); dataGridViewX1.DataSource = table; dataGridViewX1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; this.DialogResult = DialogResult.OK; this.Close(); } private void FrmTongXunQuery_Load(object sender, EventArgs e) { try { dataGridViewX1.Visible = false; dataGridViewX1.ReadOnly = true; string sqltype1 = "select distinct 材质 from " + pipeLineName + ""; DataTable table1 = OledbHelper.QueryTable(sqltype1); combMaterial.Items.Add("无"); for (int j = 0; j < table1.Rows.Count; j++) { DataRow dr = table1.Rows[j]; string col = dr[0].ToString(); if (col == null || col.Trim() == "") continue; combMaterial.Items.Add(col); } string sqltype2 = "select distinct 埋设方式 from " + pipeLineName + ""; DataTable table2 = OledbHelper.QueryTable(sqltype2); combType.Items.Add("无"); for (int k = 0; k < table2.Rows.Count; k++) { DataRow dr = table2.Rows[k]; string col = dr[0].ToString(); if (col == null || col.Trim() == "") continue; combType.Items.Add(col); } //string sqltype3 = "select distinct 线路起点 from 通信管线"; //DataTable table3 = OledbHelper.QueryTable(sqltype3); //comboStart.Items.Add("无"); //for (int k = 0; k < table3.Rows.Count; k++) //{ // DataRow dr = table3.Rows[k]; // string col = dr[0].ToString(); // if (col == null || col.Trim() == "") // continue; // comboStart.Items.Add(col); //} //string sqltype4 = "select distinct 线路终点 from 通信管线"; //DataTable table4 = OledbHelper.QueryTable(sqltype4); //comboEnd.Items.Add("无"); //for (int k = 0; k < table4.Rows.Count; k++) //{ // DataRow dr = table4.Rows[k]; // string col = dr[0].ToString(); // if (col == null || col.Trim() == "") // continue; // comboEnd.Items.Add(col); //} } catch (Exception ex) { MessageBox.Show(ex.Message); } } GSOFeature feature; private void FrmTongXunQuery_FormClosing(object sender, FormClosingEventArgs e) { if (feature != null) { feature.HighLight = false; } } private void FlyToMenu_Click(object sender, EventArgs e) { if (feature != null) { globeControl1.Globe.FlyToFeature(feature); } } int count = 0; private void timer1_Tick(object sender, EventArgs e) { if (count < 6) { count++; if (feature != null) { if (count % 2 != 0) { feature.HighLight = true; globeControl1.Refresh(); } else { feature.HighLight = false; globeControl1.Refresh(); } } } else { timer1.Stop(); count = 0; } } private void LightMenu_Click(object sender, EventArgs e) { timer1.Start(); } private void btnCancel_Click(object sender, EventArgs e) { this.Close(); } } }