Example #1
0
 public virtual void RemoveTurnoverStatistics(TurnoverStatistic __item)
 {
     if (__item != null)
     {
         InternalRemoveTurnoverStatistics(__item);
     }
 }
        public void Turnover_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _turnover_turnoverstatistics_turnover = new DSS5_SupplyChainFinancialsOptimisation.BO.TurnoverStatistic
            {
                TotalAmount       = 222222.22M,
                Year              = 9510,
                Month             = 3285,
                TotalAmountFunded = 222222.22M,
                TotalTransactions = 5261,
                TotalCreditNotes  = 4285,
                CNAmount          = 222222.22M,
            };
            var _turnover_turnoverstatistics_turnover2 = new DSS5_SupplyChainFinancialsOptimisation.BO.TurnoverStatistic
            {
                TotalAmount       = 222222.22M,
                Year              = 733,
                Month             = 4084,
                TotalAmountFunded = 222222.22M,
                TotalTransactions = 426,
                TotalCreditNotes  = 6252,
                CNAmount          = 222222.22M,
            };

            new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.Turnover>(Session)
            .CheckBag(p => p.TurnoverStatistics, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.TurnoverStatistic>
            {
                _turnover_turnoverstatistics_turnover,
                _turnover_turnoverstatistics_turnover2
            }))
            .VerifyTheMappings();
        }
Example #3
0
 public virtual void AddAtIndexTurnoverStatistics(int index, TurnoverStatistic __item)
 {
     if (__item == null)
     {
         return;
     }
     turnoverStatistics?.Insert(index, __item);
 }
Example #4
0
 public virtual void AddTurnoverStatistics(TurnoverStatistic __item)
 {
     if (__item == null)
     {
         return;
     }
     InternalAddTurnoverStatistics(__item);
 }
Example #5
0
 public virtual void InternalRemoveTurnoverStatistics(TurnoverStatistic __item)
 {
     if (__item == null)
     {
         return;
     }
     turnoverStatistics?.Remove(__item);
 }
Example #6
0
 public virtual void InternalAddTurnoverStatistics(TurnoverStatistic __item)
 {
     if (__item == null || disableInternalAdditions)
     {
         return;
     }
     turnoverStatistics?.Add(__item);
 }
Example #7
0
 public virtual void SetTurnoverStatisticsAt(TurnoverStatistic __item, int __index)
 {
     if (__item == null)
     {
         turnoverStatistics[__index] = null;
     }
     else
     {
         turnoverStatistics[__index] = __item;
     }
 }
/// <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(TurnoverStatistic 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 [TurnoverStatistic] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual TurnoverStatistic Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, TurnoverStatistic copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((TurnoverStatistic)copiedObjects[this]);
            }
            copy = copy ?? new TurnoverStatistic();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.TotalAmount       = this.TotalAmount;
            copy.Year              = this.Year;
            copy.Month             = this.Month;
            copy.TotalAmountFunded = this.TotalAmountFunded;
            copy.TotalTransactions = this.TotalTransactions;
            copy.TotalCreditNotes  = this.TotalCreditNotes;
            copy.CNAmount          = this.CNAmount;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.supplier != null)
            {
                if (!copiedObjects.Contains(this.supplier))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Supplier = this.Supplier;
                    }
                    else if (asNew)
                    {
                        copy.Supplier = this.Supplier.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.supplier = this.supplier.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Supplier = (Supplier)copiedObjects[this.Supplier];
                    }
                    else
                    {
                        copy.supplier = (Supplier)copiedObjects[this.Supplier];
                    }
                }
            }
            return(copy);
        }