Beispiel #1
0
        public bool GetBusinessUse(DateTime fyEnd, ref double dBusinessUsePct, ref double dInvestmentUsePct)
        {
            FasBusinessUse lastBU = new FasBusinessUse();

            dBusinessUsePct   = 1.0;
            dInvestmentUsePct = 0.0;

            if (m_BusUseList == null)
            {
                return(true);
            }

            int count = m_BusUseList.Count;

            for (int i = count - 1; i >= 0; i--)
            {
                if (m_BusUseList[i].EffectiveDate <= fyEnd)
                {
                    dBusinessUsePct   = m_BusUseList[i].BusinessUsePercent;
                    dInvestmentUsePct = m_BusUseList[i].InvestmentUsePercent;
                    return(true);
                }
            }

            return(true);
        }
Beispiel #2
0
        public bool AddBusinessUseEntry(DateTime fyBegin, double dBusinessUsePct, double dInvestmentUsePct)
        {
            if (m_BusUseList == null)
            {
                throw new Exception("Business use list not initialized.");
            }

            FasBusinessUse buObj = new FasBusinessUse();

            buObj.EffectiveDate        = fyBegin;
            buObj.BusinessUsePercent   = dBusinessUsePct;
            buObj.InvestmentUsePercent = dInvestmentUsePct;

            int count = m_BusUseList.Count;

            //for (int i = 0; i < count; i++)
            //{
            //    if (m_BusUseList[i].EffectiveDate >= fyBegin)
            //        m_BusUseList.RemoveRange(i, count - 1);
            //}
            //m_BusUseList.Add(buObj);

            for (int i = 0; i < count; i++)
            {
                if (m_BusUseList[i].EffectiveDate > fyBegin)
                {
                    m_BusUseList.Insert(i, buObj);
                    return(true);
                }
                else if (m_BusUseList[i].EffectiveDate == fyBegin)
                {
                    m_BusUseList.RemoveAt(i);
                    m_BusUseList.Insert(i, buObj);
                    return(true);
                }
            }
            m_BusUseList.Add(buObj);

            return(true);
        }