Beispiel #1
0
        public override object ConvertToStorageType(object value)
        {
            var model = value as ModelApplicationBase;
            if (model != null)
            {
                var writer = new ModelXmlWriter();
                var serializableDictionary = new SerializableDictionary<string, string>();
                serializableDictionary["aspects"] = string.Empty;
                for (int i = 0; i < model.AspectCount; ++i)
                {
                    var aspect = model.GetAspect(i);
                    if (string.IsNullOrEmpty(aspect) || aspect == CaptionHelper.DefaultLanguage){
                        serializableDictionary["DefaultAspect"] = writer.WriteToString(model, i);
                    }
                    else{
                        serializableDictionary["aspects"] += aspect + ",";
                        serializableDictionary[aspect] = writer.WriteToString(model, i);
                    }
                }

                serializableDictionary["aspects"] = serializableDictionary["aspects"].TrimEnd(',');

                var stringWriter = new StringWriter();
                serializableDictionary.WriteXml(new XmlTextWriter(stringWriter));
                return stringWriter.GetStringBuilder().ToString();
            }

            return null;
        }
Beispiel #2
0
        public override object ConvertToStorageType(object value)
        {
            var model = value as ModelApplicationBase;

            if (model != null)
            {
                var writer = new ModelXmlWriter();
                var serializableDictionary = new SerializableDictionary <string, string>();
                serializableDictionary["aspects"] = string.Empty;
                for (int i = 0; i < model.AspectCount; ++i)
                {
                    var aspect = model.GetAspect(i);
                    if (string.IsNullOrEmpty(aspect) || aspect == CaptionHelper.DefaultLanguage)
                    {
                        serializableDictionary["DefaultAspect"] = writer.WriteToString(model, i);
                    }
                    else
                    {
                        serializableDictionary["aspects"] += aspect + ",";
                        serializableDictionary[aspect]     = writer.WriteToString(model, i);
                    }
                }

                serializableDictionary["aspects"] = serializableDictionary["aspects"].TrimEnd(',');

                var stringWriter = new StringWriter();
                serializableDictionary.WriteXml(new XmlTextWriter(stringWriter));
                return(stringWriter.GetStringBuilder().ToString());
            }

            return(null);
        }
Beispiel #3
0
        public void CreateAspectsCore(ModelApplicationBase model)
        {
            var modelXmlWriter = new ModelXmlWriter();

            for (int i = 0; i < model.AspectCount; i++)
            {
                var    xml  = modelXmlWriter.WriteToString(model, i);
                string name = GetAspectName(model.GetAspect(i));
                AspectObjects.Filter = CriteriaOperator.Parse("Name=?", name);
                if (AspectObjects.Count == 0)
                {
                    AspectObjects.Add(new AspectObject(Session)
                    {
                        Name = name
                    });
                }

                AspectObjects[0].Xml = xml;
                AspectObjects.Filter = null;
            }
        }
        public void CreateAspectsCore(ModelApplicationBase model) {
            var modelXmlWriter = new ModelXmlWriter();
            for (int i = 0; i < model.AspectCount; i++) {
                var xml = modelXmlWriter.WriteToString(model, i);
                string name = GetAspectName(model.GetAspect(i));
                AspectObjects.Filter = CriteriaOperator.Parse("Name=?", name);
                if (AspectObjects.Count == 0)
                    AspectObjects.Add(new AspectObject(Session) { Name = name });

                AspectObjects[0].Xml = xml;
                AspectObjects.Filter = null;
            }
        }