Exemple #1
0
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="dbPropValue">The database property value.</param>
        /// <param name="properties">The properties.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">dbPropValue</exception>
        public static coreModel.PropertyValue ToCoreModel(this dataModel.PropertyValueBase dbPropValue, coreModel.Property[] properties)
        {
            if (dbPropValue == null)
            {
                throw new ArgumentNullException("dbPropValue");
            }

            var retVal = new coreModel.PropertyValue();

            retVal.InjectFrom(dbPropValue);
            retVal.LanguageCode = dbPropValue.Locale;
            retVal.PropertyName = dbPropValue.Name;
            retVal.Value        = dbPropValue.ToObjectValue();
            retVal.ValueId      = dbPropValue.KeyValue;
            retVal.ValueType    = (coreModel.PropertyValueType)dbPropValue.ValueType;

            if (properties != null)
            {
                var property = properties.FirstOrDefault(x => String.Equals(x.Name, dbPropValue.Name, StringComparison.InvariantCultureIgnoreCase));
                if (property != null)
                {
                    retVal.PropertyId = property.Id;
                }
            }
            return(retVal);
        }
		public static moduleModel.PropertyValue ToModuleModel(this webModel.PropertyValue propValue)
		{
			var retVal = new moduleModel.PropertyValue();
			retVal.InjectFrom(propValue);
            retVal.Value = propValue.Value;
			retVal.ValueType = (moduleModel.PropertyValueType)(int)propValue.ValueType;
			return retVal;
		}
 public static moduleModel.PropertyValue ToCoreModel(this webModel.PropertyValue propValue)
 {
     var retVal = new moduleModel.PropertyValue();
     retVal.InjectFrom(propValue);
     retVal.Value = propValue.Value;
     retVal.ValueType = (moduleModel.PropertyValueType)(int)propValue.ValueType;
     return retVal;
 }
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="dbPropValue">The database property value.</param>
        /// <param name="properties">The properties.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">dbPropValue</exception>
        public static coreModel.PropertyValue ToCoreModel(this dataModel.PropertyValue dbPropValue)
        {
            if (dbPropValue == null)
                throw new ArgumentNullException("dbPropValue");

            var retVal = new coreModel.PropertyValue();
            retVal.InjectFrom(dbPropValue);
            retVal.LanguageCode = dbPropValue.Locale;
            retVal.PropertyName = dbPropValue.Name;
            retVal.Value = GetPropertyValue(dbPropValue);
            retVal.ValueId = dbPropValue.KeyValue;
            retVal.ValueType = (coreModel.PropertyValueType)dbPropValue.ValueType;
            return retVal;
        }
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="dbPropValue">The database property value.</param>
        /// <param name="properties">The properties.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">dbPropValue</exception>
        public static coreModel.PropertyValue ToCoreModel(this dataModel.PropertyValue dbPropValue)
        {
            if (dbPropValue == null)
            {
                throw new ArgumentNullException("dbPropValue");
            }

            var retVal = new coreModel.PropertyValue();

            retVal.InjectFrom(dbPropValue);
            retVal.LanguageCode = dbPropValue.Locale;
            retVal.PropertyName = dbPropValue.Name;
            retVal.Value        = GetPropertyValue(dbPropValue);
            retVal.ValueId      = dbPropValue.KeyValue;
            retVal.ValueType    = (coreModel.PropertyValueType)dbPropValue.ValueType;
            return(retVal);
        }