public static TRemoveInOutImage ToRemoveInOutImage <TRemoveInOutImage>(this IInOutImageState state) where TRemoveInOutImage : IRemoveInOutImage, new() { var cmd = new TRemoveInOutImage(); cmd.SequenceId = state.SequenceId; return(cmd); }
public static TCreateInOutImage ToCreateInOutImage <TCreateInOutImage>(this IInOutImageState state) where TCreateInOutImage : ICreateInOutImage, new() { var cmd = new TCreateInOutImage(); cmd.SequenceId = state.SequenceId; cmd.Url = state.Url; cmd.Active = ((IInOutImageStateProperties)state).Active; cmd.InOutDocumentNumber = state.InOutDocumentNumber; return(cmd); }
public IInOutImageState Get(InOutImageId id, bool nullAllowed) { IInOutImageState state = CurrentSession.Get <InOutImageState>(id); if (!nullAllowed && state == null) { state = new InOutImageState(); (state as InOutImageState).InOutImageId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IInOutImageState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public void Delete(IInOutImageState state) { IInOutImageState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IInOutImageState>(state); } var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Delete(s); }
public static TMergePatchInOutImage ToMergePatchInOutImage <TMergePatchInOutImage>(this IInOutImageState state) where TMergePatchInOutImage : IMergePatchInOutImage, new() { var cmd = new TMergePatchInOutImage(); cmd.SequenceId = state.SequenceId; cmd.Url = state.Url; cmd.Active = ((IInOutImageStateProperties)state).Active; cmd.InOutDocumentNumber = state.InOutDocumentNumber; if (state.Url == null) { cmd.IsPropertyUrlRemoved = true; } return(cmd); }
public static IInOutImageCommand ToCreateOrMergePatchInOutImage <TCreateInOutImage, TMergePatchInOutImage>(this IInOutImageState state) where TCreateInOutImage : ICreateInOutImage, new() where TMergePatchInOutImage : IMergePatchInOutImage, new() { bool bUnsaved = ((IInOutImageState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateInOutImage <TCreateInOutImage>()); } else { return(state.ToMergePatchInOutImage <TMergePatchInOutImage>()); } }
public InOutImageStateDtoWrapper(IInOutImageState state) { this._state = state; }
public InOutImageStateDtoWrapper() { this._state = new InOutImageState(); }
public void AddToSave(IInOutImageState state) { throw new NotSupportedException(); }
public virtual void When(IInOutStateMergePatched e) { ThrowOnWrongEvent(e); if (e.DocumentStatusId == null) { if (e.IsPropertyDocumentStatusIdRemoved) { this.DocumentStatusId = default(string); } } else { this.DocumentStatusId = e.DocumentStatusId; } if (e.Posted == null) { if (e.IsPropertyPostedRemoved) { this.Posted = default(bool); } } else { this.Posted = (e.Posted != null && e.Posted.HasValue) ? e.Posted.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.Processing == null) { if (e.IsPropertyProcessingRemoved) { this.Processing = default(string); } } else { this.Processing = e.Processing; } if (e.DocumentTypeId == null) { if (e.IsPropertyDocumentTypeIdRemoved) { this.DocumentTypeId = default(string); } } else { this.DocumentTypeId = e.DocumentTypeId; } if (e.Description == null) { if (e.IsPropertyDescriptionRemoved) { this.Description = default(string); } } else { this.Description = e.Description; } if (e.OrderId == null) { if (e.IsPropertyOrderIdRemoved) { this.OrderId = default(string); } } else { this.OrderId = e.OrderId; } if (e.DateOrdered == null) { if (e.IsPropertyDateOrderedRemoved) { this.DateOrdered = default(DateTime?); } } else { this.DateOrdered = e.DateOrdered; } if (e.IsPrinted == null) { if (e.IsPropertyIsPrintedRemoved) { this.IsPrinted = default(bool); } } else { this.IsPrinted = (e.IsPrinted != null && e.IsPrinted.HasValue) ? e.IsPrinted.Value : default(bool); } if (e.MovementTypeId == null) { if (e.IsPropertyMovementTypeIdRemoved) { this.MovementTypeId = default(string); } } else { this.MovementTypeId = e.MovementTypeId; } if (e.MovementDate == null) { if (e.IsPropertyMovementDateRemoved) { this.MovementDate = default(DateTime?); } } else { this.MovementDate = e.MovementDate; } if (e.BusinessPartnerId == null) { if (e.IsPropertyBusinessPartnerIdRemoved) { this.BusinessPartnerId = default(string); } } else { this.BusinessPartnerId = e.BusinessPartnerId; } if (e.WarehouseId == null) { if (e.IsPropertyWarehouseIdRemoved) { this.WarehouseId = default(string); } } else { this.WarehouseId = e.WarehouseId; } if (e.POReference == null) { if (e.IsPropertyPOReferenceRemoved) { this.POReference = default(string); } } else { this.POReference = e.POReference; } if (e.FreightAmount == null) { if (e.IsPropertyFreightAmountRemoved) { this.FreightAmount = default(decimal); } } else { this.FreightAmount = (e.FreightAmount != null && e.FreightAmount.HasValue) ? e.FreightAmount.Value : default(decimal); } if (e.ShipperId == null) { if (e.IsPropertyShipperIdRemoved) { this.ShipperId = default(string); } } else { this.ShipperId = e.ShipperId; } if (e.ChargeAmount == null) { if (e.IsPropertyChargeAmountRemoved) { this.ChargeAmount = default(decimal); } } else { this.ChargeAmount = (e.ChargeAmount != null && e.ChargeAmount.HasValue) ? e.ChargeAmount.Value : default(decimal); } if (e.DatePrinted == null) { if (e.IsPropertyDatePrintedRemoved) { this.DatePrinted = default(DateTime?); } } else { this.DatePrinted = e.DatePrinted; } if (e.CreatedFrom == null) { if (e.IsPropertyCreatedFromRemoved) { this.CreatedFrom = default(string); } } else { this.CreatedFrom = e.CreatedFrom; } if (e.SalesRepresentativeId == null) { if (e.IsPropertySalesRepresentativeIdRemoved) { this.SalesRepresentativeId = default(string); } } else { this.SalesRepresentativeId = e.SalesRepresentativeId; } if (e.NumberOfPackages == null) { if (e.IsPropertyNumberOfPackagesRemoved) { this.NumberOfPackages = default(int); } } else { this.NumberOfPackages = (e.NumberOfPackages != null && e.NumberOfPackages.HasValue) ? e.NumberOfPackages.Value : default(int); } if (e.PickDate == null) { if (e.IsPropertyPickDateRemoved) { this.PickDate = default(DateTime?); } } else { this.PickDate = e.PickDate; } if (e.ShipDate == null) { if (e.IsPropertyShipDateRemoved) { this.ShipDate = default(DateTime?); } } else { this.ShipDate = e.ShipDate; } if (e.TrackingNumber == null) { if (e.IsPropertyTrackingNumberRemoved) { this.TrackingNumber = default(string); } } else { this.TrackingNumber = e.TrackingNumber; } if (e.DateReceived == null) { if (e.IsPropertyDateReceivedRemoved) { this.DateReceived = default(DateTime?); } } else { this.DateReceived = e.DateReceived; } if (e.IsInTransit == null) { if (e.IsPropertyIsInTransitRemoved) { this.IsInTransit = default(bool); } } else { this.IsInTransit = (e.IsInTransit != null && e.IsInTransit.HasValue) ? e.IsInTransit.Value : default(bool); } if (e.IsApproved == null) { if (e.IsPropertyIsApprovedRemoved) { this.IsApproved = default(bool); } } else { this.IsApproved = (e.IsApproved != null && e.IsApproved.HasValue) ? e.IsApproved.Value : default(bool); } if (e.IsInDispute == null) { if (e.IsPropertyIsInDisputeRemoved) { this.IsInDispute = default(bool); } } else { this.IsInDispute = (e.IsInDispute != null && e.IsInDispute.HasValue) ? e.IsInDispute.Value : default(bool); } if (e.RmaDocumentNumber == null) { if (e.IsPropertyRmaDocumentNumberRemoved) { this.RmaDocumentNumber = default(string); } } else { this.RmaDocumentNumber = e.RmaDocumentNumber; } if (e.ReversalDocumentNumber == null) { if (e.IsPropertyReversalDocumentNumberRemoved) { this.ReversalDocumentNumber = default(string); } } else { this.ReversalDocumentNumber = e.ReversalDocumentNumber; } 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 (IInOutImageEvent innerEvent in e.InOutImageEvents) { IInOutImageState innerState = this.InOutImages.Get(innerEvent.GlobalId.SequenceId); innerState.Mutate(innerEvent); var removed = innerEvent as IInOutImageStateRemoved; if (removed != null) { this.InOutImages.Remove(innerState); } } foreach (IInOutLineEvent innerEvent in e.InOutLineEvents) { IInOutLineState innerState = this.InOutLines.Get(innerEvent.GlobalId.LineNumber); innerState.Mutate(innerEvent); var removed = innerEvent as IInOutLineStateRemoved; if (removed != null) { this.InOutLines.Remove(innerState); } } }
public virtual void When(IInOutStateCreated e) { ThrowOnWrongEvent(e); this.DocumentStatusId = e.DocumentStatusId; this.Posted = (e.Posted != null && e.Posted.HasValue) ? e.Posted.Value : default(bool); this.Processed = (e.Processed != null && e.Processed.HasValue) ? e.Processed.Value : default(bool); this.Processing = e.Processing; this.DocumentTypeId = e.DocumentTypeId; this.Description = e.Description; this.OrderId = e.OrderId; this.DateOrdered = e.DateOrdered; this.IsPrinted = (e.IsPrinted != null && e.IsPrinted.HasValue) ? e.IsPrinted.Value : default(bool); this.MovementTypeId = e.MovementTypeId; this.MovementDate = e.MovementDate; this.BusinessPartnerId = e.BusinessPartnerId; this.WarehouseId = e.WarehouseId; this.POReference = e.POReference; this.FreightAmount = (e.FreightAmount != null && e.FreightAmount.HasValue) ? e.FreightAmount.Value : default(decimal); this.ShipperId = e.ShipperId; this.ChargeAmount = (e.ChargeAmount != null && e.ChargeAmount.HasValue) ? e.ChargeAmount.Value : default(decimal); this.DatePrinted = e.DatePrinted; this.CreatedFrom = e.CreatedFrom; this.SalesRepresentativeId = e.SalesRepresentativeId; this.NumberOfPackages = (e.NumberOfPackages != null && e.NumberOfPackages.HasValue) ? e.NumberOfPackages.Value : default(int); this.PickDate = e.PickDate; this.ShipDate = e.ShipDate; this.TrackingNumber = e.TrackingNumber; this.DateReceived = e.DateReceived; this.IsInTransit = (e.IsInTransit != null && e.IsInTransit.HasValue) ? e.IsInTransit.Value : default(bool); this.IsApproved = (e.IsApproved != null && e.IsApproved.HasValue) ? e.IsApproved.Value : default(bool); this.IsInDispute = (e.IsInDispute != null && e.IsInDispute.HasValue) ? e.IsInDispute.Value : default(bool); this.RmaDocumentNumber = e.RmaDocumentNumber; this.ReversalDocumentNumber = e.ReversalDocumentNumber; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; foreach (IInOutImageStateCreated innerEvent in e.InOutImageEvents) { IInOutImageState innerState = this.InOutImages.Get(innerEvent.GlobalId.SequenceId, true); innerState.Mutate(innerEvent); } foreach (IInOutLineStateCreated innerEvent in e.InOutLineEvents) { IInOutLineState innerState = this.InOutLines.Get(innerEvent.GlobalId.LineNumber, true); innerState.Mutate(innerEvent); } }
public virtual void Remove(IInOutImageState state) { this._removedInOutImageStates.Add(state.GlobalId, state); }
public virtual void AddToSave(IInOutImageState state) { this._loadedInOutImageStates[state.GlobalId] = state; }