private List <HealthBenefit1Calculator> GetHealthCareOutputs(CalculatorParameters calcParameters) { List <HealthBenefit1Calculator> hcOutputs = new List <HealthBenefit1Calculator>(); foreach (Output output in calcParameters.ParentOutcome.Outputs) { if (output.AnnuityType == TimePeriod.ANNUITY_TYPES.none && output.XmlDocElement != null) { //0.9.0 stays consistent across all apps by using standard calc patterns if (output.XmlDocElement.HasElements) { XElement oOutputElement = new XElement(output.XmlDocElement); //set the output atts Output.SetOutputAllAttributes(output, ref oOutputElement); string sCalculatorType = CalculatorHelpers.GetCalculatorType(oOutputElement); XElement oHealthCareOutputElement = GetHealthCareCalculator(calcParameters, sCalculatorType, oOutputElement); if (oHealthCareOutputElement != null && oOutputElement != null) { string sErrorMsg = string.Empty; bool bHasThisCalculations = false; sCalculatorType = CalculatorHelpers.GetCalculatorType(oHealthCareOutputElement); if (sCalculatorType == HCCalculatorHelper.CALCULATOR_TYPES.hcbenefit1.ToString()) { string sAttNameExtension = string.Empty; HealthBenefit1Calculator hcOutput = new HealthBenefit1Calculator(); //serialize in same manner as OutputHCStockCalculator hcOutput.SetOutputProperties(calcParameters, oHealthCareOutputElement, oOutputElement); hcOutput.SetHealthBenefit1Properties(oHealthCareOutputElement); OutputHCStockCalculator hcCalculator = new OutputHCStockCalculator(); bHasThisCalculations = hcCalculator.RunHCStockCalculations(hcOutput, calcParameters); //store the new calculations hcOutput.XmlDocElement = oHealthCareOutputElement; calcParameters.ErrorMessage = sErrorMsg; //they need to find one another when serializing output.CalculatorId = hcOutput.CalculatorId; hcOutputs.Add(hcOutput); } } } } } return(hcOutputs); }
public bool AddCalculationsToCurrentElement( CalculatorParameters calcParameters, XElement currentCalculationsElement, XElement currentElement, IDictionary <string, string> updates) { bool bHasCalculations = false; if (currentElement.Name.LocalName == Output.OUTPUT_PRICE_TYPES.outputgroup.ToString() && calcParameters.ExtensionDocToCalcURI.URINodeName != Constants.LINKEDVIEWS_TYPES.linkedview.ToString()) { bHasCalculations = BIHC1Calculator.SetTotalHCStockCalculations( currentCalculationsElement, currentElement); } else { if (currentCalculationsElement != null) { HealthBenefit1Calculator healthCostOutput = new HealthBenefit1Calculator(); //deserialize xml to object healthCostOutput.SetHealthBenefit1Properties(calcParameters, currentCalculationsElement, currentElement); //init analyzer props healthCostOutput.SetCalculatorProperties(currentCalculationsElement); //run the calculations bHasCalculations = RunHCStockCalculations(healthCostOutput, calcParameters); //serialize object back to xml string sAttNameExtension = string.Empty; //bool bRemoveAtts = false; //note that unlike other IOAnalyzers, this runs the input calc too //and must update input props to calculated results (OCAmount and OCPrice calcs) //also note that if input analyzers are needed, probably want to use BIHCStockCalcor //so that does not update input db props and keeps consistent pattern healthCostOutput.SetOutputAttributes(calcParameters, currentElement, updates); //update the calculator attributes healthCostOutput.SetAndRemoveCalculatorAttributes(sAttNameExtension, currentCalculationsElement); healthCostOutput.SetNewOutputAttributes(calcParameters, currentCalculationsElement); healthCostOutput.SetHealthBenefit1Attributes(sAttNameExtension, currentCalculationsElement); //set calculatorid (primary way to display calculation attributes) CalculatorHelpers.SetCalculatorId( currentCalculationsElement, currentElement); //input groups only aggregate inputs (not input series) if (currentElement.Name.LocalName .Contains(Output.OUTPUT_PRICE_TYPES.output.ToString())) { //add the machinery to the machstock.machstocks dictionary //the count is 1-based, while iNodePosition is 0-based //so the count is the correct next index position int iNodePosition = BIHC1Calculator.OutputHCStock .GetNodePositionCount(calcParameters.AnalyzerParms.FilePositionIndex, healthCostOutput); if (iNodePosition < 0) { iNodePosition = 0; } bHasCalculations = BIHC1Calculator.OutputHCStock .AddOutputHCStocksToDictionary( calcParameters.AnalyzerParms.FilePositionIndex, iNodePosition, healthCostOutput); } } } return(bHasCalculations); }