public virtual void When(IPicklistStateCreated e) { ThrowOnWrongEvent(e); this.Description = e.Description; this.FacilityId = e.FacilityId; this.ShipmentMethodTypeId = e.ShipmentMethodTypeId; this.StatusId = e.StatusId; this.PicklistDate = e.PicklistDate; this.PickwaveId = e.PickwaveId; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.Deleted = false; this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; foreach (IPicklistRoleStateCreated innerEvent in e.PicklistRoleEvents) { IPicklistRoleState innerState = this.PicklistRoles.Get(innerEvent.GlobalId.PartyRoleId, true); innerState.Mutate(innerEvent); } }
public virtual void When(IPicklistStateMergePatched e) { ThrowOnWrongEvent(e); if (e.Description == null) { if (e.IsPropertyDescriptionRemoved) { this.Description = default(string); } } else { this.Description = e.Description; } if (e.FacilityId == null) { if (e.IsPropertyFacilityIdRemoved) { this.FacilityId = default(string); } } else { this.FacilityId = e.FacilityId; } if (e.ShipmentMethodTypeId == null) { if (e.IsPropertyShipmentMethodTypeIdRemoved) { this.ShipmentMethodTypeId = default(string); } } else { this.ShipmentMethodTypeId = e.ShipmentMethodTypeId; } if (e.StatusId == null) { if (e.IsPropertyStatusIdRemoved) { this.StatusId = default(string); } } else { this.StatusId = e.StatusId; } if (e.PicklistDate == null) { if (e.IsPropertyPicklistDateRemoved) { this.PicklistDate = default(DateTime?); } } else { this.PicklistDate = e.PicklistDate; } if (e.PickwaveId == null) { if (e.IsPropertyPickwaveIdRemoved) { this.PickwaveId = default(long?); } } else { this.PickwaveId = e.PickwaveId; } if (e.Active == null) { if (e.IsPropertyActiveRemoved) { this.Active = default(bool); } } else { this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); } this.UpdatedBy = e.CreatedBy; this.UpdatedAt = e.CreatedAt; foreach (IPicklistRoleEvent innerEvent in e.PicklistRoleEvents) { IPicklistRoleState innerState = this.PicklistRoles.Get(innerEvent.GlobalId.PartyRoleId); innerState.Mutate(innerEvent); var removed = innerEvent as IPicklistRoleStateRemoved; if (removed != null) { this.PicklistRoles.Remove(innerState); } } }