public string GetTotalNPV1Stat1Property(NPV1Stat1 ind, string attName) { string sPropertyValue = string.Empty; sPropertyValue = ind.GetMeanBenefitsProperty(attName); sPropertyValue = ind.GetMeanCostsProperty(attName); sPropertyValue = ind.GetMedianBenefitsProperty(attName); sPropertyValue = ind.GetMedianCostsProperty(attName); sPropertyValue = ind.GetVarianceBenefitsProperty(attName); sPropertyValue = ind.GetVarianceCostsProperty(attName); sPropertyValue = ind.GetStdDevBenefitsProperty(attName); sPropertyValue = ind.GetStdDevCostsProperty(attName); switch (attName) { case TCostN: sPropertyValue = ind.TotalCostN.ToString(); break; case TBenefitN: sPropertyValue = ind.TotalBenefitN.ToString(); break; default: break; } return(sPropertyValue); }
public bool AddSubTotalToTotalStock(NPV1Stat1 totStock, double multiplier, NPV1Stat1 subTotal) { bool bHasCalculations = false; //all initial totals are added to calculator.Stat1 if (subTotal != null) { totStock.TotalAMOC += subTotal.TotalAMOC * multiplier; totStock.TotalAMAOH += subTotal.TotalAMAOH * multiplier; totStock.TotalAMCAP += subTotal.TotalAMCAP * multiplier; totStock.TotalAMINCENT += subTotal.TotalAMINCENT * multiplier; totStock.TotalAMTOTAL += subTotal.TotalAMTOTAL * multiplier; //benefits totStock.TotalAMR += subTotal.TotalAMR * multiplier; totStock.TotalAMRINCENT += subTotal.TotalAMRINCENT * multiplier; //nets totStock.TotalAMNET = totStock.TotalAMR - totStock.TotalAMTOTAL; totStock.TotalAMINCENT_NET = totStock.TotalAMRINCENT - totStock.TotalAMINCENT; //r ps and qs totStock.TotalRAmount += subTotal.TotalRAmount * multiplier; totStock.TotalRCompositionAmount += subTotal.TotalRCompositionAmount * multiplier; //don't adjust prices by multiplier totStock.TotalRPrice += subTotal.TotalRPrice; //display the r (ancestors of outs put name in first calc) if (!string.IsNullOrEmpty(subTotal.TotalRName)) { totStock.TotalRName = subTotal.TotalRName; totStock.TotalRUnit = subTotal.TotalRUnit; totStock.TotalRCompositionUnit = subTotal.TotalRCompositionUnit; } bHasCalculations = true; } return(bHasCalculations); }
public void SetTotalNPV1Stat1Property(NPV1Stat1 ind, string attName, string attValue) { ind.SetMeanBenefitsProperties(attName, attValue); ind.SetMeanCostsProperties(attName, attValue); ind.SetMedianBenefitsProperties(attName, attValue); ind.SetMedianCostsProperties(attName, attValue); ind.SetVarianceBenefitsProperties(attName, attValue); ind.SetVarianceCostsProperties(attName, attValue); ind.SetStdDevBenefitsProperties(attName, attValue); ind.SetStdDevCostsProperties(attName, attValue); switch (attName) { case TCostN: ind.TotalCostN = CalculatorHelpers.ConvertStringToDouble(attValue); break; case TBenefitN: ind.TotalBenefitN = CalculatorHelpers.ConvertStringToDouble(attValue); break; default: break; } }
public void CopyTotalNPV1Stat1RProperties(NPV1Stat1 calculator) { if (calculator != null) { this.CopyTotalBenefitsPsandQsProperties(calculator); } }
public void SetTotalNPV1Stat1Properties(NPV1Stat1 ind, string attNameExtension, XElement calculator) { ind.SetTotalBenefitsSummaryProperties(attNameExtension, calculator); ind.SetTotalCostsSummaryProperties(attNameExtension, calculator); ind.SetMeanBenefitsProperties(calculator); ind.SetMeanCostsProperties(calculator); ind.SetMedianBenefitsProperties(calculator); ind.SetMedianCostsProperties(calculator); ind.SetVarianceBenefitsProperties(calculator); ind.SetVarianceCostsProperties(calculator); ind.SetStdDevBenefitsProperties(calculator); ind.SetStdDevCostsProperties(calculator); ind.TotalCostN = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(TCostN, attNameExtension)); ind.TotalBenefitN = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(TBenefitN, attNameExtension)); }
public void InitTotalNPV1Stat1Properties(NPV1Stat1 ind) { ind.ErrorMessage = string.Empty; //includes summary data ind.InitTotalBenefitsProperties(); ind.InitTotalCostsProperties(); ind.InitMeanBenefitsProperties(); ind.InitMeanCostsProperties(); ind.InitMedianBenefitsProperties(); ind.InitMedianCostsProperties(); ind.InitStdDevBenefitsProperties(); ind.InitStdDevCostsProperties(); ind.InitVarianceBenefitsProperties(); ind.InitVarianceCostsProperties(); ind.TotalCostN = 0; ind.TotalBenefitN = 0; ind.CalcParameters = new CalculatorParameters(); }
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); } }
public void CopyTotalNPV1Stat1Properties(NPV1Stat1 ind, NPV1Stat1 calculator) { if (calculator != null) { //inits with standard cb totals ind.CopyCalculatorProperties(calculator); ind.CopyTotalBenefitsProperties(calculator); ind.CopyTotalCostsProperties(calculator); ind.ErrorMessage = calculator.ErrorMessage; ind.TotalCostN = calculator.TotalCostN; ind.TotalBenefitN = calculator.TotalBenefitN; ind.CopyMeanBenefitsProperties(calculator); ind.CopyMeanCostsProperties(calculator); ind.CopyMedianBenefitsProperties(calculator); ind.CopyMedianCostsProperties(calculator); ind.CopyVarianceBenefitsProperties(calculator); ind.CopyVarianceCostsProperties(calculator); ind.CopyStdDevBenefitsProperties(calculator); ind.CopyStdDevCostsProperties(calculator); ind.CopyMeanBenefitsProperties(calculator); ind.CopyMeanCostsProperties(calculator); if (calculator.CalcParameters == null) { calculator.CalcParameters = new CalculatorParameters(); } if (ind.CalcParameters == null) { ind.CalcParameters = new CalculatorParameters(); } ind.CalcParameters = new CalculatorParameters(calculator.CalcParameters); } }
//copy constructor public NPV1Stat1(NPV1Stat1 calculator) : base(calculator) { CopyTotalNPV1Stat1Properties(this, calculator); }