public ToDateField(BaseDataMap map, Item fieldItem) : base(map, fieldItem) { FromWhatDateTimeFormat = fieldItem.Fields[FieldNameFromWhatDateTimeFormat].Value; if (String.IsNullOrEmpty(FromWhatDateTimeFormat)) { map.LogBuilder.Log("Error", String.Format("The field '{0}' didn't contain any value. A string value must be provided for the DateTime format to parse the given date from. " + "FieldValue: {1}. The fieldItem: {2}.", FieldNameFromWhatDateTimeFormat, FromWhatDateTimeFormat, map.GetItemDebugInfo(fieldItem))); } ToWhatDateTimeFormat = fieldItem.Fields[FieldNameToWhatDateTimeFormat].Value; if (String.IsNullOrEmpty(ToWhatDateTimeFormat)) { map.LogBuilder.Log("Error", String.Format("The field '{0}' didn't contain any value. A string value must be provided for the DateTime format to parse the given date from. " + "FieldValue: {1}. The fieldItem: {2}.", FieldNameToWhatDateTimeFormat, ToWhatDateTimeFormat, map.GetItemDebugInfo(fieldItem))); } }
public ToBooleanField(BaseDataMap map, Item fieldItem) : base(map, fieldItem) { WhatStringToIdentifyTrueBoolValue = fieldItem.Fields[FieldNameWhatStringToIdentifyTrueBoolValue].Value; if (String.IsNullOrEmpty(WhatStringToIdentifyTrueBoolValue)) { map.LogBuilder.Log("Error", string.Format("The field '{0}' didn't contain any value. A string value must be provided to identify the bool value. " + "FieldValue: {1}. The fieldItem: {2}.", FieldNameWhatStringToIdentifyTrueBoolValue, WhatStringToIdentifyTrueBoolValue, map.GetItemDebugInfo(fieldItem))); } WhatStringToIdentifyFalseBoolValue = fieldItem.Fields[FieldNameWhatStringToIdentifyFalseBoolValue].Value; if (String.IsNullOrEmpty(WhatStringToIdentifyFalseBoolValue)) { map.LogBuilder.Log("Error", string.Format("The field '{0}' didn't contain any value. A string value must be provided to identify the bool value. " + "FieldValue: {1}. The fieldItem: {2}.", FieldNameWhatStringToIdentifyFalseBoolValue, WhatStringToIdentifyFalseBoolValue, map.GetItemDebugInfo(fieldItem))); } }
private void InitializeFieldStorageHandlerField(BaseDataMap map, Item fieldItem) { var fieldStorageHandlerId = fieldItem.Fields[FieldNameFieldStorageHandler].Value; if (!String.IsNullOrEmpty(fieldStorageHandlerId)) { if (Data.ID.IsID(fieldStorageHandlerId)) { Item fieldStorageHandlerItem = map.SitecoreDB.GetItem(fieldStorageHandlerId); string errorMessage; var storageHandler = CreateFieldStorageHandler(map, fieldStorageHandlerItem, out errorMessage); if (!String.IsNullOrEmpty(errorMessage)) { map.LogBuilder.Log("Error", string.Format("The field '{0}' had a correct Sitecore ID, but the instantiation of the object failed. See the error log: {1}. " + "FieldValue: {2}. The fieldItem: {3}.", FieldNameFieldStorageHandler, errorMessage, fieldStorageHandlerId, map.GetItemDebugInfo(fieldItem))); } if (storageHandler != null) { FieldStorageHandler = storageHandler; } else { map.LogBuilder.Log("Error", string.Format("The field '{0}' had a correct Sitecore ID, but the object was null." + "FieldValue: {1}. The fieldItem: {2}.", FieldNameFieldStorageHandler, fieldStorageHandlerId, map.GetItemDebugInfo(fieldItem))); } } else { map.LogBuilder.Log("Error", string.Format("The field '{0}' had a value, but it was not a correct Sitecore ID. Please provide a correct Sitecore ID for the field to define which FieldStorageHandler should handle the saving of the field to user in the Sitecore Membership Database. " + "FieldValue: {1}. The fieldItem: {2}.", FieldNameFieldStorageHandler, fieldStorageHandlerId, map.GetItemDebugInfo(fieldItem))); } } else { map.LogBuilder.Log("Error", string.Format("The field '{0}' was null or empty. Please provide a value for the field to define which FieldStorageHandler should handle the saving of the field to user in the Sitecore Membership Database. " + "The fieldItem: {1}.", FieldNameFieldStorageHandler, map.GetItemDebugInfo(fieldItem))); } }