Exemple #1
0
 public virtual void RemoveItemParameters(ItemParameter __item)
 {
     if (__item != null)
     {
         InternalRemoveItemParameters(__item);
     }
 }
Exemple #2
0
 public virtual void AddAtIndexItemParameters(int index, ItemParameter __item)
 {
     if (__item == null)
     {
         return;
     }
     itemParameters?.Insert(index, __item);
 }
Exemple #3
0
 public virtual void AddItemParameters(ItemParameter __item)
 {
     if (__item == null)
     {
         return;
     }
     InternalAddItemParameters(__item);
 }
Exemple #4
0
 public virtual void InternalRemoveItemParameters(ItemParameter __item)
 {
     if (__item == null)
     {
         return;
     }
     itemParameters?.Remove(__item);
 }
Exemple #5
0
 public virtual void InternalAddItemParameters(ItemParameter __item)
 {
     if (__item == null || disableInternalAdditions)
     {
         return;
     }
     itemParameters?.Add(__item);
 }
Exemple #6
0
 public virtual void SetItemParametersAt(ItemParameter __item, int __index)
 {
     if (__item == null)
     {
         itemParameters[__index] = null;
     }
     else
     {
         itemParameters[__index] = __item;
     }
 }
        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(ItemParameter 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 [ItemParameter] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual ItemParameter Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, ItemParameter copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((ItemParameter)copiedObjects[this]);
            }
            copy = copy ?? new ItemParameter();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.CoverageDays       = this.CoverageDays;
            copy.SupplierCanDeliver = this.SupplierCanDeliver;
            copy.SupplierQuantity   = this.SupplierQuantity;
            copy.SupplierComments   = this.SupplierComments;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            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];
                    }
                }
            }
            return(copy);
        }