private void btn_Query_Click(object sender, EventArgs e) { if (lookUpEdit_Field.EditValue == null || lookUpEdit_Layer.EditValue == null) { XtraMessageBox.Show("请选择要查询的图层及字段!", "提示"); return; } var layerName = lookUpEdit_Layer.EditValue.ToString(); var fieldName = lookUpEdit_Field.EditValue.ToString(); var dt = WorkspaceService.Instance.GetDataset(ConfigHelper.GetConfig("StationDatasourceName"), layerName) as DatasetVector; string queryFilter = ""; var keyword = txt_Keyword.Text.Trim(); queryFilter = string.IsNullOrEmpty(keyword) ? "" : string.Format("{0} like '%{1}%'", fieldName, keyword); var rs = dt.Query(queryFilter, CursorType.Static); var selectedLayer = (LayerInfo)lookUpEdit_Layer.GetSelectedDataRow(); var datatable = GISUtility.RecordsetToDataTable(rs, selectedLayer); rs.Close(); rs.Dispose(); dt.Close(); _mainForm.ShowQueryResult(); _mainForm.CreateQueryResultGrid(datatable, selectedLayer); this.Close(); }
private void mapCtl_Station_DoubleClick(object sender, EventArgs e) { var selections = mapCtl_Station.Map.FindSelection(true); if (selections.Count() > 0) { var rs = selections[0].ToRecordset(); if (rs.RecordCount > 0) { rs.MoveFirst(); var smId = rs.GetID(); var layerName = rs.Dataset.Name; var layerInfo = LayerService.INSTANCE.GetStationLayerInfos().First(l => l.LayerName == layerName); var dt = GISUtility.RecordsetToDataTable(rs, layerInfo); if (!rs.IsClosed) { rs.Close(); rs.Dispose(); } var selectedRow = dt.Select(string.Format("SMID = '{0}'", smId))[0]; var eqptInfo = new DlgEqptInfo(smId, layerInfo, ref selectedRow); eqptInfo.ShowDialog(); } } }
void alertControl1_AlertClick(object sender, AlertClickEventArgs e) { var expireMaintains = (List <EqptMaintain>)e.Info.Tag; var layerEqpts = new Dictionary <string, List <int> >(); foreach (var eqptMaintain in expireMaintains) { if (layerEqpts.ContainsKey(eqptMaintain.LayerName)) { layerEqpts[eqptMaintain.LayerName].Add(eqptMaintain.SmId); } else { layerEqpts.Add(eqptMaintain.LayerName, new List <int>() { eqptMaintain.SmId }); } } if (layerEqpts.Count < 0) { return; } this.ShowQueryResult(); foreach (var layerEqpt in layerEqpts) { var layerinfo = LayerService.INSTANCE.GetStationLayerInfos().Any(l => l.LayerName == layerEqpt.Key) ? LayerService.INSTANCE.GetStationLayerInfos().First(l => l.LayerName == layerEqpt.Key) : LayerService.INSTANCE.GetSiteLayerInfos().First(l => l.LayerName == layerEqpt.Key); if (layerinfo != null) { var dt = WorkspaceService.Instance.GetDataset(ConfigHelper.GetConfig("StationDatasourceName"), layerEqpt.Key) as DatasetVector; if (dt != null) { var rs = dt.Query(layerEqpt.Value.ToArray(), CursorType.Static); var datatable = GISUtility.RecordsetToDataTable(rs, layerinfo); rs.Close(); rs.Dispose(); dt.Close(); this.CreateQueryResultGrid(datatable, layerinfo); } } } }
private void mapCtl_Station_GeometrySelectChanged(object sender, GeometrySelectChangedEventArgs e) { xtraTabCtl_QueryResult.TabPages.Clear(); var selections = mapCtl_Station.Map.FindSelection(true); dockPanel_QueryResult.Visible = selections.Length > 0; foreach (var selection in selections) { var rs = selection.ToRecordset(); var datasetName = rs.Dataset.Name; var selectedLayer = LayerService.INSTANCE.GetStationLayerInfos().First(l => l.LayerName == datasetName); var dt = GISUtility.RecordsetToDataTable(rs, selectedLayer); rs.Close(); rs.Dispose(); CreateQueryResultGrid(dt, selectedLayer); } }
private void ViewAllAttribute() { var dt = WorkspaceService.Instance.GetDataset(ConfigHelper.GetConfig("StationDatasourceName"), _blinkLayerName) as DatasetVector; if (dt == null) { return; } var rs = dt.GetRecordset(false, CursorType.Static); var table = GISUtility.RecordsetToDataTable(rs, _blinkLayerInfo); rs.Close(); rs.Dispose(); dt.Close(); ShowQueryResult(); CreateQueryResultGrid(table, _blinkLayerInfo); }
private void btn_Query_Click(object sender, EventArgs e) { if (commbox_QueryType.SelectedIndex < 6) { if (txt_Keyword.Text.Trim() == "") { XtraMessageBox.Show("请输入查询关键字!"); return; } } else { if (dateEdit_Start.DateTime > dateEdit_end.DateTime) { XtraMessageBox.Show("起始时间不能的大于终止时间!"); return; } } var searchStr = ""; switch (commbox_QueryType.SelectedIndex) { case 0: searchStr = string.Format("Name like '%{0}%'", txt_Keyword.Text); break; case 1: searchStr = string.Format("LayerName like '%{0}%'", txt_Keyword.Text); break; case 2: searchStr = string.Format("Department like '%{0}%'", txt_Keyword.Text); break; case 3: searchStr = string.Format("Maintainer like '%{0}%'", txt_Keyword.Text); break; case 4: searchStr = string.Format("EqptName like '%{0}%'", txt_Keyword.Text); break; case 5: searchStr = string.Format("Checker like '%{0}%'", txt_Keyword.Text); break; case 6: searchStr = string.Format("RecordDate between '{0}' and '{1}'", dateEdit_Start.DateTime, dateEdit_end.DateTime); break; case 7: searchStr = string.Format("MaintainDate between '{0}' and '{1}'", dateEdit_Start.DateTime, dateEdit_end.DateTime); break; case 8: searchStr = string.Format("NextMaintainDate between '{0}' and '{1}'", dateEdit_Start.DateTime, dateEdit_end.DateTime); break; } if (searchStr != "") { var maintainBll = new EqptMaintain(); var maintains = maintainBll.GetModelList(searchStr); var layerEqpts = new Dictionary <string, List <int> >(); foreach (var eqptMaintain in maintains) { if (layerEqpts.ContainsKey(eqptMaintain.LayerName)) { layerEqpts[eqptMaintain.LayerName].Add(eqptMaintain.SmId); } else { layerEqpts.Add(eqptMaintain.LayerName, new List <int>() { eqptMaintain.SmId }); } } if (layerEqpts.Count < 0) { return; } _mainForm.ShowQueryResult(); foreach (var layerEqpt in layerEqpts) { var layerinfo = LayerService.INSTANCE.GetStationLayerInfos().Any(l => l.LayerName == layerEqpt.Key) ? LayerService.INSTANCE.GetStationLayerInfos().First(l => l.LayerName == layerEqpt.Key) : LayerService.INSTANCE.GetSiteLayerInfos().First(l => l.LayerName == layerEqpt.Key); if (layerinfo != null) { var dt = WorkspaceService.Instance.GetDataset(ConfigHelper.GetConfig("StationDatasourceName"), layerEqpt.Key) as DatasetVector; if (dt != null) { var rs = dt.Query(layerEqpt.Value.ToArray(), CursorType.Static); var datatable = GISUtility.RecordsetToDataTable(rs, layerinfo); rs.Close(); rs.Dispose(); dt.Close(); _mainForm.CreateQueryResultGrid(datatable, layerinfo); } } } } }