本文整理汇总了C#中Record.SetCustomField方法的典型用法代码示例。如果您正苦于以下问题:C# Record.SetCustomField方法的具体用法?C# Record.SetCustomField怎么用?C# Record.SetCustomField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record.SetCustomField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplicationService
static void ApplicationService(string Name)
{
try
{
TrimClient trimClient = new TrimClient(serviceapi);
trimClient.Credentials = System.Net.CredentialCache.DefaultCredentials;
//
Locations request = new Locations();
request.q = "me";
request.Properties = new List<string>() { "SortName" };
var Loc = trimClient.Get<LocationsResponse>(request);
Console.WriteLine("Logged onto Eddie as " + Loc.Results[0].SortName);
JsonSerializer s = new JsonSerializer();
T1Application t1 = null;
using (StreamReader sr = new StreamReader(Name))
{
using (JsonTextReader reader = new JsonTextReader(sr))
{
//T1Integration t1 = new T1Integration();
t1 = (T1Application)s.Deserialize(reader, typeof(T1Application));
}
}
if (t1 != null)
{
Console.WriteLine("T1 export file processed.");
if (t1.EddieUri == 0)
{
Record record = new Record();
record.RecordType = new RecordTypeRef() { Uri = 1 };
record.Title = t1.PropertyTitle + " - " + DateTime.Now.ToString();
record.Classification = new ClassificationRef() { Uri=2598 };
record.SetCustomField("PropertyNumber", t1.PropertyNumber);
record.SetCustomField("ApplicationNumber", t1.ApplicationNumber);
record.SetCustomField("PropertyAddress", t1.PropertyAddress);
RecordsResponse response = trimClient.Post<RecordsResponse>(record);
if(response.Results.Count==1)
{
Console.WriteLine("New property container created in Eddie - RM Uri: " + response.Results.First().Uri.ToString());
}
//
FileInfo f = new FileInfo(t1.documentLoc);
if (f.Exists)
{
Record doc = new Record();
doc.Properties = new List<string>() { "Number" , "Url"};
doc.RecordType = new RecordTypeRef() { Uri = 2 };
doc.Container = new RecordRef() { Uri = response.Results.First().Uri };
doc.Title= t1.ApplicationTitle + " - " + DateTime.Now.ToString();
doc.SetCustomField("PropertyNumber", t1.PropertyNumber);
doc.SetCustomField("ApplicationNumber", t1.ApplicationNumber);
RecordsResponse response11= trimClient.PostFileWithRequest<RecordsResponse>(f, doc);
if(response11.Results.Count==1)
{
Record rr = response11.Results.First();
Console.WriteLine("New application document created in Eddie - RM Uri: " + rr.Uri.ToString());
t1.EddieUri = rr.Uri;
t1.EddieRecordNumber = rr.Number;
t1.EddieRecordUrl = rr.Url;
}
}
}
else
{
//Add amend function
}
using (StreamWriter sw = new StreamWriter(pathout + "T1 Application - " + t1.PropertyNumber.ToString() + ".txt"))
{
using (JsonWriter writer = new JsonTextWriter(sw))
{
s.Serialize(writer, t1);
Console.WriteLine("Application file returned");
}
};
FileInfo f2 = new FileInfo(Name);
if (f2.Exists)
f2.Delete();
}
}
//catch (ServiceStack.ServiceClient.Web.WebServiceException ex)
//{
// Console.WriteLine("Service stack error: "+ex.ErrorMessage);
//}
catch (Exception exp)
{
Console.WriteLine("General error: " + exp.Message.ToString());
throw;
}
}