public static TRemoveOrderRole ToRemoveOrderRole <TRemoveOrderRole>(this IOrderRoleState state) where TRemoveOrderRole : IRemoveOrderRole, new() { var cmd = new TRemoveOrderRole(); cmd.PartyRoleId = state.PartyRoleId; return(cmd); }
public static TCreateOrderRole ToCreateOrderRole <TCreateOrderRole>(this IOrderRoleState state) where TCreateOrderRole : ICreateOrderRole, new() { var cmd = new TCreateOrderRole(); cmd.PartyRoleId = state.PartyRoleId; cmd.Active = ((IOrderRoleStateProperties)state).Active; cmd.OrderId = state.OrderId; return(cmd); }
public IOrderRoleState Get(OrderRoleId id, bool nullAllowed) { IOrderRoleState state = CurrentSession.Get <OrderRoleState>(id); if (!nullAllowed && state == null) { state = new OrderRoleState(); (state as OrderRoleState).OrderRoleId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IOrderRoleState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public void Delete(IOrderRoleState state) { IOrderRoleState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IOrderRoleState>(state); } var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Delete(s); }
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 void AddToSave(IOrderRoleState state) { throw new NotSupportedException(); }
public OrderRoleStateDtoWrapper(IOrderRoleState state) { this._state = state; }
public OrderRoleStateDtoWrapper() { this._state = new OrderRoleState(); }
public virtual void Remove(IOrderRoleState state) { this._removedOrderRoleStates.Add(state.GlobalId, state); }
public virtual void AddToSave(IOrderRoleState state) { this._loadedOrderRoleStates[state.GlobalId] = state; }
public static TMergePatchOrderRole ToMergePatchOrderRole <TMergePatchOrderRole>(this IOrderRoleState state) where TMergePatchOrderRole : IMergePatchOrderRole, new() { var cmd = new TMergePatchOrderRole(); cmd.PartyRoleId = state.PartyRoleId; cmd.Active = ((IOrderRoleStateProperties)state).Active; cmd.OrderId = state.OrderId; return(cmd); }
public static IOrderRoleCommand ToCreateOrMergePatchOrderRole <TCreateOrderRole, TMergePatchOrderRole>(this IOrderRoleState state) where TCreateOrderRole : ICreateOrderRole, new() where TMergePatchOrderRole : IMergePatchOrderRole, new() { bool bUnsaved = ((IOrderRoleState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateOrderRole <TCreateOrderRole>()); } else { return(state.ToMergePatchOrderRole <TMergePatchOrderRole>()); } }