public void AddOperatingContext(OperatingContext operatingContext) => Apply(new Events.AssociateAddNewOperatingContext { OperatingContextType = operatingContext.OperatingContextType.OperatingContextTypeId, FacilityId = operatingContext.FacilityId, ThirdPartySupplierId = operatingContext.ThirdPartySupplierId, LegacyId = operatingContext.LegacyId, ActingBATypeId = operatingContext.ExternalBAType.ActingAssociateTypeId, CertificationId = operatingContext.CertificationId, StatusCodeId = operatingContext.Status.StatusCodeId, IsDeactivating = operatingContext.IsDeactivating, StartDate = operatingContext.StartDate, PrimaryEmailId = operatingContext.PrimaryEmailId, PrimaryPhoneId = operatingContext.PrimaryPhoneId, PrimaryAddressId = operatingContext.PrimaryAddressId } );
//public void AddOperatingContext(AssociateId associateId, OperatingContextType operatingContextType, DatabaseId facilityId, // DatabaseId thirdPartySupplierId, AssociateType externalBATypeId, NullableDatabaseId certificationId, bool isDeactivating, // int legacyId, DatabaseId primaryAddressId, DatabaseId primaryEmailId, DatabaseId primaryPhoneId, DatabaseId providerTypeId, // DateTime startDate, Status status) //{ // OperatingContext operatingContext = new OperatingContext(operatingContextType, facilityId, thirdPartySupplierId, // externalBATypeId, certificationId, isDeactivating, legacyId, primaryAddressId, primaryEmailId, primaryPhoneId, // providerTypeId, startDate, status); // if (AssociateOperatingContexts == null) // { // AssociateOperatingContexts = new List<AssociateOperatingContext>(); // } // if (OperatingContexts == null) // { // OperatingContexts = new List<OperatingContext>(); // } // OperatingContexts.AddAssociate(operatingContext); // Apply(new Events.AssociateAddNewOperatingContext // { // AssociateId = associateId, // OperatingContextType = (int)operatingContextType, // FacilityId = facilityId, // ThirdPartySupplierId = thirdPartySupplierId, // ActingBATypeId = (int)externalBATypeId, // CertificationId = certificationId, // IsDeactivating = isDeactivating, // LegacyId = legacyId, // PrimaryAddressId = primaryAddressId, // PrimaryEmailId = primaryEmailId, // PrimaryPhoneId = primaryPhoneId, // ProviderTypeId = providerTypeId, // StartDate = startDate, // StatusCodeId = (int)status // }); //} protected override void When(object @event) { switch (@event) { case Events.AssociateCreated e: Id = new AssociateId(e.Id); break; case Events.AssociateDUNSNumberUpdated e: DUNSNumber = DUNSNumber.Create(e.DUNSNumber); break; case Events.AssociateIsParentUpdated e: IsParent = e.IsParent; break; case Events.AssociateLongNameUpdated e: LongName = LongName.Create(e.LongName); break; case Events.AssociateShortNameUpdated e: ShortName = ShortName.Create(e.ShortName); break; case Events.AssociateStatusUpdated e: StatusCode = StatusCodeLookup.StatusCodes[e.Status]; break; case Events.AssociateTypeUpdated e: AssociateType = AssociateTypeLookup.AssociateTypes[e.AssociateType]; break; case Events.AssociateAddNewOperatingContext e: OperatingContext operatingContext = new OperatingContext(Apply); ApplyToEntity(operatingContext, e); //OperatingContexts.AddAssociate(operatingContext); break; default: throw new Exception("Unknown event type " + @event); } }