/// <summary> /// Populates the view ViewModel by handling the Load Event. /// </summary> /// <returns> /// <br/> /// </returns> public override void HandleViewDataLoadEvent() { BaseCL.RoutineEntry("AddressDetailViewModel"); HLinkAdressModel HLinkObject = CommonRoutines.GetHLinkParameter <HLinkAdressModel>((BaseParamsHLink)); AddressObject = HLinkObject.DeRef; if (AddressObject.Valid) { BaseModelBase = AddressObject; // Get media image MediaCard = AddressObject.ModelItemGlyph.ImageHLinkMediaModel; // Get the Name Details BaseDetail.Add(new CardListLineCollection("Address Detail") { new CardListLine("Street:", AddressObject.GStreet), new CardListLine("City:", AddressObject.GCity), new CardListLine("Locality:", AddressObject.GLocality), new CardListLine("County:", AddressObject.GCounty), new CardListLine("State:", AddressObject.GState), new CardListLine("Country:", AddressObject.GCountry), new CardListLine("Date:", AddressObject.GDate.ShortDate), new CardListLine("Postal:", AddressObject.GPostal), new CardListLine("Phone:", AddressObject.GPhone), }); // Add date card BaseDetail.Add(AddressObject.GDate.AsHLink("Address Date")); // Add Map card BaseDetail.Add(AddressObject.ToMapModel().HLink); // Add Standard details BaseDetail.Add(DV.AddressDV.GetModelInfoFormatted(AddressObject)); } return; }
/// <summary> /// Organises the address repository. /// </summary> private static async Task <bool> OrganiseAddressRepository() { await DataStore.CN.MajorStatusAdd("Organising Address data").ConfigureAwait(false); foreach (AddressModel theAddressModel in DV.AddressDV.DataViewData) { HLinkAdressModel t = theAddressModel.HLink; //if (theEventModel.Id == "E0059") //{ //} // Citation Collection foreach (HLinkCitationModel citationRef in theAddressModel.GCitationRefCollection) { DataStore.DS.CitationData[citationRef.HLinkKey].BackHLinkReferenceCollection.Add(new HLinkBackLink(t)); } // TODO finish adding the collections to the backlinks } return(true); }
private HLinkOCAddressModelCollection GetAddressCollection(XElement xmlData) { HLinkOCAddressModelCollection t = new HLinkOCAddressModelCollection(); // 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 = SetPrivateObject(GetAttribute(theLoadORElement.Attribute("priv"))), GNoteRefCollection = GetNoteCollection(theLoadORElement), }; // Set model hlinkkey etc string newGuid = Guid.NewGuid().ToString(); newAddressModel.HLinkKey = newGuid; newAddressModel.Id = newGuid; newAddressModel.Handle = newGuid; DataStore.DS.AddressData.Add(newAddressModel); // Create a HLink to the model HLinkAdressModel newHlink = new HLinkAdressModel { HLinkKey = newAddressModel.HLinkKey, }; t.Add(newHlink); } // Sort by date t.Sort(x => x.DeRef.GDate); } 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); }