Example #1
0
        public void SetTotalNPV1Stat1Attributes(NPV1Stat1 ind,
                                                string attNameExtension, ref XmlWriter writer)
        {
            bool bIsCostNode    = CalculatorHelpers.IsCostNode(this.CalcParameters.CurrentElementNodeName);
            bool bIsBenefitNode = CalculatorHelpers.IsBenefitNode(this.CalcParameters.CurrentElementNodeName);
            bool bIsBoth        = (bIsBenefitNode == false && bIsCostNode == false) ? true : false;

            if (bIsCostNode || bIsBoth)
            {
                writer.WriteAttributeString(
                    string.Concat(TCostN, attNameExtension), ind.TotalCostN.ToString("N2", CultureInfo.InvariantCulture));
                if (this.CalcParameters.CurrentElementNodeName.Contains(Input.INPUT_PRICE_TYPES.input.ToString()))
                {
                    //tamincent will be extra in prices
                    ind.SetAmortCosts2Attributes(attNameExtension, ref writer);
                    if (this.CalcParameters.SubApplicationType != Constants.SUBAPPLICATION_TYPES.inputprices)
                    {
                        //no stats for tech inputs, but show totals
                        ind.SetTotalCostsPsandQsAttributes(attNameExtension, ref writer);
                    }
                }
                else
                {
                    ind.SetAmortCosts2Attributes(attNameExtension, ref writer);
                    if (this.CalcParameters.SubApplicationType == Constants.SUBAPPLICATION_TYPES.budgets ||
                        this.CalcParameters.SubApplicationType == Constants.SUBAPPLICATION_TYPES.investments)
                    {
                        ind.SetAmortNets2Attributes(attNameExtension, ref writer);
                    }
                }
            }
            if (bIsBenefitNode || bIsBoth)
            {
                writer.WriteAttributeString(
                    string.Concat(TBenefitN, attNameExtension), ind.TotalBenefitN.ToString("N2", CultureInfo.InvariantCulture));
                //a few extra atts for prices
                ind.SetAmortBenefits2Attributes(attNameExtension, ref writer);
                ind.SetAmortBenefits2PsandQsAttributes(attNameExtension, ref writer);
            }
        }