public PartyViewModel(EntityWithETag <Party> ewe, IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            this.party           = ewe.Object;

            this.Id   = this.party.MdmId();
            this.ETag = ewe.ETag;

            if (this.party.MdmSystemData != null && this.party.MdmSystemData.StartDate != null)
            {
                this.Start = this.party.MdmSystemData.StartDate.Value;
            }

            if (this.party.MdmSystemData != null && this.party.MdmSystemData.EndDate != null)
            {
                this.End = this.party.MdmSystemData.EndDate.Value;
            }

            this.Name = this.party.Details.Name;

            this.FaxNumber = this.party.Details.FaxNumber;

            this.TelephoneNumber = this.party.Details.TelephoneNumber;

            this.Role = this.party.Details.Role;

            this.IsInternal = this.party.Details.IsInternal;
        }
        public LocationViewModel(EntityWithETag <Location> ewe, IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            this.location        = ewe.Object;

            this.Id   = this.location.MdmId();
            this.ETag = ewe.ETag;

            if (this.location.MdmSystemData != null && this.location.MdmSystemData.StartDate != null)
            {
                this.Start = this.location.MdmSystemData.StartDate.Value;
            }

            if (this.location.MdmSystemData != null && this.location.MdmSystemData.EndDate != null)
            {
                this.End = this.location.MdmSystemData.EndDate.Value;
            }

            this.Type = this.location.Details.Type;

            this.Name = this.location.Details.Name;

            this.ParentId = this.location.Details.Parent.MdmId();

            this.ParentName = this.location.Details.Parent != null ? this.location.Details.Parent.Name : null;
        }
Esempio n. 3
0
        public PartyRoleViewModel(EntityWithETag <PartyRole> ewe, IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            this.partyrole       = ewe.Object;

            this.Id   = this.partyrole.MdmId();
            this.ETag = ewe.ETag;

            if (this.partyrole.MdmSystemData != null && this.partyrole.MdmSystemData.StartDate != null)
            {
                this.Start = this.partyrole.MdmSystemData.StartDate.Value;
            }

            if (this.partyrole.MdmSystemData != null && this.partyrole.MdmSystemData.EndDate != null)
            {
                this.End = this.partyrole.MdmSystemData.EndDate.Value;
            }

            this.Name = this.partyrole.Details.Name;

            this.PartyRoleType = this.partyrole.PartyRoleType;

            this.PartyId = this.partyrole.Party.MdmId();

            this.PartyName = this.partyrole.Party != null ? this.partyrole.Party.Name : null;
        }
        public ExchangeViewModel(EntityWithETag <Exchange> ewe, IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            this.exchange        = ewe.Object;

            this.Id   = this.exchange.MdmId();
            this.ETag = ewe.ETag;

            if (this.exchange.MdmSystemData != null && this.exchange.MdmSystemData.StartDate != null)
            {
                this.Start = this.exchange.MdmSystemData.StartDate.Value;
            }

            if (this.exchange.MdmSystemData != null && this.exchange.MdmSystemData.EndDate != null)
            {
                this.End = this.exchange.MdmSystemData.EndDate.Value;
            }

            this.Name = this.exchange.Details.Name;

            this.Phone = this.exchange.Details.Phone;

            this.Fax = this.exchange.Details.Fax;

            this.PartyId = this.exchange.Party.MdmId();

            this.PartyName = this.exchange.Party != null ? this.exchange.Party.Name : null;
        }
        private void LoadMappingFromService(int pid, int mappingId, string entityName)
        {
            EntityWithETag <MdmId> mappingFromService = this.mappingService.GetMapping(entityName, pid, mappingId);

            this.Mapping = new MappingViewModel(mappingFromService, this.eventAggregator);
            this.RaisePropertyChanged(string.Empty);
        }
Esempio n. 6
0
        public PersonViewModel(EntityWithETag <Person> ewe, IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            this.person          = ewe.Object;

            this.Id   = this.person.MdmId();
            this.ETag = ewe.ETag;

            if (this.person.MdmSystemData != null && this.person.MdmSystemData.StartDate != null)
            {
                this.Start = this.person.MdmSystemData.StartDate.Value;
            }

            if (this.person.MdmSystemData != null && this.person.MdmSystemData.EndDate != null)
            {
                this.End = this.person.MdmSystemData.EndDate.Value;
            }

            this.Forename = this.person.Details.Forename;

            this.Surname = this.person.Details.Surname;

            this.FaxNumber = this.person.Details.FaxNumber;

            this.TelephoneNumber = this.person.Details.TelephoneNumber;

            this.Role = this.person.Details.Role;

            this.Email = this.person.Details.Email;
        }
 public WebResponse<MdmId> UpdateMapping(
     string entityName, 
     int mappingId, 
     int entityId, 
     EntityWithETag<MdmId> mapping)
 {
     return this.requester.Update(
         string.Format(this.mappingEntityUri, entityName, entityId, mappingId),
         mapping.ETag,
         mapping.Object);
 }
        private bool TryUpdateMapping(string entityName, EntityWithETag <MdmId> entityWithETag, MappingUpdatedEvent updatedEvent)
        {
            var response = mappingService.UpdateMapping(entityName, updatedEvent.MappingId, updatedEvent.EntityId, entityWithETag);

            if (!response.IsValid)
            {
                this.eventAggregator.Publish(
                    new ErrorEvent(response.Fault != null ? response.Fault.Message : "Unknown Error"));
                return(false);
            }
            return(true);
        }
 private static MdmId NewMapping(EntityWithETag <MdmId> entityWithETag, MappingUpdatedEvent updatedEvent)
 {
     return(new MdmId
     {
         DefaultReverseInd = updatedEvent.IsDefault,
         IsMdmId = false,
         SourceSystemOriginated = updatedEvent.IsSourceSystemOriginated,
         StartDate = updatedEvent.StartDate,
         Identifier = updatedEvent.NewValue,
         EndDate = entityWithETag.Object.EndDate,
         SystemName = entityWithETag.Object.SystemName,
     });
 }
        private bool TryGetMapping(
            string entityName,
            MappingUpdatedEvent updatedEvent,
            out EntityWithETag <MdmId> mapping)
        {
            mapping = mappingService.GetMapping(entityName, updatedEvent.EntityId, updatedEvent.MappingId);
            if (mapping.Object == null)
            {
                this.eventAggregator.Publish(new ErrorEvent("Unable to retrieve original mapping"));
                return(false);
            }

            return(true);
        }
        public LegalEntityViewModel(EntityWithETag <LegalEntity> ewe, IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            this.legalentity     = ewe.Object;

            this.Id   = this.legalentity.MdmId();
            this.ETag = ewe.ETag;

            if (this.legalentity.MdmSystemData != null && this.legalentity.MdmSystemData.StartDate != null)
            {
                this.Start = this.legalentity.MdmSystemData.StartDate.Value;
            }

            if (this.legalentity.MdmSystemData != null && this.legalentity.MdmSystemData.EndDate != null)
            {
                this.End = this.legalentity.MdmSystemData.EndDate.Value;
            }

            this.Name = this.legalentity.Details.Name;

            this.RegisteredName = this.legalentity.Details.RegisteredName;

            this.RegistrationNumber = this.legalentity.Details.RegistrationNumber;

            this.Address = this.legalentity.Details.Address;

            this.Website = this.legalentity.Details.Website;

            this.Email = this.legalentity.Details.Email;

            this.Fax = this.legalentity.Details.Fax;

            this.Phone = this.legalentity.Details.Phone;

            this.CountryOfIncorporation = this.legalentity.Details.CountryOfIncorporation;

            this.PartyStatus = this.legalentity.Details.PartyStatus;

            this.PartyId = this.legalentity.Party.MdmId();

            this.PartyName = this.legalentity.Party != null ? this.legalentity.Party.Name : null;

            this.InvoiceSetup = this.legalentity.Details.InvoiceSetup;

            this.CustomerAddress = this.legalentity.Details.CustomerAddress;

            this.VendorAddress = this.legalentity.Details.VendorAddress;
        }
Esempio n. 12
0
        protected override void Establish_context()
        {
            this.mockEventAggregator = new Mock <IEventAggregatorExtensionsProvider>();
            this.eventAggregator     = new EventAggregator();

            EventAggregatorExtensions.SetProvider(this.mockEventAggregator.Object);

            this.AddConcrete <IEventAggregator, EventAggregator>(this.eventAggregator);
            base.Establish_context();
            Uri uri = new MappingEditUri(1, "Party", 1);

            this.Mock <IMappingService>()
            .Setup(service => service.GetMapping("Party", 1, 1))
            .Returns(this.Mapping = new EntityWithETag <MdmId>(ObjectMother.CreateMapping(1), "1"));
            this.Sut.OnNavigatedTo(new NavigationContext(null, uri));
        }
        public MappingViewModel(EntityWithETag <MdmId> ewe, IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            this.nexusId         = ewe.Object;

            // TODO: probably need to change this to not be nullable
            if (this.nexusId.DefaultReverseInd == null)
            {
                this.nexusId.DefaultReverseInd = false;
            }

            this.ETag = ewe.ETag;
            this.DefaultReverseInd      = this.nexusId.DefaultReverseInd.Value;
            this.IsMdmId                = this.nexusId.IsMdmId;
            this.EndDate                = this.nexusId.EndDate.Value;
            this.StartDate              = this.nexusId.StartDate.Value;
            this.MappingId              = (int?)this.nexusId.MappingId;
            this.SourceSystemOriginated = this.nexusId.SourceSystemOriginated;
            this.SystemName             = this.nexusId.SystemName;
            this.MappingString          = this.nexusId.Identifier;
        }
Esempio n. 14
0
        public PartyAccountabilityViewModel(EntityWithETag <PartyAccountability> ewe, IEventAggregator eventAggregator)
        {
            this.eventAggregator     = eventAggregator;
            this.partyaccountability = ewe.Object;

            this.Id   = this.partyaccountability.MdmId();
            this.ETag = ewe.ETag;

            if (this.partyaccountability.MdmSystemData != null && this.partyaccountability.MdmSystemData.StartDate != null)
            {
                this.Start = this.partyaccountability.MdmSystemData.StartDate.Value;
            }

            if (this.partyaccountability.MdmSystemData != null && this.partyaccountability.MdmSystemData.EndDate != null)
            {
                this.End = this.partyaccountability.MdmSystemData.EndDate.Value;
            }

            this.Name = this.partyaccountability.Details.Name;

            this.SourcePartyId = this.partyaccountability.Details.SourceParty.MdmId();

            this.SourcePartyName = this.partyaccountability.Details.SourceParty != null ? this.partyaccountability.Details.SourceParty.Name : null;

            this.TargetPartyId = this.partyaccountability.Details.TargetParty.MdmId();

            this.TargetPartyName = this.partyaccountability.Details.TargetParty != null ? this.partyaccountability.Details.TargetParty.Name : null;

            this.SourcePersonId = this.partyaccountability.Details.SourcePerson.MdmId();

            this.SourcePersonName = this.partyaccountability.Details.SourcePerson != null ? this.partyaccountability.Details.SourcePerson.Name : null;

            this.TargetPersonId = this.partyaccountability.Details.TargetPerson.MdmId();

            this.TargetPersonName = this.partyaccountability.Details.TargetPerson != null ? this.partyaccountability.Details.TargetPerson.Name : null;

            this.PartyAccountabilityType = this.partyaccountability.Details.PartyAccountabilityType;
        }
        public SourceSystemViewModel(EntityWithETag <SourceSystem> ewe, IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            this.sourcesystem    = ewe.Object;

            this.Id   = this.sourcesystem.MdmId();
            this.ETag = ewe.ETag;

            if (this.sourcesystem.MdmSystemData != null && this.sourcesystem.MdmSystemData.StartDate != null)
            {
                this.Start = this.sourcesystem.MdmSystemData.StartDate.Value;
            }

            if (this.sourcesystem.MdmSystemData != null && this.sourcesystem.MdmSystemData.EndDate != null)
            {
                this.End = this.sourcesystem.MdmSystemData.EndDate.Value;
            }

            this.Name = this.sourcesystem.Details.Name;

            this.ParentId = this.sourcesystem.Details.Parent.MdmId();

            this.ParentName = this.sourcesystem.Details.Parent != null ? this.sourcesystem.Details.Parent.Name : null;
        }
 private void MapExistingMappings(EntityWithETag<MdmId> ewe)
 {
     this.nexusId = ewe.Object;
     this.IsDefault = this.nexusId.DefaultReverseInd.Value;
     this.IsSourceSystemOriginated = this.nexusId.SourceSystemOriginated;
 }
        private void LoadMappingFromService(int pid, int mappingId, string entityName)
        {
            EntityWithETag <MdmId> mappingFromService = this.mappingService.GetMapping(entityName, pid, mappingId);

            this.MapExistingMappings(mappingFromService);
        }
        private bool TryUpdateMapping(
            string entityName, 
            EntityWithETag<MdmId> entityWithETag, 
            MappingUpdatedEvent updatedEvent)
        {
            var response = mappingService.UpdateMapping(
                entityName,
                updatedEvent.MappingId,
                updatedEvent.EntityId,
                entityWithETag);
            if (!response.IsValid)
            {
                this.eventAggregator.Publish(
                    new ErrorEvent(response.Fault != null ? response.Fault.Message : "Unknown Error"));
                return false;
            }

            return true;
        }
        private bool TryGetMapping(
            string entityName, 
            MappingUpdatedEvent updatedEvent, 
            out EntityWithETag<MdmId> mapping)
        {
            mapping = mappingService.GetMapping(entityName, updatedEvent.EntityId, updatedEvent.MappingId);
            if (mapping.Object == null)
            {
                this.eventAggregator.Publish(new ErrorEvent("Unable to retrieve original mapping"));
                return false;
            }

            return true;
        }
 private static MdmId NewMapping(EntityWithETag<MdmId> entityWithETag, MappingUpdatedEvent updatedEvent)
 {
     return new MdmId
                {
                    DefaultReverseInd = updatedEvent.IsDefault,
                    IsMdmId = false,
                    SourceSystemOriginated = updatedEvent.IsSourceSystemOriginated,
                    StartDate = updatedEvent.StartDate,
                    Identifier = updatedEvent.NewValue,
                    EndDate = entityWithETag.Object.EndDate,
                    SystemName = entityWithETag.Object.SystemName,
                };
 }
 private void MapExistingMappings(EntityWithETag <MdmId> ewe)
 {
     this.nexusId   = ewe.Object;
     this.IsDefault = this.nexusId.DefaultReverseInd.Value;
     this.IsSourceSystemOriginated = this.nexusId.SourceSystemOriginated;
 }