public virtual void RemoveOrderForecasts(OrderForecast __item)
 {
     if (__item != null)
     {
         __item.SalesForecast = null;
     }
 }
 public virtual void InternalRemoveOrderForecasts(OrderForecast __item)
 {
     if (__item == null)
     {
         return;
     }
     orderForecasts?.Remove(__item);
 }
 public virtual void InternalAddOrderForecasts(OrderForecast __item)
 {
     if (__item == null || disableInternalAdditions)
     {
         return;
     }
     orderForecasts?.Add(__item);
 }
Exemplo n.º 4
0
        public void SalesForecast_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _orderproposal_orderforecasts_salesforecast = new DSS1_RetailerDriverStockOptimisation.BO.OrderForecast
            {
                ImportId  = 9695,
                Status    = "OrderForecast_Status",
                CreatedBy = "OrderForecast_CreatedBy",
                CreatedOn = now,
                StartDate = now,
                EndDate   = now,
                State     = "OrderForecast_State",
            };
            var _orderproposal_orderforecasts_salesforecast2 = new DSS1_RetailerDriverStockOptimisation.BO.OrderForecast
            {
                ImportId  = 2026,
                Status    = "OrderForecast_Status",
                CreatedBy = "OrderForecast_CreatedBy",
                CreatedOn = now,
                StartDate = now,
                EndDate   = now,
                State     = "OrderForecast_State",
            };
            var _sale_salesforecastdetails_salesforecast = new DSS1_RetailerDriverStockOptimisation.BO.SalesForecastDetails
            {
                AvgDailyDemandForecast = 222222.22M,
                ComputedStock          = 3408,
                NewOrder     = 8238,
                ForecastDate = now,
                Units        = 1251,
            };
            var _sale_salesforecastdetails_salesforecast2 = new DSS1_RetailerDriverStockOptimisation.BO.SalesForecastDetails
            {
                AvgDailyDemandForecast = 222222.22M,
                ComputedStock          = 5521,
                NewOrder     = 1056,
                ForecastDate = now,
                Units        = 8559,
            };

            new PersistenceSpecification <DSS1_RetailerDriverStockOptimisation.BO.SalesForecast>(Session)
            .CheckProperty(p => p.ImportId, 6538)
            .CheckProperty(p => p.ImportDate, now)
            .CheckBag(p => p.OrderForecasts, (new List <DSS1_RetailerDriverStockOptimisation.BO.OrderForecast>
            {
                _orderproposal_orderforecasts_salesforecast,
                _orderproposal_orderforecasts_salesforecast2
            }))
            .CheckBag(p => p.SalesForecastDetails, (new List <DSS1_RetailerDriverStockOptimisation.BO.SalesForecastDetails>
            {
                _sale_salesforecastdetails_salesforecast,
                _sale_salesforecastdetails_salesforecast2
            }))
            .VerifyTheMappings();
        }
 public virtual void AddOrderForecasts(OrderForecast __item)
 {
     if (__item == null)
     {
         return;
     }
     if (__item.SalesForecast != this)
     {
         __item.SalesForecast = this;
     }
 }
 public virtual void SetOrderForecastsAt(OrderForecast __item, int __index)
 {
     if (__item == null)
     {
         orderForecasts[__index].SalesForecast = null;
     }
     else
     {
         orderForecasts[__index] = __item;
         if (__item.SalesForecast != this)
         {
             __item.SalesForecast = this;
         }
     }
 }
 public virtual void AddAtIndexOrderForecasts(int index, OrderForecast __item)
 {
     if (__item == null)
     {
         return;
     }
     orderForecasts?.Insert(index, __item);
     disableInternalAdditions = true;
     try
     {
         if (__item.SalesForecast != this)
         {
             __item.SalesForecast = this;
         }
     }
     finally
     {
         disableInternalAdditions = false;
     }
 }
        public void SupplierParameter_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _orderproposal_orderforecast_supplierparameters = new DSS1_RetailerDriverStockOptimisation.BO.OrderForecast
            {
                ImportId  = 635,
                Status    = "OrderForecast_Status",
                CreatedBy = "OrderForecast_CreatedBy",
                CreatedOn = now,
                StartDate = now,
                EndDate   = now,
                State     = "OrderForecast_State",
            };
            var _orderproposal_agreement_supplierparameter = new DSS1_RetailerDriverStockOptimisation.BO.Agreement
            {
                FullTruckLoad       = true,
                AgreementDocument   = "Agreement_AgreementDocument",
                LeadTime            = "Agreement_LeadTime",
                DateCreated         = now,
                WDDeliveries        = true,
                TargetInventoryDays = 7034,
                Profile             = "Agreement_Profile",
            };

            new PersistenceSpecification <DSS1_RetailerDriverStockOptimisation.BO.SupplierParameter>(Session)
            .CheckProperty(p => p.CoverageDays, 169)
            .CheckProperty(p => p.SupplierCanDeliverWholeForecast, true)
            .CheckProperty(p => p.SupplierComments, "SupplierParameter_SupplierComments")
            .CheckProperty(p => p.HasReplied, true)
            .CheckProperty(p => p.SharesExcessStock, true)
            .CheckReference(p => p.OrderForecast, _orderproposal_orderforecast_supplierparameters)
            .CheckReference(p => p.Agreement, _orderproposal_agreement_supplierparameter)
            .VerifyTheMappings();
        }
Exemplo n.º 9
0
/// <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(OrderForecast compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }
Exemplo n.º 10
0
/// <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 [OrderForecast] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual OrderForecast Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, OrderForecast copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((OrderForecast)copiedObjects[this]);
            }
            copy = copy ?? new OrderForecast();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.ImportId  = this.ImportId;
            copy.Status    = this.Status;
            copy.CreatedBy = this.CreatedBy;
            copy.CreatedOn = this.CreatedOn;
            copy.StartDate = this.StartDate;
            copy.EndDate   = this.EndDate;
            copy.State     = this.State;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            copy.orderForecastDetails = new List <OrderForecastDetails>();
            if (deep && this.orderForecastDetails != null)
            {
                foreach (var __item in this.orderForecastDetails)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddOrderForecastDetails(__item);
                        }
                        else
                        {
                            copy.AddOrderForecastDetails(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddOrderForecastDetails((OrderForecastDetails)copiedObjects[__item]);
                    }
                }
            }
            if (deep && this.salesForecast != null)
            {
                if (!copiedObjects.Contains(this.salesForecast))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.SalesForecast = this.SalesForecast;
                    }
                    else if (asNew)
                    {
                        copy.SalesForecast = this.SalesForecast.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.salesForecast = this.salesForecast.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.SalesForecast = (SalesForecast)copiedObjects[this.SalesForecast];
                    }
                    else
                    {
                        copy.salesForecast = (SalesForecast)copiedObjects[this.SalesForecast];
                    }
                }
            }
            copy.supplierParameters = new List <SupplierParameter>();
            if (deep && this.supplierParameters != null)
            {
                foreach (var __item in this.supplierParameters)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddSupplierParameters(__item);
                        }
                        else
                        {
                            copy.AddSupplierParameters(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddSupplierParameters((SupplierParameter)copiedObjects[__item]);
                    }
                }
            }
            copy.itemParameters = new List <ItemParameter>();
            if (deep && this.itemParameters != null)
            {
                foreach (var __item in this.itemParameters)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddItemParameters(__item);
                        }
                        else
                        {
                            copy.AddItemParameters(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddItemParameters((ItemParameter)copiedObjects[__item]);
                    }
                }
            }
            return(copy);
        }
Exemplo n.º 11
0
        public void OrderForecastDetails_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _orderproposal_warehouse_replenishmentcycle = new DSS1_RetailerDriverStockOptimisation.BO.Warehouse
            {
                Code        = "Warehouse_Code",
                Description = "Warehouse_Description",
                FlowType    = "Warehouse_FlowType",
            };
            var _orderproposal_item_replenishmentcycle = new DSS1_RetailerDriverStockOptimisation.BO.Item
            {
                SKU              = "68e95eb3-1f57-4e61-82ab-c5eeff2484acItem_SKU",
                Description      = "Item_Description",
                UPC              = "Item_UPC",
                AvgDailyDemand   = 222222.22M,
                PalletSize       = 9931,
                SupplierPackSize = 8703,
                InnerPackSize    = 8448,
                PalletType       = "Item_PalletType",
                PalTI            = 3011,
                PalHI            = 5370,
                UOM              = "Item_UOM",
            };
            var _orderproposal_orderforecast_orderforecastdetails = new DSS1_RetailerDriverStockOptimisation.BO.OrderForecast
            {
                ImportId  = 9967,
                Status    = "OrderForecast_Status",
                CreatedBy = "OrderForecast_CreatedBy",
                CreatedOn = now,
                StartDate = now,
                EndDate   = now,
                State     = "OrderForecast_State",
            };
            var _orderproposal_notification_orderforecastdetails = new DSS1_RetailerDriverStockOptimisation.BO.Notification
            {
                Message               = "Notification_Message",
                TotalSupplierStock    = 8630,
                OrderForecastQuantity = 3921,
                Diff = 1087,
                SalesForecastDate = now,
                CreatedBy         = "Notification_CreatedBy",
            };
            var _orderproposal_comments_orderforecastdetails = new DSS1_RetailerDriverStockOptimisation.BO.Comment
            {
                Text    = "Comment_Text",
                AddedBy = "Comment_AddedBy",
            };
            var _orderproposal_comments_orderforecastdetails2 = new DSS1_RetailerDriverStockOptimisation.BO.Comment
            {
                Text    = "Comment_Text",
                AddedBy = "Comment_AddedBy",
            };

            new PersistenceSpecification <DSS1_RetailerDriverStockOptimisation.BO.OrderForecastDetails>(Session)
            .CheckProperty(p => p.ReplenishmentCycle, 8054)
            .CheckProperty(p => p.AutomatedForecast, 8786)
            .CheckProperty(p => p.Quantity, 2222222222.22222M)
            .CheckProperty(p => p.RecommendedOrderDate, now)
            .CheckProperty(p => p.SalesForecastDate, now)
            .CheckProperty(p => p.SupplierCanDeliver, true)
            .CheckProperty(p => p.SupplierMaxQuantity, 2222222222.22222M)
            .CheckProperty(p => p.SupplierCoverageDays, 9995)
            .CheckProperty(p => p.ItemCoverageDays, 1553)
            .CheckProperty(p => p.InitialStockLevel, 6286)
            .CheckProperty(p => p.SupplierAvailableQuantity, 6124)
            .CheckProperty(p => p.SupplierSharesStock, true)
            .CheckProperty(p => p.CreatedOn, now)
            .CheckProperty(p => p.Status, "OrderForecastDetails_Status")
            .CheckReference(p => p.Warehouse, _orderproposal_warehouse_replenishmentcycle)
            .CheckReference(p => p.Item, _orderproposal_item_replenishmentcycle)
            .CheckReference(p => p.OrderForecast, _orderproposal_orderforecast_orderforecastdetails)
            .CheckReference(p => p.Notification, _orderproposal_notification_orderforecastdetails)
            .CheckBag(p => p.Comments, (new List <DSS1_RetailerDriverStockOptimisation.BO.Comment>
            {
                _orderproposal_comments_orderforecastdetails,
                _orderproposal_comments_orderforecastdetails2
            }))
            .VerifyTheMappings();
        }