using KGIS.Framework.DBOperator; using KGIS.Framework.Maps; using KGIS.Framework.Utils; using KGIS.Framework.Utils.ExtensionMethod; using KGIS.Framework.Views; using Kingo.PluginServiceInterface; using Kingo.PluginServiceInterface.Enums; using Kingo.PluginServiceInterface.Model; using System; using System.ComponentModel; using System.Data; using System.Windows; using System.Windows.Controls; namespace Kingo.Plugin.General.View { /// /// UCDTBSLNYYSResult.xaml 的交互逻辑 /// public partial class UCDTBSLNYYSResult : UserControl, IElementInfo, INotifyPropertyChanged { public UCDTBSLNYYSResult() { InitializeComponent(); this.Title = "外业举证信息"; } 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 System.Drawing.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 event PropertyChangedEventHandler PropertyChanged; public void BindData(object obj) { IRDBHelper rdbHelper = null; WYHCCG wYHCCG = null; try { NYYSInfo nYYSInfo = obj as NYYSInfo; if (nYYSInfo == null) { this.DataContext = null; return; } if (nYYSInfo.BingDataType == DTBDataTypeEnum.DTBSL) { if (nYYSInfo.NYYSResult != null) wYHCCG = new WYHCCG() { HCBGDL = nYYSInfo.NYYSResult.NYYPDL, HCSJ = nYYSInfo.NYYSResult.YPSJ, HCRY = nYYSInfo.NYYSResult.YPRY, HCJL = nYYSInfo.NYYSResult.YPSM, }; } else if (nYYSInfo.TaskPackages != null && nYYSInfo.WYRWTB != null) { TaskPackage taskPackage = nYYSInfo.TaskPackages; rdbHelper = RDBFactory.CreateDbHelper($"{taskPackage.PackageTempPath}{(MapsManager.Instance.CurrProjectInfo as ProjectInfo).Pathpassword}", DatabaseType.SQLite); if (rdbHelper == null) return; DataTable dataTable = rdbHelper.ExecuteDatatable("WYHCCG", $" select HCBGDL,HCSJ,HCRY,HCJL from WYHCCG where HCRWBSM='{nYYSInfo.WYRWTB.TBBSM}' ", true); if (dataTable != null && dataTable.Rows.Count > 0) { DataRow dataRow = dataTable.Rows[0]; wYHCCG = new WYHCCG() { HCBGDL = dataRow["HCBGDL"].ToTrim(), HCSJ = dataRow["HCSJ"].ToTrim(), HCRY = dataRow["HCRY"].ToTrim(), HCJL = dataRow["HCJL"].ToTrim(), }; } } if (wYHCCG != null) { this.DataContext = null; this.DataContext = wYHCCG; } } catch (Exception ex) { LogAPI.Debug("绑定外业核查成果异常:" + ex.Message); LogAPI.Debug("绑定外业核查成果异常:" + ex.StackTrace); throw ex; } } public void SaveEdit() { } private void LayoutControl_GotFocus(object sender, RoutedEventArgs e) { if ((MapsManager.Instance.CurrProjectInfo as ProjectInfo) != null) { (MapsManager.Instance.CurrProjectInfo as ProjectInfo).EnableShortcut = false; } } private void LayoutControl_LostFocus(object sender, RoutedEventArgs e) { if ((MapsManager.Instance.CurrProjectInfo as ProjectInfo) != null) { (MapsManager.Instance.CurrProjectInfo as ProjectInfo).EnableShortcut = true; } } private class WYHCCG { public string HCBGDL { get; set; } public string HCSJ { get; set; } public string HCRY { get; set; } public string HCJL { get; set; } } public class KeyValue { public string Code { get; set; } public int CodeInt { get; set; } public string Name { get; set; } } private void TxtYPSM_GotFocus(object sender, RoutedEventArgs e) { if ((MapsManager.Instance.CurrProjectInfo as ProjectInfo) != null) { (MapsManager.Instance.CurrProjectInfo as ProjectInfo).EnableShortcut = false; } } private void TxtYPSM_LostFocus(object sender, RoutedEventArgs e) { if ((MapsManager.Instance.CurrProjectInfo as ProjectInfo) != null) { (MapsManager.Instance.CurrProjectInfo as ProjectInfo).EnableShortcut = true; } } } }