public override void GetFieldValuesToStringForCompare()
        {
            dynamic fieldDateTime = Item.listItem.ParentList.Fields.GetField(FieldTitle);

            if (fieldDateTime.DisplayFormat.ToString() == "DateOnly" && FieldValueAfter != null && Regex.IsMatch(FieldValueAfter.ToString(), @"T00:00:00Z$") && !(Item.listItem.ParentList.BaseTemplate == SPListTemplateType.Events || Item.listItem.ParentList.BaseTemplate == SPListTemplateType.TasksWithTimelineAndHierarchy))
            {
                FieldValueBefore = (FieldValueBefore != null && FieldValueBefore.ToString() != "") ? FieldValueBefore.ToLocalTime() : null;
            }

            if (Item.listItem.ParentList.BaseTemplate == SPListTemplateType.Events || Item.listItem.ParentList.BaseTemplate == SPListTemplateType.TasksWithTimelineAndHierarchy)
            {
                FieldValueBeforeToStringForCompare = (FieldValueBefore != null && FieldValueBefore.ToString() != "") ? FieldValueBefore.ToString("yyyy-MM-ddTHH:mm:ssZ") : "";
            }
            else
            {
                FieldValueBeforeToStringForCompare = (FieldValueBefore != null && FieldValueBefore.ToString() != "") ? FieldValueBefore.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") : "";
            }

            if (FieldValueAfter != null && FieldValueAfter.GetType().Name != "DateTime")
            {
                FieldValueAfterToStringForCompare = (FieldValueAfter != null && FieldValueAfter.ToString() != "") ? FieldValueAfter.ToString() : "";
            }
            else
            {
                FieldValueAfterToStringForCompare = (FieldValueAfter != null && FieldValueAfter.ToString() != "") ? FieldValueAfter.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") : "";
            }
        }
 public override void GetFieldValuesToStringForCompare()
 {
     FieldValueBeforeToStringForCompare = 
         (FieldValueBefore != null && FieldValueBefore.ToString() != "") ?
         Regex.Replace( ((string)FieldValueBefore).Replace("\r\n", "\n"), "^<div></div>$", String.Empty ) : 
         "";
     FieldValueAfterToStringForCompare = 
         (FieldValueAfter != null && FieldValueAfter.ToString() != "") ?
         Regex.Replace( ((string)FieldValueAfter).Replace("\r\n", "\n"), "^<div></div>$", String.Empty ) : 
         "";
 }
Example #3
0
        public override void GetFieldValuesToStringForCompare()
        {
            SPFieldUserValue[] FieldValueBeforeArr = (FieldValueBefore != null && FieldValueBefore.ToString() != "") ?
                                                     FieldValueBefore.ToArray() :
                                                     new SPFieldUserValue[] { };
            SPFieldUserValue[] FieldValueAfterArr = (FieldValueAfter != null && FieldValueAfter.ToString() != "") ?
                                                    (new SPFieldUserValueCollection(Item.listItem.Web, FieldValueAfter.ToString())).ToArray() :
                                                    new SPFieldUserValue[] { };

            FieldValueBeforeToStringForCompare = (FieldValueBeforeArr.Length > 0) ?
                                                 String.Join(",", Array.ConvertAll(FieldValueBeforeArr, p => (p.User != null) ? p.User.LoginName : p.LookupValue)) :
                                                 "";
            FieldValueAfterToStringForCompare = (FieldValueAfterArr.Length > 0) ?
                                                String.Join(",", Array.ConvertAll(FieldValueAfterArr, p => (p.User != null) ? p.User.LoginName : p.LookupValue)) :
                                                "";
        }
        public override void GetFieldValuesToStringForCompare()
        {
            SPFieldUserValue fieldValueBeforeUser = new SPFieldUserValue(Item.listItem.Web, FieldValueBefore.ToString());
            SPFieldUserValue fieldValueAfterUser  = new SPFieldUserValue();

            if (FieldValueAfter != null)
            {
                fieldValueAfterUser = new SPFieldUserValue(Item.listItem.Web, FieldValueAfter.ToString());
            }

            FieldValueBeforeToStringForCompare =
                (FieldValueBefore != null && FieldValueBefore.ToString() != "") ?
                (fieldValueBeforeUser.User != null ? fieldValueBeforeUser.User.LoginName : fieldValueBeforeUser.LookupValue) : "";
            FieldValueAfterToStringForCompare =
                (FieldValueAfter != null && FieldValueAfter.ToString() != "") ?
                (fieldValueAfterUser.User != null ? fieldValueAfterUser.User.LoginName : fieldValueAfterUser.LookupValue) : "";

            if (FieldValueAfter != null && FieldValueAfter.ToString() != "" && FieldValueAfterToStringForCompare == "")
            {
                FieldValueAfterToStringForCompare = new SPFieldUserValue(Item.listItem.Web, FieldValueAfter.ToString()).User.LoginName;
            }
        }
Example #5
0
 public override void GetFieldValuesToStringForCompare()
 {
     FieldValueBeforeToStringForCompare = (FieldValueBefore != null && FieldValueBefore.ToString() != "") ? FieldValueBefore.ToString() : "";
     FieldValueAfterToStringForCompare  = (FieldValueAfter != null && FieldValueAfter.ToString() != "") ? FieldValueAfter.ToString() : "";
     FieldValueAfterToStringForCompare  = Regex.Replace(FieldValueAfterToStringForCompare, @"\.", ",");
 }
Example #6
0
 public override void GetFieldValuesToStringForCompare()
 {
     FieldValueBeforeToStringForCompare = (FieldValueBefore != null && FieldValueBefore.ToString() != "") ? FieldValueBefore.ToString() : "";
     FieldValueAfterToStringForCompare  = (FieldValueAfter != null && FieldValueAfter.ToString() != "") ? FieldValueAfter.ToString() : "";
 }
 public override void GetFieldValuesToStringForCompare()
 {
     FieldValueBeforeToStringForCompare = FieldValueBefore?.ToString() ?? "";
     FieldValueAfterToStringForCompare  = FieldValueAfter?.ToString() ?? "";
 }