Exemplo n.º 1
0
        protected virtual IShipmentPackageStateCreated Map(ICreateShipmentPackage c)
        {
            var stateEventId = new ShipmentPackageEventId(c.ShipmentPackageId, c.Version);
            IShipmentPackageStateCreated e = NewShipmentPackageStateCreated(stateEventId);

            e.ShipmentBoxTypeId = c.ShipmentBoxTypeId;
            e.DateCreated       = c.DateCreated;
            e.BoxLength         = c.BoxLength;
            e.BoxHeight         = c.BoxHeight;
            e.BoxWidth          = c.BoxWidth;
            e.DimensionUomId    = c.DimensionUomId;
            e.Weight            = c.Weight;
            e.WeightUomId       = c.WeightUomId;
            e.InsuredValue      = c.InsuredValue;
            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 (ICreateShipmentPackageContent innerCommand in c.ShipmentPackageContents)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IShipmentPackageContentStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddShipmentPackageContentEvent(innerEvent);
            }


            return(e);
        }
Exemplo n.º 2
0
 void IShipmentPackageApplicationService.When(ICreateShipmentPackage c)
 {
     this.When((CreateShipmentPackageDto)c);
 }
Exemplo n.º 3
0
 public virtual void When(ICreateShipmentPackage c)
 {
     Update(c, ar => ar.Create(c));
 }
Exemplo n.º 4
0
        public virtual void Create(ICreateShipmentPackage c)
        {
            IShipmentPackageStateCreated e = Map(c);

            Apply(e);
        }