Exemple #1
0
        /// <summary>
        /// Update Cost Records
        /// </summary>
        /// <param name="cost">cost</param>
        /// <returns>true if updated</returns>
        private bool Update(MCost cost)
        {
            bool updated = false;

            if (_SetFutureCostTo.Equals(_SetStandardCostTo))
            {
                Decimal costs = Utility.Util.GetValueOfDecimal(GetCosts(cost, _SetFutureCostTo));
                if (Env.Signum(costs) != 0)
                {
                    cost.SetFutureCostPrice(costs);
                    cost.SetCurrentCostPrice(costs);
                    updated = true;
                }
            }
            else
            {
                if (_SetStandardCostTo.Length > 0)
                {
                    Decimal costs = Utility.Util.GetValueOfDecimal(GetCosts(cost, _SetStandardCostTo));
                    if (Env.Signum(costs) != 0)
                    {
                        cost.SetCurrentCostPrice(costs);
                        updated = true;
                    }
                }
                if (_SetFutureCostTo.Length > 0)
                {
                    Decimal costs = Utility.Util.GetValueOfDecimal(GetCosts(cost, _SetFutureCostTo));
                    if (Env.Signum(costs) != 0)
                    {
                        cost.SetFutureCostPrice(costs);
                        updated = true;
                    }
                }
            }
            if (updated)
            {
                updated = cost.Save();
            }
            return(updated);
        }