123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using WWPipeLine.MapBasic.Conditions;
- using WeifenLuo.WinFormsUI.Docking;
- using WWPipeLine.MapBasic;
- using SuperMap.Data;
- using SuperMap.Mapping;
- using Sunny.UI;
- namespace WWPipeLine.MapTools.Conditions.XiTongGuanLi
- {
- public partial class ShuJuZiDian : ConditionPanel
- {
- Recordset rd = null;
- private int rdsmid = 0;
- public ShuJuZiDian()
- {
- this.ConditionPanelName = "数据字典维护";
- InitializeComponent();
- this.SetSize(600, 585);
- this.IsShowResultWindow = false;
- }
- protected override void OnLoad(EventArgs e)
- {
- foreach (Layer lyr in ComsStatic.MapLayersUsed)
- {
- uilbLayers.Items.Add(new DoListItem(lyr.Dataset.Name, lyr.Caption));
- }
- uilbLayers.SelectedIndex = 0;
- }
- public override object Do(DockPanel dockPanel = null)
- {
- if (rdsmid == 0 || string.IsNullOrEmpty(uitb.Text)) { UIMessageTip.ShowError("请先选择需要操作的信息!"); return null; }
- if (rd.SeekID(rdsmid))
- {
- rd.Edit();
- rd.SetFieldValue("infos", uitb.Text);
- ComsStatic.ShowUIMessageTipOKorError(rd.Update(), "数据字典配置更改");
- }
- else
- {
- Sunny.UI.UIMessageTip.ShowError("信息在编辑选择时失败");
- }
- uilbLayers.SelectedIndex = 0;
- return null;
- }
- private void uilbLayers_SelectedIndexChanged(object sender, EventArgs e)
- {
- string itemKey = (uilbLayers.SelectedItem as DoListItem).Key;
- string itemValue = (uilbLayers.SelectedItem as DoListItem).Value;
- QueryParameter queryParameter = new QueryParameter
- {
- AttributeFilter = string.Format(" pzlx='数据字典' AND gxlx='{0}' ", itemKey),
- ResultFields = new string[] { "smid", "pzlx", "gxlx", "pzKey", "pzValue", "infos" },
- OrderBy = new string[] { " smid asc " },
- CursorType = CursorType.Dynamic
- };
- rd = ComsStatic.dvJSLK_PZ.Query(queryParameter);
- if (rd.RecordCount == 0)
- {
- DatasetVector dv = ComsStatic.Datasource.Datasets[itemKey] as DatasetVector;
- FieldInfos infos = dv.GetRecordset(true, CursorType.Static).GetFieldInfos();
- foreach (FieldInfo info in infos)
- {
- if (ComsStatic.HideEnableTag.Contains("," + info.Name.ToLower() + ",") || info.IsSystemField) continue;
- rd.AddNew(new GeoPoint(0, 0));
- rd.SetFieldValue("pzlx", "数据字典");
- rd.SetFieldValue("gxlx", dv.Name);
- rd.SetFieldValue("pzKey", itemValue);
- rd.SetFieldValue("pzValue", info.Caption);
- rd.Update();
- }
- rd = ComsStatic.dvJSLK_PZ.Query(queryParameter);
- }
- ComsStatic.setUIDataGridView(uidgv, ComsStatic.RecordsetToDataTable(rd), null, "pzlx,gxlx");
- }
- private void uidgv_SelectIndexChange(object sender, int index)
- {
- if (uidgv.SelectedRows == null || uidgv.SelectedRows.Count != 1) return;
- rdsmid = ComsStatic.StringToInt(uidgv.SelectedRows[0].Cells["SmID"].Value);
- uitb.Text = uidgv.SelectedRows[0].Cells["infos"].Value?.ToString();
- }
- public override void AfterClose()
- {
- ComsStatic.RecordsetDispose(rd);
- base.AfterClose();
- }
- }
- }
|