/// <summary> /// Serialize the <see cref="OwnedStyle"/> /// </summary> /// <param name="ownedStyle">The <see cref="OwnedStyle"/> to serialize</param> /// <returns>The <see cref="JObject"/></returns> private JObject Serialize(OwnedStyle ownedStyle) { var jsonObject = new JObject(); jsonObject.Add("classKind", this.PropertySerializerMap["classKind"](Enum.GetName(typeof(CDP4Common.CommonData.ClassKind), ownedStyle.ClassKind))); jsonObject.Add("excludedDomain", this.PropertySerializerMap["excludedDomain"](ownedStyle.ExcludedDomain.OrderBy(x => x, this.guidComparer))); jsonObject.Add("excludedPerson", this.PropertySerializerMap["excludedPerson"](ownedStyle.ExcludedPerson.OrderBy(x => x, this.guidComparer))); jsonObject.Add("fillColor", this.PropertySerializerMap["fillColor"](ownedStyle.FillColor)); jsonObject.Add("fillOpacity", this.PropertySerializerMap["fillOpacity"](ownedStyle.FillOpacity)); jsonObject.Add("fontBold", this.PropertySerializerMap["fontBold"](ownedStyle.FontBold)); jsonObject.Add("fontColor", this.PropertySerializerMap["fontColor"](ownedStyle.FontColor)); jsonObject.Add("fontItalic", this.PropertySerializerMap["fontItalic"](ownedStyle.FontItalic)); jsonObject.Add("fontName", this.PropertySerializerMap["fontName"](ownedStyle.FontName)); jsonObject.Add("fontSize", this.PropertySerializerMap["fontSize"](ownedStyle.FontSize)); jsonObject.Add("fontStrokeThrough", this.PropertySerializerMap["fontStrokeThrough"](ownedStyle.FontStrokeThrough)); jsonObject.Add("fontUnderline", this.PropertySerializerMap["fontUnderline"](ownedStyle.FontUnderline)); jsonObject.Add("iid", this.PropertySerializerMap["iid"](ownedStyle.Iid)); jsonObject.Add("modifiedOn", this.PropertySerializerMap["modifiedOn"](ownedStyle.ModifiedOn)); jsonObject.Add("name", this.PropertySerializerMap["name"](ownedStyle.Name)); jsonObject.Add("revisionNumber", this.PropertySerializerMap["revisionNumber"](ownedStyle.RevisionNumber)); jsonObject.Add("strokeColor", this.PropertySerializerMap["strokeColor"](ownedStyle.StrokeColor)); jsonObject.Add("strokeOpacity", this.PropertySerializerMap["strokeOpacity"](ownedStyle.StrokeOpacity)); jsonObject.Add("strokeWidth", this.PropertySerializerMap["strokeWidth"](ownedStyle.StrokeWidth)); jsonObject.Add("thingPreference", this.PropertySerializerMap["thingPreference"](ownedStyle.ThingPreference)); jsonObject.Add("usedColor", this.PropertySerializerMap["usedColor"](ownedStyle.UsedColor.OrderBy(x => x, this.guidComparer))); return(jsonObject); }
/// <summary> /// Persist the <see cref="OwnedStyle"/> 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="ownedStyle"> /// The <see cref="OwnedStyle"/> instance to persist. /// </param> /// <returns> /// True if the persistence was successful. /// </returns> private bool UpsertContainment(NpgsqlTransaction transaction, string partition, OwnedStyle ownedStyle) { var results = new List <bool>(); foreach (var usedColor in this.ResolveFromRequestCache(ownedStyle.UsedColor)) { results.Add(this.UsedColorService.UpsertConcept(transaction, partition, usedColor, ownedStyle)); } return(results.All(x => x)); }
/// <summary> /// Add an Local Style row view model to the list of <see cref="LocalStyle"/> /// </summary> /// <param name="localStyle"> /// The <see cref="LocalStyle"/> that is to be added /// </param> private OwnedStyleRowViewModel AddLocalStyleRowViewModel(OwnedStyle localStyle) { return(new OwnedStyleRowViewModel(localStyle, this.Session, this)); }