Esempio n. 1
0
        private static void SetPropertyValue(dataModel.DynamicContentItemProperty retVal, coreModel.Property property)
        {
            switch (property.ValueType)
            {
            case coreModel.PropertyValueType.Boolean:
                retVal.BooleanValue = Convert.ToBoolean(property.Value);
                break;

            case coreModel.PropertyValueType.DateTime:
                retVal.DateTimeValue = Convert.ToDateTime(property.Value);
                break;

            case coreModel.PropertyValueType.Decimal:
                retVal.DecimalValue = Convert.ToDecimal(property.Value);
                break;

            case coreModel.PropertyValueType.Integer:
                retVal.IntegerValue = Convert.ToInt32(property.Value);
                break;

            case coreModel.PropertyValueType.LongText:
                retVal.LongTextValue = Convert.ToString(property.Value);
                break;

            case coreModel.PropertyValueType.ShortText:
                retVal.ShortTextValue = Convert.ToString(property.Value);
                break;
            }
        }
Esempio n. 2
0
        private static object GetPropertyValue(dataModel.DynamicContentItemProperty propValue)
        {
            object retVal = null;

            switch ((coreModel.PropertyValueType)propValue.ValueType)
            {
            case coreModel.PropertyValueType.Boolean:
                retVal = propValue.BooleanValue;
                break;

            case coreModel.PropertyValueType.DateTime:
                retVal = propValue.DateTimeValue;
                break;

            case coreModel.PropertyValueType.Decimal:
                retVal = propValue.DecimalValue;
                break;

            case coreModel.PropertyValueType.Integer:
                retVal = propValue.IntegerValue;
                break;

            case coreModel.PropertyValueType.LongText:
                retVal = propValue.LongTextValue;
                break;

            case coreModel.PropertyValueType.ShortText:
                retVal = propValue.ShortTextValue;
                break;
            }
            return(retVal);
        }
Esempio n. 3
0
        /// <summary>
        /// Patch
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.DynamicContentItemProperty source, dataModel.DynamicContentItemProperty target)
        {
            var patchInjectionPolicy = new PatchInjection <dataModel.DynamicContentItemProperty>(x => x.BooleanValue, x => x.DateTimeValue,
                                                                                                 x => x.DecimalValue, x => x.IntegerValue,
                                                                                                 x => x.ShortTextValue, x => x.LongTextValue, x => x.ValueType);

            target.InjectFrom(patchInjectionPolicy, source);
        }
		public static dataModel.DynamicContentItemProperty ToDataModel(this coreModel.Property property)
		{
			if (property == null)
				throw new ArgumentNullException("property");

			var retVal = new dataModel.DynamicContentItemProperty();
			retVal.InjectFrom(property);
			retVal.ValueType = (int)property.ValueType;
			SetPropertyValue(retVal, property);
			return retVal;
		}
Esempio n. 5
0
        public static dataModel.DynamicContentItemProperty ToDataModel(this coreModel.Property property)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            var retVal = new dataModel.DynamicContentItemProperty();

            retVal.InjectFrom(property);
            retVal.ValueType = (int)property.ValueType;
            SetPropertyValue(retVal, property);
            return(retVal);
        }
Esempio n. 6
0
        public static coreModel.Property ToCoreModel(this dataModel.DynamicContentItemProperty entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            var retVal = new coreModel.Property();

            retVal.InjectFrom(entity);
            retVal.ValueType = (coreModel.PropertyValueType)entity.ValueType;
            retVal.Value     = GetPropertyValue(entity);

            return(retVal);
        }