示例#1
0
        public IInOutLineImageState Get(InOutLineImageId id, bool nullAllowed)
        {
            IInOutLineImageState state = CurrentSession.Get <InOutLineImageState>(id);

            if (!nullAllowed && state == null)
            {
                state = new InOutLineImageState();
                (state as InOutLineImageState).InOutLineImageId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IInOutLineImageState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
示例#2
0
        public void Delete(IInOutLineImageState state)
        {
            IInOutLineImageState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IInOutLineImageState>(state);
            }
            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Delete(s);
        }
示例#3
0
        public virtual void When(IInOutLineStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.LocatorId = e.LocatorId;

            this.ProductId = e.ProductId;

            this.AttributeSetInstanceId = e.AttributeSetInstanceId;

            this.DamageStatusIds = e.DamageStatusIds;

            this.Description = e.Description;

            this.QuantityUomId = e.QuantityUomId;

            this.MovementQuantity = (e.MovementQuantity != null && e.MovementQuantity.HasValue) ? e.MovementQuantity.Value : default(decimal);

            this.PickedQuantity = (e.PickedQuantity != null && e.PickedQuantity.HasValue) ? e.PickedQuantity.Value : default(decimal);

            this.IsInvoiced = (e.IsInvoiced != null && e.IsInvoiced.HasValue) ? e.IsInvoiced.Value : default(bool);

            this.Processed = (e.Processed != null && e.Processed.HasValue) ? e.Processed.Value : default(bool);

            this.RmaLineNumber = e.RmaLineNumber;

            this.ReversalLineNumber = e.ReversalLineNumber;

            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 (IInOutLineImageStateCreated innerEvent in e.InOutLineImageEvents)
            {
                IInOutLineImageState innerState = this.InOutLineImages.Get(innerEvent.GlobalId.SequenceId, true);
                innerState.Mutate(innerEvent);
            }
        }
示例#4
0
 public void AddToSave(IInOutLineImageState state)
 {
     throw new NotSupportedException();
 }
示例#5
0
 public InOutLineImageStateDtoWrapper(IInOutLineImageState state)
 {
     this._state = state;
 }
示例#6
0
 public InOutLineImageStateDtoWrapper()
 {
     this._state = new InOutLineImageState();
 }
示例#7
0
 public virtual void Remove(IInOutLineImageState state)
 {
     this._removedInOutLineImageStates.Add(state.GlobalId, state);
 }
示例#8
0
 public virtual void AddToSave(IInOutLineImageState state)
 {
     this._loadedInOutLineImageStates[state.GlobalId] = state;
 }
        public static TCreateInOutLineImage ToCreateInOutLineImage <TCreateInOutLineImage>(this IInOutLineImageState state)
            where TCreateInOutLineImage : ICreateInOutLineImage, new()
        {
            var cmd = new TCreateInOutLineImage();

            cmd.SequenceId          = state.SequenceId;
            cmd.Url                 = state.Url;
            cmd.Active              = ((IInOutLineImageStateProperties)state).Active;
            cmd.InOutDocumentNumber = state.InOutDocumentNumber;
            cmd.InOutLineLineNumber = state.InOutLineLineNumber;
            return(cmd);
        }
        public static TMergePatchInOutLineImage ToMergePatchInOutLineImage <TMergePatchInOutLineImage>(this IInOutLineImageState state)
            where TMergePatchInOutLineImage : IMergePatchInOutLineImage, new()
        {
            var cmd = new TMergePatchInOutLineImage();

            cmd.SequenceId          = state.SequenceId;
            cmd.Url                 = state.Url;
            cmd.Active              = ((IInOutLineImageStateProperties)state).Active;
            cmd.InOutDocumentNumber = state.InOutDocumentNumber;
            cmd.InOutLineLineNumber = state.InOutLineLineNumber;

            if (state.Url == null)
            {
                cmd.IsPropertyUrlRemoved = true;
            }
            return(cmd);
        }
        public static TRemoveInOutLineImage ToRemoveInOutLineImage <TRemoveInOutLineImage>(this IInOutLineImageState state)
            where TRemoveInOutLineImage : IRemoveInOutLineImage, new()
        {
            var cmd = new TRemoveInOutLineImage();

            cmd.SequenceId = state.SequenceId;
            return(cmd);
        }
        public static IInOutLineImageCommand ToCreateOrMergePatchInOutLineImage <TCreateInOutLineImage, TMergePatchInOutLineImage>(this IInOutLineImageState state)
            where TCreateInOutLineImage : ICreateInOutLineImage, new()
            where TMergePatchInOutLineImage : IMergePatchInOutLineImage, new()
        {
            bool bUnsaved = ((IInOutLineImageState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateInOutLineImage <TCreateInOutLineImage>());
            }
            else
            {
                return(state.ToMergePatchInOutLineImage <TMergePatchInOutLineImage>());
            }
        }
示例#13
0
        public virtual void When(IInOutLineStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.LocatorId == null)
            {
                if (e.IsPropertyLocatorIdRemoved)
                {
                    this.LocatorId = default(string);
                }
            }
            else
            {
                this.LocatorId = e.LocatorId;
            }

            if (e.ProductId == null)
            {
                if (e.IsPropertyProductIdRemoved)
                {
                    this.ProductId = default(string);
                }
            }
            else
            {
                this.ProductId = e.ProductId;
            }

            if (e.AttributeSetInstanceId == null)
            {
                if (e.IsPropertyAttributeSetInstanceIdRemoved)
                {
                    this.AttributeSetInstanceId = default(string);
                }
            }
            else
            {
                this.AttributeSetInstanceId = e.AttributeSetInstanceId;
            }

            if (e.DamageStatusIds == null)
            {
                if (e.IsPropertyDamageStatusIdsRemoved)
                {
                    this.DamageStatusIds = null;
                }
            }
            else
            {
                this.DamageStatusIds = e.DamageStatusIds;
            }

            if (e.Description == null)
            {
                if (e.IsPropertyDescriptionRemoved)
                {
                    this.Description = default(string);
                }
            }
            else
            {
                this.Description = e.Description;
            }

            if (e.QuantityUomId == null)
            {
                if (e.IsPropertyQuantityUomIdRemoved)
                {
                    this.QuantityUomId = default(string);
                }
            }
            else
            {
                this.QuantityUomId = e.QuantityUomId;
            }

            if (e.MovementQuantity == null)
            {
                if (e.IsPropertyMovementQuantityRemoved)
                {
                    this.MovementQuantity = default(decimal);
                }
            }
            else
            {
                this.MovementQuantity = (e.MovementQuantity != null && e.MovementQuantity.HasValue) ? e.MovementQuantity.Value : default(decimal);
            }

            if (e.PickedQuantity == null)
            {
                if (e.IsPropertyPickedQuantityRemoved)
                {
                    this.PickedQuantity = default(decimal);
                }
            }
            else
            {
                this.PickedQuantity = (e.PickedQuantity != null && e.PickedQuantity.HasValue) ? e.PickedQuantity.Value : default(decimal);
            }

            if (e.IsInvoiced == null)
            {
                if (e.IsPropertyIsInvoicedRemoved)
                {
                    this.IsInvoiced = default(bool);
                }
            }
            else
            {
                this.IsInvoiced = (e.IsInvoiced != null && e.IsInvoiced.HasValue) ? e.IsInvoiced.Value : default(bool);
            }

            if (e.Processed == null)
            {
                if (e.IsPropertyProcessedRemoved)
                {
                    this.Processed = default(bool);
                }
            }
            else
            {
                this.Processed = (e.Processed != null && e.Processed.HasValue) ? e.Processed.Value : default(bool);
            }

            if (e.RmaLineNumber == null)
            {
                if (e.IsPropertyRmaLineNumberRemoved)
                {
                    this.RmaLineNumber = default(string);
                }
            }
            else
            {
                this.RmaLineNumber = e.RmaLineNumber;
            }

            if (e.ReversalLineNumber == null)
            {
                if (e.IsPropertyReversalLineNumberRemoved)
                {
                    this.ReversalLineNumber = default(string);
                }
            }
            else
            {
                this.ReversalLineNumber = e.ReversalLineNumber;
            }

            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 (IInOutLineImageEvent innerEvent in e.InOutLineImageEvents)
            {
                IInOutLineImageState innerState = this.InOutLineImages.Get(innerEvent.GlobalId.SequenceId);

                innerState.Mutate(innerEvent);
                var removed = innerEvent as IInOutLineImageStateRemoved;
                if (removed != null)
                {
                    this.InOutLineImages.Remove(innerState);
                }
            }
        }