protected void NewPhysicalInventoryDocumentActionCommandAndExecute(ICreatePhysicalInventory c, IPhysicalInventoryState s, IPhysicalInventoryStateCreated e) { var pCommandHandler = this.PhysicalInventoryDocumentActionCommandHandler; var pCmdContent = default(string); var pCmd = new PropertyCommand <string, string> { Content = pCmdContent, GetState = () => s.DocumentStatusId, SetState = p => e.DocumentStatusId = p, OuterCommandType = CommandType.Create }; pCmd.Context = this.State; pCommandHandler.Execute(pCmd); }
protected virtual IPhysicalInventoryStateCreated Map(ICreatePhysicalInventory c) { var stateEventId = new PhysicalInventoryEventId(c.DocumentNumber, c.Version); IPhysicalInventoryStateCreated e = NewPhysicalInventoryStateCreated(stateEventId); NewPhysicalInventoryDocumentActionCommandAndExecute(c, _state, e); e.WarehouseId = c.WarehouseId; e.LocatorIdPattern = c.LocatorIdPattern; e.ProductIdPattern = c.ProductIdPattern; e.Posted = c.Posted; e.Processed = c.Processed; e.Processing = c.Processing; e.DocumentTypeId = c.DocumentTypeId; e.MovementDate = c.MovementDate; e.Description = c.Description; e.IsApproved = c.IsApproved; e.ApprovalAmount = c.ApprovalAmount; e.IsQuantityUpdated = c.IsQuantityUpdated; e.ReversalDocumentNumber = c.ReversalDocumentNumber; e.Active = c.Active; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var version = c.Version; foreach (ICreatePhysicalInventoryLine innerCommand in c.PhysicalInventoryLines) { ThrowOnInconsistentCommands(c, innerCommand); IPhysicalInventoryLineStateCreated innerEvent = MapCreate(innerCommand, c, version, _state); e.AddPhysicalInventoryLineEvent(innerEvent); } return(e); }
public override void When(ICreatePhysicalInventory c) { //todo base.When(c); }
public virtual void When(ICreatePhysicalInventory c) { Update(c, ar => ar.Create(c)); }
void IPhysicalInventoryApplicationService.When(ICreatePhysicalInventory c) { this.When((CreatePhysicalInventoryDto)c); }
public virtual void Create(ICreatePhysicalInventory c) { IPhysicalInventoryStateCreated e = Map(c); Apply(e); }