Beispiel #1
0
        private static void SetPropertyValue(dataModel.ContactPropertyValue 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;
            }
        }
Beispiel #2
0
        private static object GetPropertyValue(dataModel.ContactPropertyValue 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);
        }
Beispiel #3
0
        /// <summary>
        /// Patch
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.ContactPropertyValue source, dataModel.ContactPropertyValue target)
        {
            var patchInjectionPolicy = new PatchInjection <dataModel.ContactPropertyValue>(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.ContactPropertyValue ToDataModel(this coreModel.Property property)
        {
            if (property == null)
                throw new ArgumentNullException("property");

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

            var retVal = new dataModel.ContactPropertyValue();

            retVal.InjectFrom(property);
            retVal.ValueType = (int)property.ValueType;
            SetPropertyValue(retVal, property);
            return(retVal);
        }
Beispiel #6
0
        public static coreModel.Property ToCoreModel(this dataModel.ContactPropertyValue 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);
        }