本文整理汇总了C#中FieldDefinition.Save方法的典型用法代码示例。如果您正苦于以下问题:C# FieldDefinition.Save方法的具体用法?C# FieldDefinition.Save怎么用?C# FieldDefinition.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldDefinition
的用法示例。
在下文中一共展示了FieldDefinition.Save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SyncUdfs
private static void SyncUdfs()
{
List<ADDITIONALFIELD> lstaf = new List<ADDITIONALFIELD>();
ADDITIONALFIELD af = new ADDITIONALFIELD();
af.LENGTH = "65536";
af.NAME = "ECM Application:RAM_Application_Number";
lstaf.Add(af);
af.LENGTH = "65536";
af.NAME = "ECM Application:RAM_Application_Number1";
lstaf.Add(af);
//MySerializableClass myObject;
// Construct an instance of the XmlSerializer with the type
// of object that is being deserialized.
XmlSerializer mySerializer = new XmlSerializer(typeof(List<ADDITIONALFIELD>));
// To read the file, create a FileStream.
//TextWriter textWriter = new StreamWriter(@"D:\Users\WyldLynx\Documents\ECMTEST.xml");
//mySerializer.Serialize(textWriter, lstaf);
//textWriter.Close();
//
FileStream myFileStream = new FileStream(@"\ECMTEST.xml", FileMode.Open);
// Call the Deserialize method and cast to the object type.
lstaf = (List<ADDITIONALFIELD>)mySerializer.Deserialize(myFileStream);
TrimApplication.Initialize();
using (Database db = new Database())
{
foreach (ADDITIONALFIELD aff in lstaf)
{
if (db.FindTrimObjectByName(BaseObjectTypes.FieldDefinition, aff.NAME) == null)
{
FieldDefinition fd = new FieldDefinition(db);
fd.Name = aff.NAME;
switch (Convert.ToInt64(aff.FORMAT))
{
case 0:
fd.Format = UserFieldFormats.String;
break;
case 1:
fd.Format = UserFieldFormats.Number;
break;
case 2:
fd.Format = UserFieldFormats.Boolean;
break;
case 3:
fd.Format = UserFieldFormats.Date;
break;
case 4:
fd.Format = UserFieldFormats.Datetime;
break;
case 5:
fd.Format = UserFieldFormats.Decimal;
break;
case 6:
fd.Format = UserFieldFormats.Text;
break;
case 7:
fd.Format = UserFieldFormats.Currency;
break;
//case 8:
// fd.Format = UserFieldFormats.
// break;
case 9:
fd.Format = UserFieldFormats.Object;
break;
//case 10:
// fd.Format = UserFieldFormats.
// break;
case 11:
fd.Format = UserFieldFormats.String;
break;
case 13:
fd.Format = UserFieldFormats.Geography;
break;
}
fd.UpperLimit = aff.UPPERLIMIT;
fd.Length = Convert.ToInt32(aff.LENGTH);
fd.SetNotes("Additional field syncronised automatically", NotesUpdateType.AppendWithUserStamp);
RecordType rt = new RecordType(db, 16);
fd.SetIsUsedForRecord(rt, true);
fd.Save();
Console.WriteLine("new additional field added: " + fd.Name);
}
else
{
Console.WriteLine("Additional field already exists: " + aff.NAME);
}
//.........这里部分代码省略.........