private static async Task <bool> OrganisePersonNameRepository() { await DataStore.CN.MajorStatusAdd("Organising Person Name data").ConfigureAwait(false); foreach (PersonNameModel thePersonNameModel in DV.PersonNameDV.DataViewData) { HLinkPersonNameModel t = thePersonNameModel.HLink; //if (theEventModel.Id == "E0059") //{ //} // Citation Collection foreach (HLinkCitationModel citationRef in thePersonNameModel.GCitationRefCollection) { DataStore.DS.CitationData[citationRef.HLinkKey].BackHLinkReferenceCollection.Add(new HLinkBackLink(t)); } // Note Collection foreach (HLinkNoteModel noteRef in thePersonNameModel.GNoteReferenceCollection) { DataStore.DS.NoteData[noteRef.HLinkKey].BackHLinkReferenceCollection.Add(new HLinkBackLink(t)); } } return(true); }
/// <summary> /// Populates the view ViewModel. /// /// XML 1.71 all done /// </summary> /// <returns> /// </returns> public override void HandleViewDataLoadEvent() { BaseCL.RoutineEntry("NameDetailViewModel"); HLinkPersonNameModel HLinkObject = CommonRoutines.GetHLinkParameter <HLinkPersonNameModel>((BaseParamsHLink)); PersonNameObject = HLinkObject.DeRef; if (PersonNameObject.Valid) { BaseModelBase = PersonNameObject; // Get Header Details CardListLineCollection headerCardGroup = new CardListLineCollection { Title = "Person Name Details" }; headerCardGroup.Add(new CardListLine("Full Name:", PersonNameObject.FullName)); BaseDetail.Add(headerCardGroup); // TODO Show All Surnames CardListLineCollection PersonNameCards = new CardListLineCollection("Name") { new CardListLine("Type:", PersonNameObject.GType), new CardListLine("Full Name:", PersonNameObject.FullName), new CardListLine("Title:", PersonNameObject.GTitle), new CardListLine("FirstName:", PersonNameObject.GFirstName), new CardListLine("Primary SurName:", PersonNameObject.GSurName.GetPrimarySurname), new CardListLine("Suffix:", PersonNameObject.GSuffix), new CardListLine("Alternative:", PersonNameObject.GAlt.ToString()), new CardListLine("Call:", PersonNameObject.GCall), new CardListLine("Display:", PersonNameObject.GDisplay), new CardListLine("Family Nick:", PersonNameObject.GFamilyNick), new CardListLine("Group:", PersonNameObject.GGroup), new CardListLine("Nick:", PersonNameObject.GNick), new CardListLine("Priv:", PersonNameObject.Priv, true), new CardListLine("Sort:", PersonNameObject.GSort) }; BaseDetail.Add(PersonNameCards); // Get date card BaseDetail.Add(PersonNameObject.GDate.AsHLink("Name Date")); foreach (HLinkSurnameModel item in PersonNameObject.GSurName) { CardListLineCollection SurnameCard = new CardListLineCollection("Surnames") { new CardListLine("Surname:", item.ToString()), new CardListLine("Prefix:", item.DeRef.GPrefix), new CardListLine("Primary:", item.DeRef.GPrim), new CardListLine("Derivation:", item.DeRef.GDerivation), new CardListLine("Connector:", item.DeRef.GConnector), }; BaseDetail.Add(SurnameCard); } } return; }
private HLinkPersonNameModelCollection GetPersonNameCollection(XElement xmlData) { HLinkPersonNameModelCollection t = new HLinkPersonNameModelCollection(); 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 { Handle = "PersonNameCollection", 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"), GPriv = SetPrivateObject(GetAttribute(theLoadORElement.Attribute("priv"))), 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.SetAlt(GetAttribute(theLoadORElement, "alt")); // Set model hlinkkey newPersonNameModel.HLinkKey = Guid.NewGuid().ToString(); DataStore.DS.PersonNameData.Add(newPersonNameModel); // 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 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); }