protected virtual IPicklistBinStateMergePatched Map(IMergePatchPicklistBin c) { var stateEventId = new PicklistBinEventId(c.PicklistBinId, c.Version); IPicklistBinStateMergePatched e = NewPicklistBinStateMergePatched(stateEventId); e.PicklistId = c.PicklistId; e.BinLocationNumber = c.BinLocationNumber; e.PrimaryOrderId = c.PrimaryOrderId; e.PrimaryShipGroupSeqId = c.PrimaryShipGroupSeqId; e.Active = c.Active; e.IsPropertyPicklistIdRemoved = c.IsPropertyPicklistIdRemoved; e.IsPropertyBinLocationNumberRemoved = c.IsPropertyBinLocationNumberRemoved; e.IsPropertyPrimaryOrderIdRemoved = c.IsPropertyPrimaryOrderIdRemoved; e.IsPropertyPrimaryShipGroupSeqIdRemoved = c.IsPropertyPrimaryShipGroupSeqIdRemoved; e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var version = c.Version; foreach (IPicklistItemCommand innerCommand in c.PicklistItemCommands) { ThrowOnInconsistentCommands(c, innerCommand); IPicklistItemEvent innerEvent = Map(innerCommand, c, version, _state); e.AddPicklistItemEvent(innerEvent); } return(e); }
public virtual PicklistBinStateMergePatchedDto ToPicklistBinStateMergePatchedDto(IPicklistBinStateMergePatched e) { var dto = new PicklistBinStateMergePatchedDto(); dto.PicklistBinEventId = e.PicklistBinEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.PicklistId = e.PicklistId; dto.BinLocationNumber = e.BinLocationNumber; dto.PrimaryOrderId = e.PrimaryOrderId; dto.PrimaryShipGroupSeqId = e.PrimaryShipGroupSeqId; dto.Active = e.Active; dto.IsPropertyPicklistIdRemoved = e.IsPropertyPicklistIdRemoved; dto.IsPropertyBinLocationNumberRemoved = e.IsPropertyBinLocationNumberRemoved; dto.IsPropertyPrimaryOrderIdRemoved = e.IsPropertyPrimaryOrderIdRemoved; dto.IsPropertyPrimaryShipGroupSeqIdRemoved = e.IsPropertyPrimaryShipGroupSeqIdRemoved; dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved; var picklistItemEvents = new List <PicklistItemStateCreatedOrMergePatchedOrRemovedDto>(); foreach (var ee in e.PicklistItemEvents) { PicklistItemStateCreatedOrMergePatchedOrRemovedDto eeDto = PicklistItemStateEventDtoConverter.ToPicklistItemStateEventDto(ee); picklistItemEvents.Add(eeDto); } dto.PicklistItemEvents = picklistItemEvents.ToArray(); return(dto); }
public virtual void MergePatch(IMergePatchPicklistBin c) { IPicklistBinStateMergePatched e = Map(c); Apply(e); }
void IPicklistBinState.When(IPicklistBinStateMergePatched e) { throw new NotSupportedException(); }
public virtual void When(IPicklistBinStateMergePatched e) { ThrowOnWrongEvent(e); if (e.PicklistId == null) { if (e.IsPropertyPicklistIdRemoved) { this.PicklistId = default(string); } } else { this.PicklistId = e.PicklistId; } if (e.BinLocationNumber == null) { if (e.IsPropertyBinLocationNumberRemoved) { this.BinLocationNumber = default(long?); } } else { this.BinLocationNumber = e.BinLocationNumber; } if (e.PrimaryOrderId == null) { if (e.IsPropertyPrimaryOrderIdRemoved) { this.PrimaryOrderId = default(string); } } else { this.PrimaryOrderId = e.PrimaryOrderId; } if (e.PrimaryShipGroupSeqId == null) { if (e.IsPropertyPrimaryShipGroupSeqIdRemoved) { this.PrimaryShipGroupSeqId = default(string); } } else { this.PrimaryShipGroupSeqId = e.PrimaryShipGroupSeqId; } 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 (IPicklistItemEvent innerEvent in e.PicklistItemEvents) { IPicklistItemState innerState = this.PicklistItems.Get(innerEvent.GlobalId.PicklistItemOrderShipGrpInvId); innerState.Mutate(innerEvent); var removed = innerEvent as IPicklistItemStateRemoved; if (removed != null) { this.PicklistItems.Remove(innerState); } } }