private static HLinkPlaceNameModelCollection GetPlaceNameModelCollection(XElement xmlData) { HLinkPlaceNameModelCollection t = new HLinkPlaceNameModelCollection { Title = "Place Name Collection" }; // Run query IEnumerable <XElement> theERElement = from orElementEl in xmlData.Elements(ns + "pname") select orElementEl; if (theERElement.Any()) { // Load attribute object references foreach (XElement theLoadORElement in theERElement) { PlaceNameModel newPlaceNameModel = new PlaceNameModel { GValue = GetAttribute(theLoadORElement, "value"), GLang = GetAttribute(theLoadORElement, "lang"), GDate = GetDate(theLoadORElement), }; newPlaceNameModel.ModelItemGlyph.Symbol = Constants.IconPlace; newPlaceNameModel.HLinkKey = HLinkKey.NewAsGUID(); HLinkPlaceNameModel tt = new HLinkPlaceNameModel { DeRef = newPlaceNameModel }; if (string.IsNullOrEmpty(newPlaceNameModel.GValue)) { } t.Add(tt); } } return(t); }
/// <summary> /// Load zero or more url content xml elements into alist of url models. /// </summary> /// <param name="xmlData"> /// the xElement containing the url references. /// </param> private HLinkURLModelCollection GetURLCollection(XElement xmlData) { HLinkURLModelCollection t = new HLinkURLModelCollection(); // Run query IEnumerable <XElement> theERElement = from orElementEl in xmlData.Elements(ns + "url") select orElementEl; if (theERElement.Any()) { foreach (XElement theLoadORElement in theERElement) { URLModel tt = new URLModel { Priv = GetPrivateObject(theLoadORElement), GType = GetAttribute(theLoadORElement.Attribute("type")), GHRef = GetUri(GetAttribute(theLoadORElement.Attribute("href"))), GDescription = GetAttribute(theLoadORElement.Attribute("description")), }; tt.ModelItemGlyph.ImageType = CommonEnums.HLinkGlyphType.Symbol; tt.ModelItemGlyph.Symbol = Constants.IconURL; tt.HLinkKey = HLinkKey.NewAsGUID(); HLinkURLModel ttt = new HLinkURLModel { DeRef = tt }; t.Add(ttt); } } return(t); }
public HLinkBackLink() { HLinkKey = HLinkKey.NewAsGUID(); }
private HLinkPersonNameModelCollection GetPersonNameCollection(XElement xmlData) { HLinkPersonNameModelCollection t = new HLinkPersonNameModelCollection { Title = "Person Name Collection" }; var theERElement = from orElementEl in xmlData.Elements(ns + "name") select orElementEl; if (theERElement.Any()) { // Load attribute object references foreach (XElement theLoadORElement in theERElement) { // TODO is date handling correct PersonNameModel newPersonNameModel = new PersonNameModel { GCitationRefCollection = GetCitationCollection(theLoadORElement), GDate = SetDate(theLoadORElement), GDisplay = GetElement(theLoadORElement, "display"), GFamilyNick = GetElement(theLoadORElement, "familynick"), GFirstName = GetElement(theLoadORElement, "first"), GGroup = GetElement(theLoadORElement, "group"), GNick = GetElement(theLoadORElement, "nick"), Priv = GetPrivateObject(theLoadORElement), GSort = GetElement(theLoadORElement, "sort"), GSuffix = GetElement(theLoadORElement, "suffix"), GSurName = GetSurnameCollection(theLoadORElement), GTitle = GetElement(theLoadORElement, "title"), GType = GetAttribute(theLoadORElement.Attribute("type")), GNoteReferenceCollection = GetNoteCollection(theLoadORElement), }; newPersonNameModel.GAlt = new AltModel(GetAttribute(theLoadORElement, "alt")); newPersonNameModel.HLinkKey = HLinkKey.NewAsGUID(); DataStore.Instance.DS.PersonNameData.Add(newPersonNameModel); //var tt = (DataStore.Instance.DS.PersonNameData.Where(x => x.Value.GSurName.GetPrimarySurname == "Ainger")); //if (tt.Count() > 0) //{ //} // Create a HLink to the model HLinkPersonNameModel newHlink = new HLinkPersonNameModel { HLinkKey = newPersonNameModel.HLinkKey }; t.Add(newHlink); } } // Do not sort as the source file order is the one the creator wanted return(t); }
private HLinkAddressModelCollection GetAddressCollection(XElement xmlData) { HLinkAddressModelCollection t = new HLinkAddressModelCollection { Title = "Address Collection" }; // Run query var theERElement = from orElementEl in xmlData.Elements(ns + "address") select orElementEl; if (theERElement.Any()) { // Load address object references foreach (XElement theLoadORElement in theERElement) { AddressModel newAddressModel = new AddressModel { GCitationRefCollection = GetCitationCollection(theLoadORElement), GCity = GetElement(theLoadORElement, "city"), GCountry = GetElement(theLoadORElement, "country"), GCounty = GetElement(theLoadORElement, "county"), GDate = GetDate(theLoadORElement), GLocality = GetElement(theLoadORElement, "locality"), GPhone = GetElement(theLoadORElement, "phone"), GPostal = GetElement(theLoadORElement, "postal"), GState = GetElement(theLoadORElement, "state"), GStreet = GetElement(theLoadORElement, "street"), Priv = GetPrivateObject(theLoadORElement), GNoteRefCollection = GetNoteCollection(theLoadORElement), }; // Set model hlinkkey etc newAddressModel.HLinkKey = HLinkKey.NewAsGUID(); newAddressModel.Id = newAddressModel.HLinkKey.Value; DataStore.Instance.DS.AddressData.Add(newAddressModel); // Create a HLink to the model HLinkAdressModel newHlink = new HLinkAdressModel { HLinkKey = newAddressModel.HLinkKey, }; t.Add(newHlink); } } return(t); }