Beispiel #1
0
 public virtual void RemoveOrderForecastDetails(OrderForecastDetails __item)
 {
     if (__item != null)
     {
         __item.OrderForecast = null;
     }
 }
Beispiel #2
0
 public virtual void InternalRemoveOrderForecastDetails(OrderForecastDetails __item)
 {
     if (__item == null)
     {
         return;
     }
     orderForecastDetails?.Remove(__item);
 }
Beispiel #3
0
 public virtual void InternalAddOrderForecastDetails(OrderForecastDetails __item)
 {
     if (__item == null || disableInternalAdditions)
     {
         return;
     }
     orderForecastDetails?.Add(__item);
 }
        public void Notification_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _notification_item_notifications = new DSS1_RetailerDriverStockOptimisation.BO.Item
            {
                SKU              = "8a430ffc-1da7-4374-ad34-4d3f1a331aeaItem_SKU",
                Description      = "Item_Description",
                UPC              = "Item_UPC",
                AvgDailyDemand   = 222222.22M,
                PalletSize       = 7256,
                SupplierPackSize = 5965,
                InnerPackSize    = 7979,
                PalletType       = "Item_PalletType",
                PalTI            = 3577,
                PalHI            = 998,
                UOM              = "Item_UOM",
            };
            var _notification_warehouse_notification = new DSS1_RetailerDriverStockOptimisation.BO.Warehouse
            {
                Code        = "Warehouse_Code",
                Description = "Warehouse_Description",
                FlowType    = "Warehouse_FlowType",
            };
            var _orderproposal_orderforecastdetails_notification = new DSS1_RetailerDriverStockOptimisation.BO.OrderForecastDetails
            {
                ReplenishmentCycle        = 5236,
                AutomatedForecast         = 349,
                Quantity                  = 2222222222.22222M,
                RoundQuantity             = 6891,
                OrderInventoryDays        = 2222222222.22222M,
                RecommendedOrderDate      = now,
                SalesForecastDate         = now,
                SupplierCanDeliver        = true,
                SupplierMaxQuantity       = 2222222222.22222M,
                SupplierCoverageDays      = 3753,
                ItemCoverageDays          = 9727,
                InitialStockLevel         = 6612,
                SupplierAvailableQuantity = 484,
                SupplierSharesStock       = true,
                CreatedOn                 = now,
                Status = "OrderForecastDetails_Status",
            };

            new PersistenceSpecification <DSS1_RetailerDriverStockOptimisation.BO.Notification>(Session)
            .CheckProperty(p => p.Message, "Notification_Message")
            .CheckProperty(p => p.TotalSupplierStock, 9421)
            .CheckProperty(p => p.OrderForecastQuantity, 7030)
            .CheckProperty(p => p.Diff, 1721)
            .CheckProperty(p => p.SalesForecastDate, now)
            .CheckProperty(p => p.CreatedBy, "Notification_CreatedBy")
            .CheckReference(p => p.Item, _notification_item_notifications)
            .CheckReference(p => p.Warehouse, _notification_warehouse_notification)
            .CheckReference(p => p.OrderForecastDetails, _orderproposal_orderforecastdetails_notification)
            .VerifyTheMappings();
        }
Beispiel #5
0
 public virtual void AddOrderForecastDetails(OrderForecastDetails __item)
 {
     if (__item == null)
     {
         return;
     }
     if (__item.OrderForecast != this)
     {
         __item.OrderForecast = this;
     }
 }
Beispiel #6
0
 public virtual void SetOrderForecastDetailsAt(OrderForecastDetails __item, int __index)
 {
     if (__item == null)
     {
         orderForecastDetails[__index].OrderForecast = null;
     }
     else
     {
         orderForecastDetails[__index] = __item;
         if (__item.OrderForecast != this)
         {
             __item.OrderForecast = this;
         }
     }
 }
Beispiel #7
0
 public virtual void AddAtIndexOrderForecastDetails(int index, OrderForecastDetails __item)
 {
     if (__item == null)
     {
         return;
     }
     orderForecastDetails?.Insert(index, __item);
     disableInternalAdditions = true;
     try
     {
         if (__item.OrderForecast != this)
         {
             __item.OrderForecast = this;
         }
     }
     finally
     {
         disableInternalAdditions = false;
     }
 }
        public void OrderForecast_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _orderproposal_orderforecastdetails_orderforecast = new DSS1_RetailerDriverStockOptimisation.BO.OrderForecastDetails
            {
                ReplenishmentCycle        = 8070,
                AutomatedForecast         = 3282,
                Quantity                  = 2222222222.22222M,
                RoundQuantity             = 3538,
                OrderInventoryDays        = 2222222222.22222M,
                RecommendedOrderDate      = now,
                SalesForecastDate         = now,
                SupplierCanDeliver        = true,
                SupplierMaxQuantity       = 2222222222.22222M,
                SupplierCoverageDays      = 3462,
                ItemCoverageDays          = 8750,
                InitialStockLevel         = 1660,
                SupplierAvailableQuantity = 3781,
                SupplierSharesStock       = true,
                CreatedOn                 = now,
                Status = "OrderForecastDetails_Status",
            };
            var _orderproposal_orderforecastdetails_orderforecast2 = new DSS1_RetailerDriverStockOptimisation.BO.OrderForecastDetails
            {
                ReplenishmentCycle        = 2590,
                AutomatedForecast         = 8073,
                Quantity                  = 2222222222.22222M,
                RoundQuantity             = 7556,
                OrderInventoryDays        = 2222222222.22222M,
                RecommendedOrderDate      = now,
                SalesForecastDate         = now,
                SupplierCanDeliver        = true,
                SupplierMaxQuantity       = 2222222222.22222M,
                SupplierCoverageDays      = 3548,
                ItemCoverageDays          = 9880,
                InitialStockLevel         = 5100,
                SupplierAvailableQuantity = 8731,
                SupplierSharesStock       = true,
                CreatedOn                 = now,
                Status = "OrderForecastDetails_Status",
            };
            var _orderproposal_salesforecast_orderforecasts = new DSS1_RetailerDriverStockOptimisation.BO.SalesForecast
            {
                ImportId   = 7819,
                ImportDate = now,
            };
            var _orderproposal_supplierparameters_orderforecast = new DSS1_RetailerDriverStockOptimisation.BO.SupplierParameter
            {
                CoverageDays = 4599,
                SupplierCanDeliverWholeForecast = true,
                SupplierComments  = "SupplierParameter_SupplierComments",
                HasReplied        = true,
                SharesExcessStock = true,
            };
            var _orderproposal_supplierparameters_orderforecast2 = new DSS1_RetailerDriverStockOptimisation.BO.SupplierParameter
            {
                CoverageDays = 9091,
                SupplierCanDeliverWholeForecast = true,
                SupplierComments  = "SupplierParameter_SupplierComments",
                HasReplied        = true,
                SharesExcessStock = true,
            };
            var _orderproposal_itemparameters_orderforecast = new DSS1_RetailerDriverStockOptimisation.BO.ItemParameter
            {
                CoverageDays       = 7970,
                SupplierCanDeliver = true,
                SupplierQuantity   = 8144,
                SupplierComments   = "ItemParameter_SupplierComments",
            };
            var _orderproposal_itemparameters_orderforecast2 = new DSS1_RetailerDriverStockOptimisation.BO.ItemParameter
            {
                CoverageDays       = 8048,
                SupplierCanDeliver = true,
                SupplierQuantity   = 4874,
                SupplierComments   = "ItemParameter_SupplierComments",
            };

            new PersistenceSpecification <DSS1_RetailerDriverStockOptimisation.BO.OrderForecast>(Session)
            .CheckProperty(p => p.ImportId, 2549)
            .CheckProperty(p => p.Status, "OrderForecast_Status")
            .CheckProperty(p => p.CreatedBy, "OrderForecast_CreatedBy")
            .CheckProperty(p => p.CreatedOn, now)
            .CheckProperty(p => p.StartDate, now)
            .CheckProperty(p => p.EndDate, now)
            .CheckProperty(p => p.State, "OrderForecast_State")
            .CheckBag(p => p.OrderForecastDetails, (new List <DSS1_RetailerDriverStockOptimisation.BO.OrderForecastDetails>
            {
                _orderproposal_orderforecastdetails_orderforecast,
                _orderproposal_orderforecastdetails_orderforecast2
            }))
            .CheckReference(p => p.SalesForecast, _orderproposal_salesforecast_orderforecasts)
            .CheckBag(p => p.SupplierParameters, (new List <DSS1_RetailerDriverStockOptimisation.BO.SupplierParameter>
            {
                _orderproposal_supplierparameters_orderforecast,
                _orderproposal_supplierparameters_orderforecast2
            }))
            .CheckBag(p => p.ItemParameters, (new List <DSS1_RetailerDriverStockOptimisation.BO.ItemParameter>
            {
                _orderproposal_itemparameters_orderforecast,
                _orderproposal_itemparameters_orderforecast2
            }))
            .VerifyTheMappings();
        }
/// <summary>
///     Returns true if self and the provided entity have the same Id values
///     and the Ids are not of the default Id value
/// </summary>
        protected bool HasSameNonDefaultIdAs(OrderForecastDetails compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }
/// <summary>
/// Copies the current object to a new instance
/// </summary>
/// <param name="deep">Copy members that refer to objects external to this class (not dependent)</param>
/// <param name="copiedObjects">Objects that should be reused</param>
/// <param name="asNew">Copy the current object as a new one, ready to be persisted, along all its members.</param>
/// <param name="reuseNestedObjects">If asNew is true, this flag if set, forces the reuse of all external objects.</param>
/// <param name="copy">Optional - An existing [OrderForecastDetails] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual OrderForecastDetails Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, OrderForecastDetails copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((OrderForecastDetails)copiedObjects[this]);
            }
            copy = copy ?? new OrderForecastDetails();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.ReplenishmentCycle        = this.ReplenishmentCycle;
            copy.AutomatedForecast         = this.AutomatedForecast;
            copy.Quantity                  = this.Quantity;
            copy.RoundQuantity             = this.RoundQuantity;
            copy.OrderInventoryDays        = this.OrderInventoryDays;
            copy.RecommendedOrderDate      = this.RecommendedOrderDate;
            copy.SalesForecastDate         = this.SalesForecastDate;
            copy.SupplierCanDeliver        = this.SupplierCanDeliver;
            copy.SupplierMaxQuantity       = this.SupplierMaxQuantity;
            copy.SupplierCoverageDays      = this.SupplierCoverageDays;
            copy.ItemCoverageDays          = this.ItemCoverageDays;
            copy.InitialStockLevel         = this.InitialStockLevel;
            copy.SupplierAvailableQuantity = this.SupplierAvailableQuantity;
            copy.SupplierSharesStock       = this.SupplierSharesStock;
            copy.CreatedOn                 = this.CreatedOn;
            copy.Status = this.Status;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.warehouse != null)
            {
                if (!copiedObjects.Contains(this.warehouse))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Warehouse = this.Warehouse;
                    }
                    else if (asNew)
                    {
                        copy.Warehouse = this.Warehouse.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.warehouse = this.warehouse.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Warehouse = (Warehouse)copiedObjects[this.Warehouse];
                    }
                    else
                    {
                        copy.warehouse = (Warehouse)copiedObjects[this.Warehouse];
                    }
                }
            }
            if (deep && this.item != null)
            {
                if (!copiedObjects.Contains(this.item))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Item = this.Item;
                    }
                    else if (asNew)
                    {
                        copy.Item = this.Item.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.item = this.item.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Item = (Item)copiedObjects[this.Item];
                    }
                    else
                    {
                        copy.item = (Item)copiedObjects[this.Item];
                    }
                }
            }
            if (deep && this.orderForecast != null)
            {
                if (!copiedObjects.Contains(this.orderForecast))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.OrderForecast = this.OrderForecast;
                    }
                    else if (asNew)
                    {
                        copy.OrderForecast = this.OrderForecast.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.orderForecast = this.orderForecast.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.OrderForecast = (OrderForecast)copiedObjects[this.OrderForecast];
                    }
                    else
                    {
                        copy.orderForecast = (OrderForecast)copiedObjects[this.OrderForecast];
                    }
                }
            }
            if (deep && this.notification != null)
            {
                if (!copiedObjects.Contains(this.notification))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Notification = this.Notification;
                    }
                    else if (asNew)
                    {
                        copy.Notification = this.Notification.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.notification = this.notification.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Notification = (Notification)copiedObjects[this.Notification];
                    }
                    else
                    {
                        copy.notification = (Notification)copiedObjects[this.Notification];
                    }
                }
            }
            copy.comments = new List <Comment>();
            if (deep && this.comments != null)
            {
                foreach (var __item in this.comments)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddComments(__item);
                        }
                        else
                        {
                            copy.AddComments(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddComments((Comment)copiedObjects[__item]);
                    }
                }
            }
            return(copy);
        }