Ejemplo n.º 1
0
        public bool GetPeriodByNum(short iPeriodNum, out IBACalcPeriod objPeriod)
        {
            bool hr;

            objPeriod = null;
            if (m_PeriodCount == 0)
            {
                m_PeriodCount = m_helper.PeriodCount(this);
                m_PeriodInfo  = m_helper.PeriodInfo(this);
            }
            if (iPeriodNum > m_PeriodCount || iPeriodNum < 1)
            {
                throw new Exception("The specified period number is invalid.");
            }

            BAFASCalcPeriod obj = new BAFASCalcPeriod();

            obj.PeriodStart = (m_PeriodInfo[iPeriodNum - 1].dtStartDate);
            obj.PeriodEnd   = (m_PeriodInfo[iPeriodNum - 1].dtEndDate);
            obj.PeriodNum   = (m_PeriodInfo[iPeriodNum - 1].iPeriodNumber);
            obj.Weight      = (m_PeriodInfo[iPeriodNum - 1].iWeight);
            obj.IsIdle      = m_PeriodInfo[iPeriodNum - 1].IsIdle;
            objPeriod       = obj;


            return(true);
        }
Ejemplo n.º 2
0
        public bool GetPeriod(DateTime dtDate, out IBACalcPeriod objPeriod)
        {
            short i;

            dtDate = dtDate.Date;

            (objPeriod) = null;

            if (m_PeriodCount == 0)
            {
                m_PeriodCount = m_helper.PeriodCount(this);
                m_PeriodInfo  = m_helper.PeriodInfo(this);
            }

            for (i = 0; i < m_PeriodCount; i++)
            {
                if (dtDate >= m_PeriodInfo[i].dtStartDate && dtDate <= m_PeriodInfo[i].dtEndDate)
                {
                    BAFASCalcPeriod obj = new BAFASCalcPeriod();

                    obj.PeriodStart = (m_PeriodInfo[i].dtStartDate);
                    obj.PeriodEnd   = (m_PeriodInfo[i].dtEndDate);
                    obj.PeriodNum   = (m_PeriodInfo[i].iPeriodNumber);
                    obj.Weight      = (m_PeriodInfo[i].iWeight);
                    obj.IsIdle      = m_PeriodInfo[i].IsIdle;
                    objPeriod       = obj;
                    return(true);
                }
            }

            return(false);  // changed for performance  RDBJ 5/17/00
        }