Set Pre and Post image about Field Date time to fields Text

477 Views Asked by At

I have Field in DateTime type and I want to set it's value in images in Plugins set the value in Pre image and after update set the updated value in Post image.

The mother form field type DateTime and the child form contains 2 fields (old value field type Text string and the second field new value Type Text string )

if (customerDataPreImage.Contains("ph_releasedate"))
{
     customerHistory["ph_oldreleasedate"] = Convert.ToDateTime(customerDataPreImage.Attributes["ph_releasedate"]);
}
if (customerDataPostImage.Contains("ph_releasedate"))
{
     customerHistory["ph_newreleasedate"] = Convert.ToDateTime(customerDataPostImage.Attributes["ph_releasedate"]);
}
1

There are 1 best solutions below

0
Tony Medhat On BEST ANSWER

after change field type to datetime and use this code working fine now

if (customerDataPreImage.Contains("ph_releasedate")) {
    customerHistory["ph_oldreleasedate2"] = customerDataPreImage.Attributes["ph_releasedate"];
}
if (customerDataPostImage.Contains("ph_releasedate")) {
    customerHistory["ph_newreleasedate2"] = customerDataPostImage.Attributes["ph_releasedate"];
}