public static TRemoveOrderItem ToRemoveOrderItem <TRemoveOrderItem>(this IOrderItemState state) where TRemoveOrderItem : IRemoveOrderItem, new() { var cmd = new TRemoveOrderItem(); cmd.OrderItemSeqId = state.OrderItemSeqId; return(cmd); }
public IOrderItemState Get(OrderItemId id, bool nullAllowed) { IOrderItemState state = CurrentSession.Get <OrderItemState>(id); if (!nullAllowed && state == null) { state = new OrderItemState(); (state as OrderItemState).OrderItemId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IOrderItemState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public void Delete(IOrderItemState state) { IOrderItemState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IOrderItemState>(state); } var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Delete(s); }
public static TCreateOrderItem ToCreateOrderItem <TCreateOrderItem>(this IOrderItemState state) where TCreateOrderItem : ICreateOrderItem, new() { var cmd = new TCreateOrderItem(); cmd.OrderItemSeqId = state.OrderItemSeqId; cmd.ProductId = state.ProductId; cmd.ExternalProductId = state.ExternalProductId; cmd.Quantity = state.Quantity; cmd.CancelQuantity = state.CancelQuantity; cmd.SelectedAmount = state.SelectedAmount; cmd.ExternalId = state.ExternalId; cmd.OrderItemTypeId = state.OrderItemTypeId; cmd.OrderItemGroupSeqId = state.OrderItemGroupSeqId; cmd.IsItemGroupPrimary = state.IsItemGroupPrimary; cmd.FromInventoryItemId = state.FromInventoryItemId; cmd.IsPromo = state.IsPromo; cmd.QuoteId = state.QuoteId; cmd.QuoteItemSeqId = state.QuoteItemSeqId; cmd.ShoppingListId = state.ShoppingListId; cmd.ShoppingListItemSeqId = state.ShoppingListItemSeqId; cmd.UnitPrice = state.UnitPrice; cmd.UnitListPrice = state.UnitListPrice; cmd.UnitAverageCost = state.UnitAverageCost; cmd.UnitRecurringPrice = state.UnitRecurringPrice; cmd.IsModifiedPrice = state.IsModifiedPrice; cmd.RecurringFreqUomId = state.RecurringFreqUomId; cmd.ItemDescription = state.ItemDescription; cmd.Comments = state.Comments; cmd.CorrespondingPoId = state.CorrespondingPoId; cmd.StatusId = state.StatusId; cmd.SyncStatusId = state.SyncStatusId; cmd.EstimatedShipDate = state.EstimatedShipDate; cmd.EstimatedDeliveryDate = state.EstimatedDeliveryDate; cmd.AutoCancelDate = state.AutoCancelDate; cmd.DontCancelSetDate = state.DontCancelSetDate; cmd.DontCancelSetBy = state.DontCancelSetBy; cmd.ShipBeforeDate = state.ShipBeforeDate; cmd.ShipAfterDate = state.ShipAfterDate; cmd.CancelBackOrderDate = state.CancelBackOrderDate; cmd.OverrideGlAccountId = state.OverrideGlAccountId; cmd.Active = ((IOrderItemStateProperties)state).Active; cmd.OrderId = state.OrderId; return(cmd); }
public virtual void When(IOrderStateMergePatched e) { ThrowOnWrongEvent(e); if (e.OrderTypeId == null) { if (e.IsPropertyOrderTypeIdRemoved) { this.OrderTypeId = default(string); } } else { this.OrderTypeId = e.OrderTypeId; } if (e.OrderName == null) { if (e.IsPropertyOrderNameRemoved) { this.OrderName = default(string); } } else { this.OrderName = e.OrderName; } if (e.ExternalId == null) { if (e.IsPropertyExternalIdRemoved) { this.ExternalId = default(string); } } else { this.ExternalId = e.ExternalId; } if (e.SalesChannelEnumId == null) { if (e.IsPropertySalesChannelEnumIdRemoved) { this.SalesChannelEnumId = default(string); } } else { this.SalesChannelEnumId = e.SalesChannelEnumId; } if (e.OrderDate == null) { if (e.IsPropertyOrderDateRemoved) { this.OrderDate = default(DateTime?); } } else { this.OrderDate = e.OrderDate; } if (e.Priority == null) { if (e.IsPropertyPriorityRemoved) { this.Priority = default(string); } } else { this.Priority = e.Priority; } if (e.EntryDate == null) { if (e.IsPropertyEntryDateRemoved) { this.EntryDate = default(DateTime?); } } else { this.EntryDate = e.EntryDate; } if (e.PickSheetPrintedDate == null) { if (e.IsPropertyPickSheetPrintedDateRemoved) { this.PickSheetPrintedDate = default(DateTime?); } } else { this.PickSheetPrintedDate = e.PickSheetPrintedDate; } if (e.StatusId == null) { if (e.IsPropertyStatusIdRemoved) { this.StatusId = default(string); } } else { this.StatusId = e.StatusId; } if (e.CurrencyUomId == null) { if (e.IsPropertyCurrencyUomIdRemoved) { this.CurrencyUomId = default(string); } } else { this.CurrencyUomId = e.CurrencyUomId; } if (e.SyncStatusId == null) { if (e.IsPropertySyncStatusIdRemoved) { this.SyncStatusId = default(string); } } else { this.SyncStatusId = e.SyncStatusId; } if (e.BillingAccountId == null) { if (e.IsPropertyBillingAccountIdRemoved) { this.BillingAccountId = default(string); } } else { this.BillingAccountId = e.BillingAccountId; } if (e.OriginFacilityId == null) { if (e.IsPropertyOriginFacilityIdRemoved) { this.OriginFacilityId = default(string); } } else { this.OriginFacilityId = e.OriginFacilityId; } if (e.WebSiteId == null) { if (e.IsPropertyWebSiteIdRemoved) { this.WebSiteId = default(string); } } else { this.WebSiteId = e.WebSiteId; } if (e.ProductStoreId == null) { if (e.IsPropertyProductStoreIdRemoved) { this.ProductStoreId = default(string); } } else { this.ProductStoreId = e.ProductStoreId; } if (e.TerminalId == null) { if (e.IsPropertyTerminalIdRemoved) { this.TerminalId = default(string); } } else { this.TerminalId = e.TerminalId; } if (e.TransactionId == null) { if (e.IsPropertyTransactionIdRemoved) { this.TransactionId = default(string); } } else { this.TransactionId = e.TransactionId; } if (e.AutoOrderShoppingListId == null) { if (e.IsPropertyAutoOrderShoppingListIdRemoved) { this.AutoOrderShoppingListId = default(string); } } else { this.AutoOrderShoppingListId = e.AutoOrderShoppingListId; } if (e.NeedsInventoryIssuance == null) { if (e.IsPropertyNeedsInventoryIssuanceRemoved) { this.NeedsInventoryIssuance = default(string); } } else { this.NeedsInventoryIssuance = e.NeedsInventoryIssuance; } if (e.IsRushOrder == null) { if (e.IsPropertyIsRushOrderRemoved) { this.IsRushOrder = default(string); } } else { this.IsRushOrder = e.IsRushOrder; } if (e.InternalCode == null) { if (e.IsPropertyInternalCodeRemoved) { this.InternalCode = default(string); } } else { this.InternalCode = e.InternalCode; } if (e.RemainingSubTotal == null) { if (e.IsPropertyRemainingSubTotalRemoved) { this.RemainingSubTotal = default(decimal?); } } else { this.RemainingSubTotal = e.RemainingSubTotal; } if (e.GrandTotal == null) { if (e.IsPropertyGrandTotalRemoved) { this.GrandTotal = default(decimal?); } } else { this.GrandTotal = e.GrandTotal; } if (e.InvoicePerShipment == null) { if (e.IsPropertyInvoicePerShipmentRemoved) { this.InvoicePerShipment = default(string); } } else { this.InvoicePerShipment = e.InvoicePerShipment; } 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 (IOrderRoleEvent innerEvent in e.OrderRoleEvents) { IOrderRoleState innerState = this.OrderRoles.Get(innerEvent.GlobalId.PartyRoleId); innerState.Mutate(innerEvent); var removed = innerEvent as IOrderRoleStateRemoved; if (removed != null) { this.OrderRoles.Remove(innerState); } } foreach (IOrderItemEvent innerEvent in e.OrderItemEvents) { IOrderItemState innerState = this.OrderItems.Get(innerEvent.GlobalId.OrderItemSeqId); innerState.Mutate(innerEvent); } foreach (IOrderShipGroupEvent innerEvent in e.OrderShipGroupEvents) { IOrderShipGroupState innerState = this.OrderShipGroups.Get(innerEvent.GlobalId.ShipGroupSeqId); innerState.Mutate(innerEvent); var removed = innerEvent as IOrderShipGroupStateRemoved; if (removed != null) { this.OrderShipGroups.Remove(innerState); } } }
public virtual void When(IOrderStateCreated e) { ThrowOnWrongEvent(e); this.OrderTypeId = e.OrderTypeId; this.OrderName = e.OrderName; this.ExternalId = e.ExternalId; this.SalesChannelEnumId = e.SalesChannelEnumId; this.OrderDate = e.OrderDate; this.Priority = e.Priority; this.EntryDate = e.EntryDate; this.PickSheetPrintedDate = e.PickSheetPrintedDate; this.StatusId = e.StatusId; this.CurrencyUomId = e.CurrencyUomId; this.SyncStatusId = e.SyncStatusId; this.BillingAccountId = e.BillingAccountId; this.OriginFacilityId = e.OriginFacilityId; this.WebSiteId = e.WebSiteId; this.ProductStoreId = e.ProductStoreId; this.TerminalId = e.TerminalId; this.TransactionId = e.TransactionId; this.AutoOrderShoppingListId = e.AutoOrderShoppingListId; this.NeedsInventoryIssuance = e.NeedsInventoryIssuance; this.IsRushOrder = e.IsRushOrder; this.InternalCode = e.InternalCode; this.RemainingSubTotal = e.RemainingSubTotal; this.GrandTotal = e.GrandTotal; this.InvoicePerShipment = e.InvoicePerShipment; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; foreach (IOrderRoleStateCreated innerEvent in e.OrderRoleEvents) { IOrderRoleState innerState = this.OrderRoles.Get(innerEvent.GlobalId.PartyRoleId, true); innerState.Mutate(innerEvent); } foreach (IOrderItemStateCreated innerEvent in e.OrderItemEvents) { IOrderItemState innerState = this.OrderItems.Get(innerEvent.GlobalId.OrderItemSeqId, true); innerState.Mutate(innerEvent); } foreach (IOrderShipGroupStateCreated innerEvent in e.OrderShipGroupEvents) { IOrderShipGroupState innerState = this.OrderShipGroups.Get(innerEvent.GlobalId.ShipGroupSeqId, true); innerState.Mutate(innerEvent); } }
public static TMergePatchOrderItem ToMergePatchOrderItem <TMergePatchOrderItem>(this IOrderItemState state) where TMergePatchOrderItem : IMergePatchOrderItem, new() { var cmd = new TMergePatchOrderItem(); cmd.OrderItemSeqId = state.OrderItemSeqId; cmd.ProductId = state.ProductId; cmd.ExternalProductId = state.ExternalProductId; cmd.Quantity = state.Quantity; cmd.CancelQuantity = state.CancelQuantity; cmd.SelectedAmount = state.SelectedAmount; cmd.ExternalId = state.ExternalId; cmd.OrderItemTypeId = state.OrderItemTypeId; cmd.OrderItemGroupSeqId = state.OrderItemGroupSeqId; cmd.IsItemGroupPrimary = state.IsItemGroupPrimary; cmd.FromInventoryItemId = state.FromInventoryItemId; cmd.IsPromo = state.IsPromo; cmd.QuoteId = state.QuoteId; cmd.QuoteItemSeqId = state.QuoteItemSeqId; cmd.ShoppingListId = state.ShoppingListId; cmd.ShoppingListItemSeqId = state.ShoppingListItemSeqId; cmd.UnitPrice = state.UnitPrice; cmd.UnitListPrice = state.UnitListPrice; cmd.UnitAverageCost = state.UnitAverageCost; cmd.UnitRecurringPrice = state.UnitRecurringPrice; cmd.IsModifiedPrice = state.IsModifiedPrice; cmd.RecurringFreqUomId = state.RecurringFreqUomId; cmd.ItemDescription = state.ItemDescription; cmd.Comments = state.Comments; cmd.CorrespondingPoId = state.CorrespondingPoId; cmd.StatusId = state.StatusId; cmd.SyncStatusId = state.SyncStatusId; cmd.EstimatedShipDate = state.EstimatedShipDate; cmd.EstimatedDeliveryDate = state.EstimatedDeliveryDate; cmd.AutoCancelDate = state.AutoCancelDate; cmd.DontCancelSetDate = state.DontCancelSetDate; cmd.DontCancelSetBy = state.DontCancelSetBy; cmd.ShipBeforeDate = state.ShipBeforeDate; cmd.ShipAfterDate = state.ShipAfterDate; cmd.CancelBackOrderDate = state.CancelBackOrderDate; cmd.OverrideGlAccountId = state.OverrideGlAccountId; cmd.Active = ((IOrderItemStateProperties)state).Active; cmd.OrderId = state.OrderId; if (state.ProductId == null) { cmd.IsPropertyProductIdRemoved = true; } if (state.ExternalProductId == null) { cmd.IsPropertyExternalProductIdRemoved = true; } if (state.Quantity == null) { cmd.IsPropertyQuantityRemoved = true; } if (state.CancelQuantity == null) { cmd.IsPropertyCancelQuantityRemoved = true; } if (state.SelectedAmount == null) { cmd.IsPropertySelectedAmountRemoved = true; } if (state.ExternalId == null) { cmd.IsPropertyExternalIdRemoved = true; } if (state.OrderItemTypeId == null) { cmd.IsPropertyOrderItemTypeIdRemoved = true; } if (state.OrderItemGroupSeqId == null) { cmd.IsPropertyOrderItemGroupSeqIdRemoved = true; } if (state.IsItemGroupPrimary == null) { cmd.IsPropertyIsItemGroupPrimaryRemoved = true; } if (state.FromInventoryItemId == null) { cmd.IsPropertyFromInventoryItemIdRemoved = true; } if (state.IsPromo == null) { cmd.IsPropertyIsPromoRemoved = true; } if (state.QuoteId == null) { cmd.IsPropertyQuoteIdRemoved = true; } if (state.QuoteItemSeqId == null) { cmd.IsPropertyQuoteItemSeqIdRemoved = true; } if (state.ShoppingListId == null) { cmd.IsPropertyShoppingListIdRemoved = true; } if (state.ShoppingListItemSeqId == null) { cmd.IsPropertyShoppingListItemSeqIdRemoved = true; } if (state.UnitPrice == null) { cmd.IsPropertyUnitPriceRemoved = true; } if (state.UnitListPrice == null) { cmd.IsPropertyUnitListPriceRemoved = true; } if (state.UnitAverageCost == null) { cmd.IsPropertyUnitAverageCostRemoved = true; } if (state.UnitRecurringPrice == null) { cmd.IsPropertyUnitRecurringPriceRemoved = true; } if (state.IsModifiedPrice == null) { cmd.IsPropertyIsModifiedPriceRemoved = true; } if (state.RecurringFreqUomId == null) { cmd.IsPropertyRecurringFreqUomIdRemoved = true; } if (state.ItemDescription == null) { cmd.IsPropertyItemDescriptionRemoved = true; } if (state.Comments == null) { cmd.IsPropertyCommentsRemoved = true; } if (state.CorrespondingPoId == null) { cmd.IsPropertyCorrespondingPoIdRemoved = true; } if (state.StatusId == null) { cmd.IsPropertyStatusIdRemoved = true; } if (state.SyncStatusId == null) { cmd.IsPropertySyncStatusIdRemoved = true; } if (state.EstimatedShipDate == null) { cmd.IsPropertyEstimatedShipDateRemoved = true; } if (state.EstimatedDeliveryDate == null) { cmd.IsPropertyEstimatedDeliveryDateRemoved = true; } if (state.AutoCancelDate == null) { cmd.IsPropertyAutoCancelDateRemoved = true; } if (state.DontCancelSetDate == null) { cmd.IsPropertyDontCancelSetDateRemoved = true; } if (state.DontCancelSetBy == null) { cmd.IsPropertyDontCancelSetByRemoved = true; } if (state.ShipBeforeDate == null) { cmd.IsPropertyShipBeforeDateRemoved = true; } if (state.ShipAfterDate == null) { cmd.IsPropertyShipAfterDateRemoved = true; } if (state.CancelBackOrderDate == null) { cmd.IsPropertyCancelBackOrderDateRemoved = true; } if (state.OverrideGlAccountId == null) { cmd.IsPropertyOverrideGlAccountIdRemoved = true; } return(cmd); }
public static IOrderItemCommand ToCreateOrMergePatchOrderItem <TCreateOrderItem, TMergePatchOrderItem>(this IOrderItemState state) where TCreateOrderItem : ICreateOrderItem, new() where TMergePatchOrderItem : IMergePatchOrderItem, new() { bool bUnsaved = ((IOrderItemState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateOrderItem <TCreateOrderItem>()); } else { return(state.ToMergePatchOrderItem <TMergePatchOrderItem>()); } }
public virtual void Remove(IOrderItemState state) { this._removedOrderItemStates.Add(state.GlobalId, state); }
public virtual void AddToSave(IOrderItemState state) { this._loadedOrderItemStates[state.GlobalId] = state; }
public OrderItemStateDtoWrapper(IOrderItemState state) { this._state = state; }
public OrderItemStateDtoWrapper() { this._state = new OrderItemState(); }
public void AddToSave(IOrderItemState state) { throw new NotSupportedException(); }