forked from content-manager-sdk/Community
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtensions.cs
More file actions
36 lines (31 loc) · 1.02 KB
/
Extensions.cs
File metadata and controls
36 lines (31 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using HP.HPTRIM.SDK;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
namespace HP.HPTRIM.SDK.Samples.BulkLoading
{
public static class Extensions
{
public static void AddValue(this PropertyOrFieldValueList propList, PropertyIds pid, object value)
{
PropertyDef propDef = new PropertyDef(pid);
PropertyOrFieldValue propValue = new PropertyOrFieldValue(pid);
if (propDef.Format == PropertyFormats.Date
|| propDef.Format == PropertyFormats.Datetime)
{
propValue.SetValue(DateTime.ParseExact((string)value, "yyyy-MM-ddTHH:mm:ssK", CultureInfo.InvariantCulture));
}
else if (propDef.Format == PropertyFormats.Object)
{
propValue.SetValue((long)value);
}
else
{
propValue.SetValue((string)value);
}
propList.Add(propValue);
}
}
}