年度变更建库软件5.0版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

118 lines
5.0 KiB

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
{
/// <summary>
/// UCSJSHYJ.xaml 的交互逻辑
/// </summary>
public partial class UCSJSHYJXX : UserControl, IElementInfo
{
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 UCSJSHYJXX()
{
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)
{
this.LayoutControl.Children.Clear();
return;
}
if (string.IsNullOrWhiteSpace(NYYSInfo.WYRWTB.TBBSM) || taskPackage == null || string.IsNullOrWhiteSpace(taskPackage.PackageTempPath) || !System.IO.File.Exists(taskPackage.PackageTempPath))
{
this.LayoutControl.Children.Clear();
return;
}
rdbHelper = RDBFactory.CreateDbHelper($"{taskPackage.PackageTempPath}{(MapsManager.Instance.CurrProjectInfo as ProjectInfo).Pathpassword}", DatabaseType.SQLite);
if (!rdbHelper.TableIsExist("detailjson"))
{
this.LayoutControl.Children.Clear();
return;
}
DataTable dataTable = rdbHelper.ExecuteDatatable("gjshyj", $"select * from detailjson where tbbsm='{NYYSInfo.WYRWTB.TBBSM}'", true);
this.LayoutControl.Children.Clear();
if (dataTable == null || dataTable.Rows.Count == 0) return;
string strPath = System.IO.Path.Combine(SysAppPath.GetConfigPath(), "GeneralConfig.xml");
XmlDocument doc = new XmlDocument();
doc.Load(strPath);
XmlElement entityElem = (XmlElement)doc.SelectSingleNode("/GeneralConfig/UCSJSHYJXX");
foreach (XmlElement propElem in entityElem.SelectNodes("property"))
{
if (propElem.GetAttribute("Visibility") != "true") continue;
DataRow dataRow = null;
if (dataTable.Select($"Name='{propElem.GetAttribute("LabelName")}'").Length > 0)
{
dataRow = dataTable.Select($"Name='{propElem.GetAttribute("LabelName")}'")[0];
}
else if (dataTable.Select($"Name='{propElem.GetAttribute("Name")}'").Length > 0)
{
dataRow = dataTable.Select($"Name='{propElem.GetAttribute("Name")}'")[0];
}
if (dataRow != null)
{
LayoutItem layoutItem = new LayoutItem();
layoutItem.Label = propElem.GetAttribute("LabelName");
layoutItem.Height = 30;
layoutItem.LabelHorizontalAlignment = System.Windows.HorizontalAlignment.Right;
TextEdit textEdit = new TextEdit();
textEdit.Height = 27;
textEdit.IsReadOnly = true;
textEdit.Text = $"{dataRow["Value"].ToString().Replace("null", "").Trim()}";
layoutItem.Content = textEdit;
LayoutControl.Children.Add(layoutItem);
}
}
}
}
catch (Exception ex)
{
LogAPI.Debug($"{ex.Message}");
LogAPI.Debug($"{ex.Source}");
}
}
public void SaveEdit()
{
}
}
}