This commit is contained in:
@@ -410,7 +410,7 @@ var DateCustomFields = await ExportCustomFieldSchema(ocf, "User", "User");
|
|||||||
//Custom fields?
|
//Custom fields?
|
||||||
if (ShouldExportCustom)
|
if (ShouldExportCustom)
|
||||||
{
|
{
|
||||||
d.customFields = CustomFieldData(c);
|
d.customFields = CustomFieldData(c,DateCustomFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
var a = await util.PostAsync("User", d.ToString());
|
var a = await util.PostAsync("User", d.ToString());
|
||||||
@@ -742,16 +742,28 @@ var DateCustomFields = await ExportCustomFieldSchema(ocf, "User", "User");
|
|||||||
|
|
||||||
|
|
||||||
//export objects custom field data into jobject string
|
//export objects custom field data into jobject string
|
||||||
private string CustomFieldData(object biz)
|
private string CustomFieldData(object biz, List<int> dateFields)
|
||||||
{
|
{
|
||||||
dynamic d=new JObject();
|
dynamic d=new JObject();
|
||||||
|
|
||||||
for (int x = 0; x < 10; x++)
|
for (int x = 0; x < 10; x++)
|
||||||
{
|
{
|
||||||
object o = (object)biz.GetType().GetProperty("Custom"+x.ToString()).GetValue(biz, null);
|
object o = (object)biz.GetType().GetProperty("Custom"+x.ToString()).GetValue(biz, null);
|
||||||
//if (o != null)
|
string s = o.ToString();
|
||||||
// o = o.ToString();
|
if (string.IsNullOrWhiteSpace(s))
|
||||||
//JObject j = (JObject) JObject.FromObject(o);
|
{
|
||||||
|
s = null;
|
||||||
|
}
|
||||||
|
if (s!=null && dateFields.Contains(x))
|
||||||
|
{
|
||||||
|
//parse out to UTC date
|
||||||
|
DateTime dt=new DateTime();
|
||||||
|
if (DateTime.TryParse(s, out dt))
|
||||||
|
{
|
||||||
|
s = dt.ToUniversalTime().ToString("s");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
d["c"+(x+1).ToString()] = o.ToString();
|
d["c"+(x+1).ToString()] = o.ToString();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -776,14 +788,11 @@ var DateCustomFields = await ExportCustomFieldSchema(ocf, "User", "User");
|
|||||||
|
|
||||||
private async System.Threading.Tasks.Task<List<int>> ExportCustomFieldSchema(ObjectCustomFields ocf, string v7CustomFieldObjectName, string RavenCustomTranslationKeyObjectName)
|
private async System.Threading.Tasks.Task<List<int>> ExportCustomFieldSchema(ObjectCustomFields ocf, string v7CustomFieldObjectName, string RavenCustomTranslationKeyObjectName)
|
||||||
{
|
{
|
||||||
var ret = new List<int>();
|
var ret = new List<int>();
|
||||||
|
//NOTE: this code inspired by winforApp::Util.cs PrepareCustomFieldsGrid method
|
||||||
//NOTE: this code inspired by winforApp::Util.cs PrepareCustomFieldsGrid method
|
|
||||||
|
|
||||||
dynamic d = new JObject();
|
dynamic d = new JObject();
|
||||||
d.formkey = RavenCustomTranslationKeyObjectName;
|
d.formkey = RavenCustomTranslationKeyObjectName;
|
||||||
dynamic dtemplate = new JArray();
|
dynamic dtemplate = new JArray();
|
||||||
|
|
||||||
foreach (ObjectCustomField f in ocf)
|
foreach (ObjectCustomField f in ocf)
|
||||||
{
|
{
|
||||||
if (f.Visible)
|
if (f.Visible)
|
||||||
@@ -826,13 +835,9 @@ var DateCustomFields = await ExportCustomFieldSchema(ocf, "User", "User");
|
|||||||
dt.type = util.AyaUiFieldDataType.Text;
|
dt.type = util.AyaUiFieldDataType.Text;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
dtemplate.Add(dt);
|
dtemplate.Add(dt);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
d.template = dtemplate.ToString();
|
d.template = dtemplate.ToString();
|
||||||
|
|
||||||
//ok, were here because there *are* custom fields available
|
//ok, were here because there *are* custom fields available
|
||||||
|
|||||||
Reference in New Issue
Block a user