示例#1
0
        /// <summary>
        /// Serialize the <see cref="SharedStyle"/>
        /// </summary>
        /// <param name="sharedStyle">The <see cref="SharedStyle"/> to serialize</param>
        /// <returns>The <see cref="JObject"/></returns>
        private JObject Serialize(SharedStyle sharedStyle)
        {
            var jsonObject = new JObject();

            jsonObject.Add("classKind", this.PropertySerializerMap["classKind"](Enum.GetName(typeof(CDP4Common.CommonData.ClassKind), sharedStyle.ClassKind)));
            jsonObject.Add("excludedDomain", this.PropertySerializerMap["excludedDomain"](sharedStyle.ExcludedDomain.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("excludedPerson", this.PropertySerializerMap["excludedPerson"](sharedStyle.ExcludedPerson.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("fillColor", this.PropertySerializerMap["fillColor"](sharedStyle.FillColor));
            jsonObject.Add("fillOpacity", this.PropertySerializerMap["fillOpacity"](sharedStyle.FillOpacity));
            jsonObject.Add("fontBold", this.PropertySerializerMap["fontBold"](sharedStyle.FontBold));
            jsonObject.Add("fontColor", this.PropertySerializerMap["fontColor"](sharedStyle.FontColor));
            jsonObject.Add("fontItalic", this.PropertySerializerMap["fontItalic"](sharedStyle.FontItalic));
            jsonObject.Add("fontName", this.PropertySerializerMap["fontName"](sharedStyle.FontName));
            jsonObject.Add("fontSize", this.PropertySerializerMap["fontSize"](sharedStyle.FontSize));
            jsonObject.Add("fontStrokeThrough", this.PropertySerializerMap["fontStrokeThrough"](sharedStyle.FontStrokeThrough));
            jsonObject.Add("fontUnderline", this.PropertySerializerMap["fontUnderline"](sharedStyle.FontUnderline));
            jsonObject.Add("iid", this.PropertySerializerMap["iid"](sharedStyle.Iid));
            jsonObject.Add("modifiedOn", this.PropertySerializerMap["modifiedOn"](sharedStyle.ModifiedOn));
            jsonObject.Add("name", this.PropertySerializerMap["name"](sharedStyle.Name));
            jsonObject.Add("revisionNumber", this.PropertySerializerMap["revisionNumber"](sharedStyle.RevisionNumber));
            jsonObject.Add("strokeColor", this.PropertySerializerMap["strokeColor"](sharedStyle.StrokeColor));
            jsonObject.Add("strokeOpacity", this.PropertySerializerMap["strokeOpacity"](sharedStyle.StrokeOpacity));
            jsonObject.Add("strokeWidth", this.PropertySerializerMap["strokeWidth"](sharedStyle.StrokeWidth));
            jsonObject.Add("thingPreference", this.PropertySerializerMap["thingPreference"](sharedStyle.ThingPreference));
            jsonObject.Add("usedColor", this.PropertySerializerMap["usedColor"](sharedStyle.UsedColor.OrderBy(x => x, this.guidComparer)));
            return(jsonObject);
        }
示例#2
0
 /// <summary>
 /// Updates the properties of this row
 /// </summary>
 private void UpdateProperties()
 {
     this.ModifiedOn    = this.Thing.ModifiedOn;
     this.DepictedThing = this.Thing.DepictedThing;
     this.SharedStyle   = this.Thing.SharedStyle;
 }
示例#3
0
        /// <summary>
        /// Persist the <see cref="SharedStyle"/> containment tree to the ORM layer. Update if it already exists.
        /// This is typically used during the import of existing data to the Database.
        /// </summary>
        /// <param name="transaction">
        /// The current <see cref="NpgsqlTransaction"/> to the database.
        /// </param>
        /// <param name="partition">
        /// The database partition (schema) where the requested resource will be stored.
        /// </param>
        /// <param name="sharedStyle">
        /// The <see cref="SharedStyle"/> instance to persist.
        /// </param>
        /// <returns>
        /// True if the persistence was successful.
        /// </returns>
        private bool UpsertContainment(NpgsqlTransaction transaction, string partition, SharedStyle sharedStyle)
        {
            var results = new List <bool>();

            foreach (var usedColor in this.ResolveFromRequestCache(sharedStyle.UsedColor))
            {
                results.Add(this.UsedColorService.UpsertConcept(transaction, partition, usedColor, sharedStyle));
            }

            return(results.All(x => x));
        }
 /// <summary>
 /// Add an Shared Diagram Style row view model to the list of <see cref="SharedDiagramStyle"/>
 /// </summary>
 /// <param name="sharedDiagramStyle">
 /// The <see cref="SharedDiagramStyle"/> that is to be added
 /// </param>
 private SharedStyleRowViewModel AddSharedDiagramStyleRowViewModel(SharedStyle sharedDiagramStyle)
 {
     return(new SharedStyleRowViewModel(sharedDiagramStyle, this.Session, this));
 }