DevTreks.Extensions/NPVCalculators/BIs/BICalculator.cs
/// <summary>
/// Add child nodes to new growth period nodes.
/// The growth period gets 1 component or operation, output, and input node added
/// </summary>
Add child nodes to new growth period nodes.
The growth period gets 1 component or operation, output, and input node added
Add child nodes to new growth period nodes . The growth period gets 1 component or operation output and input node added
public void AddGrowthInputChildren(CalculatorParameters calcParameters,
            string seriesType, string compName, int timeId,
            DateTime endOfGrowthPeriodDate, double timePrice1GPTotal,
            double timeInterest1GPTotal, double timePrice2GPTotal,
            double timeInterest2GPTotal, double timePrice3GPTotal,
            double timeInterest3GPTotal, double timePrice4GPTotal,
            double timeInterest4GPTotal, double timeAmort1GPTotal,
            double timeAmort1IntTotal, double timeAmort2GPTotal,
            double timeAmort2IntTotal, double timeAmort3GPTotal,
            double timeAmort3IntTotal)
        {
            calcParameters.ParentOperationComponent = new OperationComponent();
            Input newInput = new Input();
            int iCompAEId = INT_SEED;
            int iInputAEId = INT_SEED;
            iInputAEId = CalculatorHelpers.GetRandomInteger(calcParameters);
            iCompAEId = CalculatorHelpers.GetRandomInteger(calcParameters);
            calcParameters.ParentOperationComponent.AnnuityType = TimePeriod.ANNUITY_TYPES.regular;
            calcParameters.ParentOperationComponent.Id = iCompAEId;
            calcParameters.ParentOperationComponent.Name = compName;
            calcParameters.ParentOperationComponent.EffectiveLife = 1;
            calcParameters.ParentOperationComponent.SalvageValue = 0;
            calcParameters.ParentOperationComponent.Unit = seriesType;
            calcParameters.ParentOperationComponent.TotalAMOC = timeAmort1GPTotal + timeAmort1IntTotal;
            calcParameters.ParentOperationComponent.TotalAMAOH = timeAmort2GPTotal + timeAmort2IntTotal;
            calcParameters.ParentOperationComponent.TotalAMCAP = timeAmort3GPTotal + timeAmort3IntTotal;
            calcParameters.ParentOperationComponent.TotalAMOC_INT = timeAmort1IntTotal;
            calcParameters.ParentOperationComponent.TotalAMAOH_INT = timeAmort2IntTotal;
            calcParameters.ParentOperationComponent.TotalAMCAP_INT = timeAmort3IntTotal;
            calcParameters.ParentOperationComponent.TotalOC = timePrice1GPTotal + timeInterest1GPTotal;
            calcParameters.ParentOperationComponent.TotalAOH = timePrice2GPTotal + timeInterest2GPTotal;
            calcParameters.ParentOperationComponent.TotalCAP = timePrice3GPTotal + timeInterest3GPTotal;
            calcParameters.ParentOperationComponent.TotalOC_INT = timeInterest1GPTotal;
            calcParameters.ParentOperationComponent.TotalAOH_INT = timeInterest2GPTotal;
            calcParameters.ParentOperationComponent.TotalCAP_INT = timeInterest3GPTotal;
            calcParameters.ParentOperationComponent.Amount = 1;
            calcParameters.ParentOperationComponent.Date = endOfGrowthPeriodDate;
            calcParameters.ParentOperationComponent.IncentiveRate = 0;
            calcParameters.ParentOperationComponent.IncentiveAmount = 0;
            iInputAEId = CalculatorHelpers.GetRandomInteger(calcParameters);
            newInput.AnnuityType = TimePeriod.ANNUITY_TYPES.regular;
            newInput.Id = iInputAEId;
            newInput.Name = Errors.MakeStandardErrorMsg("CALCULATOR_SEELAST_PERIOD");
            newInput.Label = BudgetInvestment.ANNUITY;
            newInput.AOHAmount = 1;
            newInput.AOHPrice = timePrice2GPTotal;
            newInput.AOHUnit = seriesType;
            newInput.Date = endOfGrowthPeriodDate;
            newInput.TotalAMOC = timeAmort1GPTotal;
            newInput.TotalAMAOH = timeAmort2GPTotal;
            newInput.TotalAMCAP = timeAmort3GPTotal;
            newInput.TotalAMOC_INT = timeAmort1IntTotal;
            newInput.TotalAMAOH_INT = timeAmort2IntTotal;
            newInput.TotalAMCAP_INT = timeAmort3IntTotal;
            newInput.TotalOC = timePrice1GPTotal;
            newInput.TotalAOH = timePrice2GPTotal;
            newInput.TotalCAP = timePrice3GPTotal;
            newInput.TotalOC_INT = timeInterest1GPTotal;
            newInput.TotalAOH_INT = timeInterest2GPTotal;
            newInput.TotalCAP_INT = timeInterest3GPTotal;
            newInput.CAPAmount = 0;
            newInput.CAPPrice = timePrice3GPTotal;
            newInput.OCAmount = 0;
            newInput.OCPrice = timePrice1GPTotal;
            newInput.OCUnit = seriesType;
            newInput.CAPUnit = seriesType;
            newInput.UseAOH = false;
            newInput.Times = 1;
            newInput.InputGroupId = (int)TimePeriod.ANNUITY_TYPES.regular;
            newInput.InputGroupName = seriesType;
            newInput.TypeId = (int)TimePeriod.ANNUITY_TYPES.regular;
            newInput.Name = seriesType;
            if (calcParameters.ParentOperationComponent.Inputs == null)
                calcParameters.ParentOperationComponent.Inputs = new List<Input>();
            calcParameters.ParentOperationComponent.Inputs.Add(newInput);
            if (calcParameters.ParentTimePeriod.OperationComponents == null)
                calcParameters.ParentTimePeriod.OperationComponents
                    = new List<OperationComponent>();
            calcParameters.ParentTimePeriod.OperationComponents.Add(calcParameters.ParentOperationComponent);
        }
public void AddGrowthInputChildren ( CalculatorParameters calcParameters , string seriesType , string compName , int timeId , DateTime endOfGrowthPeriodDate , double timePrice1GPTotal , double timeInterest1GPTotal , double timePrice2GPTotal , double timeInterest2GPTotal , double timePrice3GPTotal , double timeInterest3GPTotal , double timePrice4GPTotal , double timeInterest4GPTotal , double timeAmort1GPTotal , double timeAmort1IntTotal , double timeAmort2GPTotal , double timeAmort2IntTotal , double timeAmort3GPTotal , double timeAmort3IntTotal ) { calcParameters . ParentOperationComponent = new OperationComponent ( ) ; Input newInput = new Input ( ) ; int iCompAEId = INT_SEED ; int iInputAEId = INT_SEED ; iInputAEId = CalculatorHelpers . GetRandomInteger ( calcParameters ) ; iCompAEId = CalculatorHelpers . GetRandomInteger ( calcParameters ) ; calcParameters . ParentOperationComponent . AnnuityType = TimePeriod . ANNUITY_TYPES . regular ; calcParameters . ParentOperationComponent . Id = iCompAEId ; calcParameters . ParentOperationComponent . Name = compName ; calcParameters . ParentOperationComponent . EffectiveLife = 1 ; calcParameters . ParentOperationComponent . SalvageValue = 0 ; calcParameters . ParentOperationComponent . Unit = seriesType ; calcParameters . ParentOperationComponent . TotalAMOC = timeAmort1GPTotal + timeAmort1IntTotal ; calcParameters . ParentOperationComponent . TotalAMAOH = timeAmort2GPTotal + timeAmort2IntTotal ; calcParameters . ParentOperationComponent . TotalAMCAP = timeAmort3GPTotal + timeAmort3IntTotal ; calcParameters . ParentOperationComponent . TotalAMOC_INT = timeAmort1IntTotal ; calcParameters . ParentOperationComponent . TotalAMAOH_INT = timeAmort2IntTotal ; calcParameters . ParentOperationComponent . TotalAMCAP_INT = timeAmort3IntTotal ; calcParameters . ParentOperationComponent . TotalOC = timePrice1GPTotal + timeInterest1GPTotal ; calcParameters . ParentOperationComponent . TotalAOH = timePrice2GPTotal + timeInterest2GPTotal ; calcParameters . ParentOperationComponent . TotalCAP = timePrice3GPTotal + timeInterest3GPTotal ; calcParameters . ParentOperationComponent . TotalOC_INT = timeInterest1GPTotal ; calcParameters . ParentOperationComponent . TotalAOH_INT = timeInterest2GPTotal ; calcParameters . ParentOperationComponent . TotalCAP_INT = timeInterest3GPTotal ; calcParameters . ParentOperationComponent . Amount = 1 ; calcParameters . ParentOperationComponent . Date = endOfGrowthPeriodDate ; calcParameters . ParentOperationComponent . IncentiveRate = 0 ; calcParameters . ParentOperationComponent . IncentiveAmount = 0 ; iInputAEId = CalculatorHelpers . GetRandomInteger ( calcParameters ) ; newInput . AnnuityType = TimePeriod . ANNUITY_TYPES . regular ; newInput . Id = iInputAEId ; newInput . Name = Errors . MakeStandardErrorMsg ( " " ) ; newInput . Label = BudgetInvestment . ANNUITY ; newInput . AOHAmount = 1 ; newInput . AOHPrice = timePrice2GPTotal ; newInput . AOHUnit = seriesType ; newInput . Date = endOfGrowthPeriodDate ; newInput . TotalAMOC = timeAmort1GPTotal ; newInput . TotalAMAOH = timeAmort2GPTotal ; newInput . TotalAMCAP = timeAmort3GPTotal ; newInput . TotalAMOC_INT = timeAmort1IntTotal ; newInput . TotalAMAOH_INT = timeAmort2IntTotal ; newInput . TotalAMCAP_INT = timeAmort3IntTotal ; newInput . TotalOC = timePrice1GPTotal ; newInput . TotalAOH = timePrice2GPTotal ; newInput . TotalCAP = timePrice3GPTotal ; newInput . TotalOC_INT = timeInterest1GPTotal ; newInput . TotalAOH_INT = timeInterest2GPTotal ; newInput . TotalCAP_INT = timeInterest3GPTotal ; newInput . CAPAmount = 0 ; newInput . CAPPrice = timePrice3GPTotal ; newInput . OCAmount = 0 ; newInput . OCPrice = timePrice1GPTotal ; newInput . OCUnit = seriesType ; newInput . CAPUnit = seriesType ; newInput . UseAOH = false ; newInput . Times = 1 ; newInput . InputGroupId = ( int ) TimePeriod . ANNUITY_TYPES . regular ; newInput . InputGroupName = seriesType ; newInput . TypeId = ( int ) TimePeriod . ANNUITY_TYPES . regular ; newInput . Name = seriesType ; if ( calcParameters . ParentOperationComponent . Inputs == null ) calcParameters . ParentOperationComponent . Inputs = new List < Input > ( ) ; calcParameters . ParentOperationComponent . Inputs . Add ( newInput ) ; if ( calcParameters . ParentTimePeriod . OperationComponents == null ) calcParameters . ParentTimePeriod . OperationComponents = new List < OperationComponent > ( ) ; calcParameters . ParentTimePeriod . OperationComponents . Add ( calcParameters . ParentOperationComponent ) ; }
Add child nodes to new growth period nodes.
Add child nodes to new growth period nodes .
//use ancestor objects for accumulating totals //note: interest has already been added to the totals for display //note: interest has already been added to the totals for display //set the attributes //the sum being amortized - for display only //note: interest has already been added to the totals for display //opcomp already has totals //add cumulative totals
calcParameters
CalculatorParameters
<not_specific>
seriesType
string
<not_specific>
compName
string
<not_specific>
timeId
int
<not_specific>
endOfGrowthPeriodDate
DateTime
<not_specific>
timePrice1GPTotal
double
<not_specific>
timeInterest1GPTotal
double
<not_specific>
timePrice2GPTotal
double
<not_specific>
timeInterest2GPTotal
double
<not_specific>
timePrice3GPTotal
double
<not_specific>
timeInterest3GPTotal
double
<not_specific>
timePrice4GPTotal
double
<not_specific>
timeInterest4GPTotal
double
<not_specific>
timeAmort1GPTotal
double
<not_specific>
timeAmort1IntTotal
double
<not_specific>
timeAmort2GPTotal
double
<not_specific>
timeAmort2IntTotal
double
<not_specific>
timeAmort3GPTotal
double
<not_specific>
timeAmort3IntTotal
double
<not_specific>