コード例 #1
0
        public static TCreateInOutLineMvo ToCreateInOutLineMvo <TCreateInOutLineMvo>(this IInOutLineMvoState state)
            where TCreateInOutLineMvo : ICreateInOutLineMvo, new()
        {
            var cmd = new TCreateInOutLineMvo();

            cmd.InOutVersion = ((IInOutLineMvoStateProperties)state).InOutVersion;

            cmd.InOutLineId            = state.InOutLineId;
            cmd.LocatorId              = state.LocatorId;
            cmd.ProductId              = state.ProductId;
            cmd.AttributeSetInstanceId = state.AttributeSetInstanceId;
            cmd.Description            = state.Description;
            cmd.QuantityUomId          = state.QuantityUomId;
            cmd.MovementQuantity       = state.MovementQuantity;
            cmd.PickedQuantity         = state.PickedQuantity;
            cmd.IsInvoiced             = state.IsInvoiced;
            cmd.Processed              = state.Processed;
            cmd.RmaLineNumber          = state.RmaLineNumber;
            cmd.ReversalLineNumber     = state.ReversalLineNumber;
            cmd.Version = ((IInOutLineMvoStateProperties)state).Version;
            cmd.Active  = ((IInOutLineMvoStateProperties)state).Active;
            cmd.InOutDocumentStatusId       = state.InOutDocumentStatusId;
            cmd.InOutPosted                 = state.InOutPosted;
            cmd.InOutProcessed              = state.InOutProcessed;
            cmd.InOutProcessing             = state.InOutProcessing;
            cmd.InOutDocumentTypeId         = state.InOutDocumentTypeId;
            cmd.InOutDescription            = state.InOutDescription;
            cmd.InOutOrderId                = state.InOutOrderId;
            cmd.InOutDateOrdered            = state.InOutDateOrdered;
            cmd.InOutIsPrinted              = state.InOutIsPrinted;
            cmd.InOutMovementTypeId         = state.InOutMovementTypeId;
            cmd.InOutMovementDate           = state.InOutMovementDate;
            cmd.InOutBusinessPartnerId      = state.InOutBusinessPartnerId;
            cmd.InOutWarehouseId            = state.InOutWarehouseId;
            cmd.InOutPOReference            = state.InOutPOReference;
            cmd.InOutFreightAmount          = state.InOutFreightAmount;
            cmd.InOutShipperId              = state.InOutShipperId;
            cmd.InOutChargeAmount           = state.InOutChargeAmount;
            cmd.InOutDatePrinted            = state.InOutDatePrinted;
            cmd.InOutCreatedFrom            = state.InOutCreatedFrom;
            cmd.InOutSalesRepresentativeId  = state.InOutSalesRepresentativeId;
            cmd.InOutNumberOfPackages       = state.InOutNumberOfPackages;
            cmd.InOutPickDate               = state.InOutPickDate;
            cmd.InOutShipDate               = state.InOutShipDate;
            cmd.InOutTrackingNumber         = state.InOutTrackingNumber;
            cmd.InOutDateReceived           = state.InOutDateReceived;
            cmd.InOutIsInTransit            = state.InOutIsInTransit;
            cmd.InOutIsApproved             = state.InOutIsApproved;
            cmd.InOutIsInDispute            = state.InOutIsInDispute;
            cmd.InOutRmaDocumentNumber      = state.InOutRmaDocumentNumber;
            cmd.InOutReversalDocumentNumber = state.InOutReversalDocumentNumber;
            cmd.InOutCreatedBy              = state.InOutCreatedBy;
            cmd.InOutCreatedAt              = state.InOutCreatedAt;
            cmd.InOutUpdatedBy              = state.InOutUpdatedBy;
            cmd.InOutUpdatedAt              = state.InOutUpdatedAt;
            cmd.InOutActive                 = state.InOutActive;
            return(cmd);
        }
コード例 #2
0
        public IInOutLineMvoState Get(InOutLineId id)
        {
            IInOutLineMvoState state = CurrentSession.Get <InOutLineMvoState>(id);

            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IInOutLineMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
コード例 #3
0
        public static TDeleteInOutLineMvo ToDeleteInOutLineMvo <TDeleteInOutLineMvo>(this IInOutLineMvoState state)
            where TDeleteInOutLineMvo : IDeleteInOutLineMvo, new()
        {
            var cmd = new TDeleteInOutLineMvo();

            cmd.InOutLineId  = state.InOutLineId;
            cmd.InOutVersion = ((IInOutLineMvoStateProperties)state).InOutVersion;

            return(cmd);
        }
コード例 #4
0
        public void Save(IInOutLineMvoState state)
        {
            CurrentSession.SaveOrUpdate(state);

            var saveable = state as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
        }
コード例 #5
0
        public IInOutLineMvoState Get(InOutLineId id)
        {
            IInOutLineMvoState state = CurrentSession.Get <InOutLineMvoState> (id);

            if (state == null)
            {
                state = new InOutLineMvoState();
                (state as InOutLineMvoState).InOutLineId = id;
            }
            return(state);
        }
コード例 #6
0
        public IInOutLineMvoState Get(InOutLineId id, bool nullAllowed)
        {
            IInOutLineMvoState state = CurrentSession.Get <InOutLineMvoState> (id);

            if (!nullAllowed && state == null)
            {
                state = new InOutLineMvoState();
                (state as InOutLineMvoState).InOutLineId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IInOutLineMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
コード例 #7
0
        public async Task <IInOutLineMvoState> GetAsync(InOutLineId inOutLineId)
        {
            IInOutLineMvoState state = null;
            var idObj         = InOutLineMvoProxyUtils.ToIdString(inOutLineId);
            var uriParameters = new InOutLineMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new InOutLineMvoGetRequest(uriParameters);

            var resp = await _ramlClient.InOutLineMvo.Get(req);

            InOutLineMvoProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToInOutLineMvoState();
            return(state);
        }
コード例 #8
0
        public void Save(IInOutLineMvoState state)
        {
            IInOutLineMvoState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IInOutLineMvoState>(state);
            }
            CurrentSession.SaveOrUpdate(s);

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
        }
コード例 #9
0
 public override IInOutLineMvoAggregate GetInOutLineMvoAggregate(IInOutLineMvoState state)
 {
     return(new InOutLineMvoAggregate(state));
 }
コード例 #10
0
 public InOutLineMvoStateDtoWrapper(IInOutLineMvoState state)
 {
     this._state = state;
 }
コード例 #11
0
        protected void NewInOutLineMvoDocumentActionCommandAndExecute(ICreateInOutLineMvo c, IInOutLineMvoState s, IInOutLineMvoStateCreated e)
        {
            var pCommandHandler = this.InOutLineMvoDocumentActionCommandHandler;
            var pCmdContent     = c.DocumentAction;
            var pCmd            = new PropertyCommand <string, string> {
                Content = pCmdContent, GetState = () => s.InOutDocumentStatus, SetState = p => e.InOutDocumentStatus = p, OuterCommandType = CommandType.Create
            };

            pCommandHandler.Execute(pCmd);
        }
コード例 #12
0
        protected bool IsRepeatedCommand(IInOutLineMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IInOutLineMvoState state)
        {
            bool repeated = false;

            if (((IInOutLineMvoStateProperties)state).InOutVersion > command.AggregateVersion)
            {
                var lastEvent = EventStore.FindLastEvent(typeof(IInOutLineMvoStateEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
コード例 #13
0
 public InOutLineMvoStateDtoWrapper()
 {
     this._state = new InOutLineMvoState();
 }
コード例 #14
0
 public abstract IInOutLineMvoAggregate GetInOutLineMvoAggregate(IInOutLineMvoState state);
コード例 #15
0
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IInOutLineMvoAggregate aggregate, IInOutLineMvoState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IInOutLineMvoStateProperties)state).InOutVersion, aggregate.Changes, () => { StateRepository.Save(state); });
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IInOutLineMvoAggregate, IInOutLineMvoState>(aggregate, state, aggregate.Changes));
     }
 }
コード例 #16
0
 public InOutLineMvoAggregate(IInOutLineMvoState state)
 {
     _state = state;
 }
コード例 #17
0
        public static TMergePatchInOutLineMvo ToMergePatchInOutLineMvo <TMergePatchInOutLineMvo>(this IInOutLineMvoState state)
            where TMergePatchInOutLineMvo : IMergePatchInOutLineMvo, new()
        {
            var cmd = new TMergePatchInOutLineMvo();

            cmd.InOutVersion = ((IInOutLineMvoStateProperties)state).InOutVersion;

            cmd.InOutLineId                    = state.InOutLineId;
            cmd.Description                    = state.Description;
            cmd.LocatorId                      = state.LocatorId;
            cmd.ProductId                      = state.ProductId;
            cmd.UomId                          = state.UomId;
            cmd.MovementQuantity               = state.MovementQuantity;
            cmd.ConfirmedQuantity              = state.ConfirmedQuantity;
            cmd.ScrappedQuantity               = state.ScrappedQuantity;
            cmd.TargetQuantity                 = state.TargetQuantity;
            cmd.PickedQuantity                 = state.PickedQuantity;
            cmd.IsInvoiced                     = state.IsInvoiced;
            cmd.AttributeSetInstanceId         = state.AttributeSetInstanceId;
            cmd.IsDescription                  = state.IsDescription;
            cmd.Processed                      = state.Processed;
            cmd.QuantityEntered                = state.QuantityEntered;
            cmd.RmaLineNumber                  = state.RmaLineNumber;
            cmd.ReversalLineNumber             = state.ReversalLineNumber;
            cmd.Version                        = ((IInOutLineMvoStateProperties)state).Version;
            cmd.Active                         = ((IInOutLineMvoStateProperties)state).Active;
            cmd.InOutIsSOTransaction           = state.InOutIsSOTransaction;
            cmd.InOutPosted                    = state.InOutPosted;
            cmd.InOutProcessing                = state.InOutProcessing;
            cmd.InOutProcessed                 = state.InOutProcessed;
            cmd.InOutDocumentType              = state.InOutDocumentType;
            cmd.InOutDescription               = state.InOutDescription;
            cmd.InOutOrderNumber               = state.InOutOrderNumber;
            cmd.InOutDateOrdered               = state.InOutDateOrdered;
            cmd.InOutIsPrinted                 = state.InOutIsPrinted;
            cmd.InOutMovementType              = state.InOutMovementType;
            cmd.InOutMovementDate              = state.InOutMovementDate;
            cmd.InOutBusinessPartnerId         = state.InOutBusinessPartnerId;
            cmd.InOutWarehouseId               = state.InOutWarehouseId;
            cmd.InOutPOReference               = state.InOutPOReference;
            cmd.InOutFreightAmount             = state.InOutFreightAmount;
            cmd.InOutShipperId                 = state.InOutShipperId;
            cmd.InOutChargeAmount              = state.InOutChargeAmount;
            cmd.InOutDatePrinted               = state.InOutDatePrinted;
            cmd.InOutSalesRepresentative       = state.InOutSalesRepresentative;
            cmd.InOutNumberOfPackages          = state.InOutNumberOfPackages;
            cmd.InOutPickDate                  = state.InOutPickDate;
            cmd.InOutShipDate                  = state.InOutShipDate;
            cmd.InOutTrackingNumber            = state.InOutTrackingNumber;
            cmd.InOutDateReceived              = state.InOutDateReceived;
            cmd.InOutIsInTransit               = state.InOutIsInTransit;
            cmd.InOutIsApproved                = state.InOutIsApproved;
            cmd.InOutIsInDispute               = state.InOutIsInDispute;
            cmd.InOutVolume                    = state.InOutVolume;
            cmd.InOutWeight                    = state.InOutWeight;
            cmd.InOutRmaNumber                 = state.InOutRmaNumber;
            cmd.InOutReversalNumber            = state.InOutReversalNumber;
            cmd.InOutIsDropShip                = state.InOutIsDropShip;
            cmd.InOutDropShipBusinessPartnerId = state.InOutDropShipBusinessPartnerId;
            cmd.InOutCreatedBy                 = state.InOutCreatedBy;
            cmd.InOutCreatedAt                 = state.InOutCreatedAt;
            cmd.InOutUpdatedBy                 = state.InOutUpdatedBy;
            cmd.InOutUpdatedAt                 = state.InOutUpdatedAt;
            cmd.InOutActive                    = state.InOutActive;
            cmd.InOutDeleted                   = state.InOutDeleted;

            if (state.Description == null)
            {
                cmd.IsPropertyDescriptionRemoved = true;
            }
            if (state.LocatorId == null)
            {
                cmd.IsPropertyLocatorIdRemoved = true;
            }
            if (state.ProductId == null)
            {
                cmd.IsPropertyProductIdRemoved = true;
            }
            if (state.UomId == null)
            {
                cmd.IsPropertyUomIdRemoved = true;
            }
            if (state.AttributeSetInstanceId == null)
            {
                cmd.IsPropertyAttributeSetInstanceIdRemoved = true;
            }
            if (state.InOutDescription == null)
            {
                cmd.IsPropertyInOutDescriptionRemoved = true;
            }
            if (state.InOutOrderNumber == null)
            {
                cmd.IsPropertyInOutOrderNumberRemoved = true;
            }
            if (state.InOutDateOrdered == null)
            {
                cmd.IsPropertyInOutDateOrderedRemoved = true;
            }
            if (state.InOutMovementType == null)
            {
                cmd.IsPropertyInOutMovementTypeRemoved = true;
            }
            if (state.InOutMovementDate == null)
            {
                cmd.IsPropertyInOutMovementDateRemoved = true;
            }
            if (state.InOutBusinessPartnerId == null)
            {
                cmd.IsPropertyInOutBusinessPartnerIdRemoved = true;
            }
            if (state.InOutWarehouseId == null)
            {
                cmd.IsPropertyInOutWarehouseIdRemoved = true;
            }
            if (state.InOutPOReference == null)
            {
                cmd.IsPropertyInOutPOReferenceRemoved = true;
            }
            if (state.InOutShipperId == null)
            {
                cmd.IsPropertyInOutShipperIdRemoved = true;
            }
            if (state.InOutDatePrinted == null)
            {
                cmd.IsPropertyInOutDatePrintedRemoved = true;
            }
            if (state.InOutSalesRepresentative == null)
            {
                cmd.IsPropertyInOutSalesRepresentativeRemoved = true;
            }
            if (state.InOutPickDate == null)
            {
                cmd.IsPropertyInOutPickDateRemoved = true;
            }
            if (state.InOutShipDate == null)
            {
                cmd.IsPropertyInOutShipDateRemoved = true;
            }
            if (state.InOutTrackingNumber == null)
            {
                cmd.IsPropertyInOutTrackingNumberRemoved = true;
            }
            if (state.InOutDateReceived == null)
            {
                cmd.IsPropertyInOutDateReceivedRemoved = true;
            }
            if (state.InOutRmaNumber == null)
            {
                cmd.IsPropertyInOutRmaNumberRemoved = true;
            }
            if (state.InOutReversalNumber == null)
            {
                cmd.IsPropertyInOutReversalNumberRemoved = true;
            }
            if (state.InOutDropShipBusinessPartnerId == null)
            {
                cmd.IsPropertyInOutDropShipBusinessPartnerIdRemoved = true;
            }
            if (state.InOutCreatedBy == null)
            {
                cmd.IsPropertyInOutCreatedByRemoved = true;
            }
            if (state.InOutUpdatedBy == null)
            {
                cmd.IsPropertyInOutUpdatedByRemoved = true;
            }
            return(cmd);
        }
コード例 #18
0
        public static IInOutLineMvoCommand ToCreateOrMergePatchInOutLineMvo <TCreateInOutLineMvo, TMergePatchInOutLineMvo>(this IInOutLineMvoState state)
            where TCreateInOutLineMvo : ICreateInOutLineMvo, new()
            where TMergePatchInOutLineMvo : IMergePatchInOutLineMvo, new()
        {
            bool bUnsaved = ((IInOutLineMvoState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateInOutLineMvo <TCreateInOutLineMvo>());
            }
            else
            {
                return(state.ToMergePatchInOutLineMvo <TMergePatchInOutLineMvo>());
            }
        }