年度变更建库软件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.
 
 

89 lines
3.8 KiB

using KGIS.Framework.Utils;
using Kingo.Plugin.DTBJKLoadData.Model;
using System;
using System.Collections.Generic;
using System.Xml.Linq;
namespace Kingo.Plugin.DTBJKLoadData
{
public class DTBJKLoadData
{
public static DTBJKLoadData_Default GetDefaultType()
{
DTBJKLoadData_Default dTBJKLoadData = null;
try
{
GetMatchingRegionMapping();
dTBJKLoadData = new DTBJKLoadData_Default();
string SDM = KGIS.Framework.Utils.SysConfigsOprator.GetAppsetingValueByKey("ArearName");
switch (SDM)
{
case "14":
dTBJKLoadData = new DTBJKLoadData_14();
break;
case "61":
dTBJKLoadData = new DTBJKLoadData_61();
break;
}
}
catch (Exception ex)
{
LogAPI.Debug($"DTBJKLoadData_Default 异常:{ex.Message}");
LogAPI.Debug($"DTBJKLoadData_Default 异常:{ex.StackTrace}");
}
return dTBJKLoadData;
}
public static List<MatchingRegionMapping> matchingRegion = new List<MatchingRegionMapping>();
private static List<MatchingRegionMapping> GetMatchingRegionMapping()
{
try
{
matchingRegion.Clear();
string SDM = KGIS.Framework.Utils.SysConfigsOprator.GetAppsetingValueByKey("ArearName");
string matchingRegionFilePath = System.IO.Path.Combine(SysAppPath.GetConfigPath(), "MatchingRegionConfigs.xml");
XDocument pXDoc = XDocument.Load(matchingRegionFilePath);
var elements = pXDoc.Element("MatchingRegion").Elements();
foreach (XElement item in elements)
{
if (!string.IsNullOrEmpty(SDM) && item.Attribute("Code").Value.Equals(SDM))
{
var element = item.Elements();
foreach (XElement xElement in element)
{
MatchingRegionMapping mapping = new MatchingRegionMapping();
mapping.Name = xElement.Attribute("Name").Value;
mapping.PropertyName = xElement.Attribute("PropertyName").Value;
mapping.Order = xElement.Attribute("Order").Value.ToSafeInt();
matchingRegion.Add(mapping);
}
}
}
if (matchingRegion.Count == 0)
{
SDM = "00";
foreach (XElement item in elements)
{
if (!string.IsNullOrEmpty(SDM) && item.Attribute("Code").Value.Equals(SDM))
{
var element = item.Elements();
foreach (XElement xElement in element)
{
MatchingRegionMapping mapping = new MatchingRegionMapping();
mapping.Name = xElement.Attribute("Name").Value;
mapping.PropertyName = xElement.Attribute("PropertyName").Value;
mapping.Order = xElement.Attribute("Order").Value.ToSafeInt();
matchingRegion.Add(mapping);
}
}
}
}
}
catch (Exception ex)
{
LogAPI.Debug("GetMatchingRegionMapping异常:" + ex.Message);
LogAPI.Debug("GetMatchingRegionMapping异常:" + ex.StackTrace);
}
return matchingRegion;
}
}
}