Пример #1
0
        private void ConstructProperty(ObjectBuilderBase objectBuilder, Object @object, Member member, DataType dataType)
        {
            Property property = this.propertyRepository.WithObjectIdAndMemberId(@object.Id, member.Id);

            if (dataType.StorageDataType == StorageDataType.Integer)
            {
                objectBuilder.BuildIntegerProperty(member.Code, property.IntegerValue);
            }

            else if (dataType.StorageDataType == StorageDataType.Decimal)
            {
                objectBuilder.BuildDecimalProperty(member.Code, property.DecimalValue);
            }

            if (dataType.StorageDataType == StorageDataType.String)
            {
                if (member.IsPropertyLocalizable == true)
                {
                    objectBuilder.BuildStringProperty(member.Code, this.GetLocalizationValuesByCultureCodes(property));
                }

                else
                {
                    objectBuilder.BuildStringProperty(member.Code, this.GetLocalizationValue(property));
                }
            }

            if (dataType.StorageDataType == StorageDataType.DateTime)
            {
                objectBuilder.BuildDateTimeProperty(member.Code, property.DateTimeValue);
            }
        }
Пример #2
0
        public void ConstructObject(ObjectBuilderBase objectBuilder, SerializedObject serializedObject)
        {
            foreach (SerializedProperty serializedProperty in JsonConvert.DeserializeObject <IEnumerable <SerializedProperty> >(serializedObject.SerializedProperties))
            {
                if (serializedProperty.Member.PropertyDataTypeStorageDataType == StorageDataType.Integer)
                {
                    objectBuilder.BuildIntegerProperty(serializedProperty.Member.Code, serializedProperty.IntegerValue);
                }

                else if (serializedProperty.Member.PropertyDataTypeStorageDataType == StorageDataType.Decimal)
                {
                    objectBuilder.BuildDecimalProperty(serializedProperty.Member.Code, serializedProperty.DecimalValue);
                }

                if (serializedProperty.Member.PropertyDataTypeStorageDataType == StorageDataType.String)
                {
                    Member   member   = this.memberRepository.WithClassIdAndCode(serializedObject.ClassId, serializedProperty.Member.Code);
                    Property property = this.propertyRepository.WithObjectIdAndMemberId(serializedObject.ObjectId, member.Id);

                    objectBuilder.BuildStringProperty(serializedProperty.Member.Code, this.GetLocalizationValuesByCultureCodes(property));
                }

                if (serializedProperty.Member.PropertyDataTypeStorageDataType == StorageDataType.DateTime)
                {
                    objectBuilder.BuildDateTimeProperty(serializedProperty.Member.Code, serializedProperty.DateTimeValue);
                }
            }
        }