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

56 lines
1.9 KiB

using ESRI.ArcGIS.Geodatabase;
using KGIS.Framework.Utils;
using Kingo.PluginServiceInterface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kingo.Plugin.BGSetting.Commands
{
static class AddFieldSXWHForDBLayer
{
private static void AddField(IClass pClass, string fieldName, string fieldAliasName)
{
try
{
IField fld = new FieldClass();
IFieldEdit2 fldE = fld as IFieldEdit2;
fldE.Type_2 = esriFieldType.esriFieldTypeString;
fldE.Name_2 = fieldName;
fldE.AliasName_2 = fieldAliasName;
fldE.Length_2 = 20;
pClass.AddField(fld);
}
catch (Exception ex)
{
LogAPI.Debug("添加字段失败," + ex);
return;
}
}
public static void JudgeTypeAddField(ProjectInfo ProInfo, IClass featureClass)
{
if (ProInfo == null) return;
if (ProInfo.ProjType == EnumProjType.RCBG_BCGD)
{
if (featureClass.FindField("XMMC") == -1)
AddField(featureClass, "XMMC", "项目名称");
if (featureClass.FindField("BCGDXMQBH") == -1)
AddField(featureClass, "BCGDXMQBH", "补充耕地项目区编号");
}
else if (ProInfo.ProjType == EnumProjType.RCBG_ZJG)
{
if (featureClass.FindField("XMMC") == -1)
AddField(featureClass, "XMMC", "项目名称");
if (featureClass.FindField("XMQBH") == -1)
AddField(featureClass, "XMQBH", "项目区编号");
if (featureClass.FindField("DKBH") == -1)
AddField(featureClass, "DKBH", "地块编号");
}
}
}
}