using DevExpress.Xpf.Editors; using DevExpress.Xpf.LayoutControl; using ESRI.ArcGIS.esriSystem; using KGIS.Framework.DBOperator; using KGIS.Framework.Maps; using KGIS.Framework.Utils; using KGIS.Framework.Views; using Kingo.PluginServiceInterface; using Kingo.PluginServiceInterface.Model; using System; using System.Data; using System.Drawing; using System.Windows.Controls; using System.Windows.Data; using System.Xml; namespace Kingo.Plugin.General.View { /// /// UCSJSHYJ.xaml 的交互逻辑 /// public partial class UCGJSHYJ : UserControl, IElementInfo { private NYYSInfo ReturnComments { get; set; } public bool IsShow { get; set; } public int ShowIndex { get; set; } public bool ResetSize { get; set; } public bool AllowEdit { get; set; } public Guid ID { get; set; } public DockStyle DockAreas { get; set; } public Size FloatSize { get; set; } public int DockWidth { get; set; } public int DockHeight { get; set; } public DockStyle DefaultArea { get; set; } public bool ShowCloseButton { get; set; } public bool ShowAutoHideButton { get; set; } public string Title { get; set; } public UCGJSHYJ() { InitializeComponent(); Title = "国家反馈意见"; } private NYYSInfo NYYSInfo { get; set; } private TaskPackage taskPackage { get; set; } public void BindData(object obj) { IRDBHelper rdbHelper = null; try { NYYSInfo nYYSInfo = obj as NYYSInfo; if (nYYSInfo != null) { this.NYYSInfo = nYYSInfo; this.taskPackage = nYYSInfo.TaskPackages; if (NYYSInfo.WYRWTB == null || string.IsNullOrWhiteSpace(NYYSInfo.WYRWTB.TBBSM) || taskPackage == null || string.IsNullOrWhiteSpace(taskPackage.PackageTempPath) || !System.IO.File.Exists(taskPackage.PackageTempPath)) { this.DataContext = null; return; } this.ReturnComments = new NYYSInfo(); rdbHelper = RDBFactory.CreateDbHelper($"{taskPackage.PackageTempPath}{(MapsManager.Instance.CurrProjectInfo as ProjectInfo).Pathpassword}", DatabaseType.SQLite); //if (!rdbHelper.TableIsExist("ReturnComments")) //{ // this.DataContext = null; // this.DataContext = this.ReturnComments; //} //国家审核意见 if (rdbHelper.GetTable("GJFKJG") != null)//rdbHelper.TableIsExist("GJFKJG")) { DataTable dataTable = rdbHelper.ExecuteDatatable("gjshyj", $"select * from GJFKJG where tbbsm='{NYYSInfo.WYRWTB.TBBSM}'", true); this.ReturnComments.GJReturnComments = new GJFKJG(); if (dataTable != null && dataTable.Rows.Count > 0) { this.ReturnComments.GJReturnComments = KGIS.Framework.Utils.Utility.TBToList.ConvertEntity(dataTable.Rows[0]); } } this.LayoutControl.Children.Clear(); this.DataContext = null; this.DataContext = this.ReturnComments; XmlDocument doc = new XmlDocument(); string strPath = System.IO.Path.Combine(SysAppPath.GetConfigPath(), "GeneralConfig.xml"); doc.Load(strPath); XmlElement entityElem = (XmlElement)doc.SelectSingleNode("/GeneralConfig/entity"); if (entityElem == null) return; foreach (XmlElement propElem in entityElem.SelectNodes("property")) { if (propElem.GetAttribute("Visibility") != "true") continue; LayoutItem layoutItem = new LayoutItem(); layoutItem.Label = $"{propElem.GetAttribute("LabelName")}:"; layoutItem.Height = 30; layoutItem.LabelHorizontalAlignment = System.Windows.HorizontalAlignment.Right; Binding binding = new Binding("GJReturnComments." + propElem.GetAttribute("Name")); binding.Source = this.DataContext; binding.Mode = BindingMode.TwoWay; TextEdit textEdit = new TextEdit(); textEdit.Height = 27; textEdit.IsReadOnly = true; textEdit.SetBinding(TextEdit.TextProperty, binding); layoutItem.Content = textEdit; LayoutControl.Children.Add(layoutItem); } } } catch (Exception ex) { LogAPI.Debug($"绑定国家反馈意见异常:{ex.Message}"); LogAPI.Debug($"绑定国家反馈意见异常:{ex.Source}"); } } public void SaveEdit() { } } }