123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- 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.ShuJuChuLi
- {
- public partial class PCPeiZhi : ConditionPanel
- {
- Recordset rd = null;
- DataTable dtCopy;
- public PCPeiZhi()
- {
- this.ConditionPanelName = "普查数据检查配置";
- InitializeComponent();
- this.SetSize(800, 500);
- this.IsShowResultWindow = false;
- }
- protected override void OnLoad(EventArgs e)
- {
- ComsStatic.setUIDataGridView(uidgv);
- uidgv.ReadOnly = false;
- //rd = ComsStatic.dvConfig.Query(" pzlx='普查数据检查配置' and gxlx='管点表' ", CursorType.Dynamic);
- rd = ComsStatic.QueryRecordsetDynamic(ComsStatic.dvConfig, " pzlx='普查数据检查配置' and gxlx='管点表' ", new string[] { "gxlx", "gxcz", "pzkey", "pzvalue", "gxspjj", "gxczjj" });
- DataTable dt = ComsStatic.RecordsetToDataTable(rd, false);
- dtCopy = dt.Copy();
- uidgv.DataSource = dt;
- for (int i = 0; i < uidgv.Columns.Count; i++)
- {
- uidgv.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
- switch (uidgv.Columns[i].Name.ToLower())
- {
- case "gxlx": uidgv.Columns[i].HeaderText = "普查表类型"; uidgv.Columns[i].ReadOnly = true; break;
- case "gxcz": uidgv.Columns[i].HeaderText = "字段类型"; uidgv.Columns[i].ReadOnly = true; break;
- case "pzkey": uidgv.Columns[i].HeaderText = "字段标识"; uidgv.Columns[i].ReadOnly = true; break;
- case "pzvalue": uidgv.Columns[i].HeaderText = "普查标准"; uidgv.Columns[i].ReadOnly = true; break;
- case "gxspjj": uidgv.Columns[i].HeaderText = "数值字段最小值"; uidgv.Columns[i].ReadOnly = false; break;
- case "gxczjj": uidgv.Columns[i].HeaderText = "数值字段最大值"; uidgv.Columns[i].ReadOnly = false; break;
- default: uidgv.Columns[i].Visible = false; break;
- }
- }
- }
- public override object Do(DockPanel dockPanel = null)
- {
- try
- {
- int smid = 0;
- for (int i = 0; i < uidgv.Rows.Count; i++)
- {
- smid = ComsStatic.StringToInt(dtCopy.Rows[i]["smid"]);
- if (smid == 0) continue;
- if (uidgv.Rows[i].Cells["gxspjj"].Value?.ToString() != dtCopy.Rows[i]["gxspjj"]?.ToString() || uidgv.Rows[i].Cells["gxczjj"].Value?.ToString() != dtCopy.Rows[i]["gxczjj"]?.ToString())
- {
- rd.SeekID(smid);
- rd.Edit();
- rd.SetFieldValue("gxspjj", ComsStatic.StringToDouble(uidgv.Rows[i].Cells["gxspjj"].Value));
- rd.SetFieldValue("gxczjj", ComsStatic.StringToDouble(uidgv.Rows[i].Cells["gxczjj"].Value));
- rd.Update();
- }
- }
- ComsStatic.ShowOKLog("配置更改成功"); return true;
- }
- catch (Exception e)
- {
- ComsStatic.ShowErrorLog("配置更改失败", e.Message); return false;
- }
- }
- public override void AfterClose()
- {
- ComsStatic.RecordsetDispose(rd);
- base.AfterClose();
- }
- }
- }
|