public static coreModel.OperationProperty ToCoreModel(this webModel.OperationProperty property)
		{
			var retVal = new coreModel.OperationProperty();
			retVal.InjectFrom(property);

			retVal.ValueType = property.ValueType;
			retVal.Value = property.Value;

			return retVal;
		}
Example #2
0
        public static coreModel.OperationProperty ToCoreModel(this webModel.OperationProperty property)
        {
            var retVal = new coreModel.OperationProperty();

            retVal.InjectFrom(property);

            retVal.ValueType = property.ValueType;
            retVal.Value     = property.Value;

            return(retVal);
        }
Example #3
0
        public static webModel.OperationProperty ToWebModel(this coreModel.OperationProperty property)
        {
            var retVal = new webModel.OperationProperty();

            retVal.InjectFrom(property);

            retVal.ValueType = property.ValueType;
            retVal.Value     = property.Value != null?property.Value.ToString() : null;

            return(retVal);
        }
		/// <summary>
		/// Converting to model type
		/// </summary>
		/// <param name="catalogBase"></param>
		/// <returns></returns>
		public static coreModel.OperationProperty ToCoreModel(this dataModel.OperationPropertyEntity dbEntity)
		{
			if (dbEntity == null)
				throw new ArgumentNullException("dbEntity");

			var retVal = new coreModel.OperationProperty();
			retVal.InjectFrom(dbEntity);
			retVal.ValueType = (coreModel.PropertyValueType)Enum.Parse(typeof(coreModel.PropertyValueType), dbEntity.ValueType, true);
			retVal.Value = dbEntity.RawValue();
			return retVal;

		}
        public static dataModel.OperationPropertyEntity ToDataModel(this coreModel.OperationProperty property)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            var retVal = new dataModel.OperationPropertyEntity();

            retVal.InjectFrom(property);
            retVal.ValueType = property.ValueType.ToString();
            SetPropertyValue(retVal, property);
            return(retVal);
        }
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="catalogBase"></param>
        /// <returns></returns>
        public static coreModel.OperationProperty ToCoreModel(this dataModel.OperationPropertyEntity dbEntity)
        {
            if (dbEntity == null)
            {
                throw new ArgumentNullException("dbEntity");
            }

            var retVal = new coreModel.OperationProperty();

            retVal.InjectFrom(dbEntity);
            retVal.ValueType = (coreModel.PropertyValueType)Enum.Parse(typeof(coreModel.PropertyValueType), dbEntity.ValueType, true);
            retVal.Value     = dbEntity.RawValue();
            return(retVal);
        }
        private static void SetPropertyValue(dataModel.OperationPropertyEntity retVal, coreModel.OperationProperty 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;
            }
        }