using System; using System.Collections.Generic; using System.Data; using System.Windows.Forms; using DevComponents.DotNetBar; using GeoScene.Globe; using DevComponents.DotNetBar.Controls; namespace Cyberpipe { public partial class FrmCodingQuery : Office2007Form { GSOGlobeControl globeControl1; List<string> layerNames = new List<string>(); private MainFrm.DataGridViewDelegate m_InitDataGridViewX1; // DataGridViewX _dataGridView1; // PanelEx _panel; private MainFrm.PageControlStuct _pageControl; static FrmCodingQuery frm; // string strLable = ""; // DataTable table = new DataTable(); public static void ShowForm(GSOGlobeControl _ctl, List<string> _list, MainFrm.DataGridViewDelegate mInitDataGridViewX1, MainFrm.PageControlStuct pageControl) { if (frm == null) { frm = new FrmCodingQuery(_ctl, _list, mInitDataGridViewX1, pageControl); frm.Show(_ctl.Parent); } else { if (frm.WindowState == FormWindowState.Minimized) { frm.WindowState = FormWindowState.Normal; } } } public FrmCodingQuery(GSOGlobeControl _ctl, List<string> _list, MainFrm.DataGridViewDelegate mInitDataGridViewX1, MainFrm.PageControlStuct pageControl) { InitializeComponent(); globeControl1 = _ctl; layerNames = _list; m_InitDataGridViewX1 = mInitDataGridViewX1; _pageControl = pageControl; } private void FrmCodingQuery_Load(object sender, EventArgs e) { for (int i = 0; i < layerNames.Count; i++) { comboBoxEx1.Items.Add(layerNames[i]); } } private void FrmCodingQuery_Closing(object sender, FormClosingEventArgs e) { m_InitDataGridViewX1(null, "", "", false); PaginationUtil.ResetPagination(); frm = null; } private void buttonX1_Click(object sender, EventArgs e)//查询 { try { if (comboBoxEx1.SelectedIndex == -1) { MessageBox.Show("请选择管线图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.Text.Trim()); if (layer == null || textBoxX1.Text == "") { MessageBox.Show("请输入查询条件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } // ClassSearchAnalysis.ResultDataTable(out table, globeControl1, comboBoxEx1.Text.Trim(), "编号", textBoxX1.Text); // if (table != null && table.Rows.Count > 0) // { // strLable = comboBoxEx1.Text + "共有:" + table.Rows.Count + "条"; // m_InitDataGridViewX1(table, strLable, comboBoxEx1.Text, true); // } PaginationUtil.ResetPagination(); int total = PaginationUtil.CountSql(comboBoxEx1.Text.Trim(), "编号", textBoxX1.Text); if (total > 0) { string strLable = comboBoxEx1.Text + "共有:" + total + "条"; string sql = PaginationUtil.GetQuerySql(globeControl1, comboBoxEx1.Text.Trim(), "编号", textBoxX1.Text); PaginationUtil pagination = PaginationUtil.InitPagination(sql, total, _pageControl, m_InitDataGridViewX1, strLable, comboBoxEx1.Text); pagination.FillDataGridView(); } else { m_InitDataGridViewX1(null, "", "", false); MessageBox.Show("没有符合条件的数据"); } } catch (Exception ex) { LogHelper.Error(ex.Message); } } private void buttonX2_Click(object sender, EventArgs e)//取消 { Close(); } } }