private void btnSearch_Click(object sender, EventArgs e) { bool bLinear = rbLinearRef.Checked; String strQuery = tbSearch.Text; FormQueryRaw form = new FormQueryRaw(m_strAttribute, bLinear, strQuery); if (form.ShowDialog() == DialogResult.OK) { tbSearch.Text = form.m_strQuery; } dataAdapter.Update((DataTable)binding.DataSource); CreateDataGridView(); }
private void btnAdvancedSearch_Click(object sender, EventArgs e) { dataAdapter.Update((DataTable)binding.DataSource); dataAdapter.Dispose(); String strQuery = tbAdvancedSearch.Text; FormQueryRaw formAdvancedSearch = new FormQueryRaw(m_strAsset, strQuery); if (formAdvancedSearch.ShowDialog() == DialogResult.OK) { tbAdvancedSearch.Text = formAdvancedSearch.m_strQuery; m_advancedSearchText = formAdvancedSearch.m_strQuery; } UpdateAssetGrid(); }
private void AssetAdvancedSearch() { String strQuery = ""; if (MainMapImage.Map.Layers.Count > 0) { strQuery = tbAdvancedSearch.Text; FormQueryRaw form = new FormQueryRaw(MainMapImage.Map.Layers[0].LayerName, strQuery); if (form.ShowDialog() == DialogResult.OK) { tbAdvancedSearch.Text = form.m_strQuery; // Find the geoms that match the where clause of the query. Then redraw the layer with only // those geoms? Or highlight those geoms? List <Geometry> listGeoms = new List <Geometry>(); strQuery = "SELECT GEO_ID FROM " + MainMapImage.Map.Layers[0].LayerName + " WHERE " + form.m_strQuery; DataReader dr; try { dr = new DataReader(strQuery); while (dr.Read()) { try { m_listGeomIDs.Add(dr["GEO_ID"].ToString()); } catch (Exception excInner) { Global.WriteOutput("Warning: Point not valid." + excInner.Message + " " + dr[0].ToString()); } } dr.Close(); } catch (Exception exc) { Global.WriteOutput("Error: Failed to load asset geometries." + exc.Message); } // Add the new selection to the combobox and dgv String strSelect = "SELECT * FROM " + MainMapImage.Map.Layers[0].LayerName + " WHERE GEO_ID = '"; String strWhere = ""; for (int i = 0; i < m_listGeomIDs.Count; i++) { if (i < m_listGeomIDs.Count - 1) { strWhere += m_listGeomIDs[i] + "' OR GEO_ID = '"; } else { strWhere += m_listGeomIDs[i] + "'"; } } strSelect += strWhere; try { DataSet ds = DBMgr.ExecuteQuery(strSelect); FormGISLayerManager formGISLayerManager; if (FormManager.IsFormGISLayerManagerOpen(out formGISLayerManager)) { formGISLayerManager.SetAdvSearchColor(Color.Cyan, m_listGeomIDs); m_listGeomIDs.Clear(); } } catch (Exception exc) { Global.WriteOutput("Error: " + exc.Message); } } } }