예제 #1
0
        public virtual IMovementState ToMovementState()
        {
            var state = new MovementState(true);

            state.DocumentNumber   = this.DocumentNumber;
            state.DocumentStatusId = this.DocumentStatusId;
            if (this.MovementDate != null && this.MovementDate.HasValue)
            {
                state.MovementDate = this.MovementDate.Value;
            }
            if (this.Posted != null && this.Posted.HasValue)
            {
                state.Posted = this.Posted.Value;
            }
            if (this.Processed != null && this.Processed.HasValue)
            {
                state.Processed = this.Processed.Value;
            }
            state.Processing = this.Processing;
            if (this.DateReceived != null && this.DateReceived.HasValue)
            {
                state.DateReceived = this.DateReceived.Value;
            }
            state.DocumentTypeId = this.DocumentTypeId;
            if (this.IsInTransit != null && this.IsInTransit.HasValue)
            {
                state.IsInTransit = this.IsInTransit.Value;
            }
            if (this.IsApproved != null && this.IsApproved.HasValue)
            {
                state.IsApproved = this.IsApproved.Value;
            }
            if (this.ApprovalAmount != null && this.ApprovalAmount.HasValue)
            {
                state.ApprovalAmount = this.ApprovalAmount.Value;
            }
            state.ShipperId             = this.ShipperId;
            state.SalesRepresentativeId = this.SalesRepresentativeId;
            state.BusinessPartnerId     = this.BusinessPartnerId;
            if (this.ChargeAmount != null && this.ChargeAmount.HasValue)
            {
                state.ChargeAmount = this.ChargeAmount.Value;
            }
            state.CreateFrom = this.CreateFrom;
            if (this.FreightAmount != null && this.FreightAmount.HasValue)
            {
                state.FreightAmount = this.FreightAmount.Value;
            }
            state.ReversalDocumentNumber = this.ReversalDocumentNumber;
            state.WarehouseIdFrom        = this.WarehouseIdFrom;
            state.WarehouseIdTo          = this.WarehouseIdTo;
            state.Description            = this.Description;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }
            if (this.MovementLines != null)
            {
                foreach (var s in this.MovementLines)
                {
                    state.MovementLines.AddToSave(s.ToMovementLineState());
                }
            }
            ;

            return(state);
        }