private void SerializeHealthCareOutputCalculations(CalculatorParameters calcParameters, List <HealthBenefit1Calculator> hcOutputs) { if (calcParameters.ParentOutcome.Outputs != null && hcOutputs != null) { foreach (Output output in calcParameters.ParentOutcome.Outputs) { if (output.AnnuityType == TimePeriod.ANNUITY_TYPES.none && output.XmlDocElement != null) { //this was set up when serialized HealthBenefit1Calculator hcOutput = hcOutputs.FirstOrDefault( f => f.CalculatorId == output.CalculatorId); if (hcOutput != null) { if (hcOutput.XmlDocElement != null) { XElement oHealtCareOutputElement = new XElement(hcOutput.XmlDocElement); XElement oOutputElement = new XElement(output.XmlDocElement); //serialize object back to xml using standard MachCalc1 pattern if (hcOutput.CalculatorType == HCCalculatorHelper.CALCULATOR_TYPES.hcbenefit1.ToString()) { string sAttNameExtension = string.Empty; hcOutput.SetAndRemoveCalculatorAttributes(sAttNameExtension, ref oHealtCareOutputElement); hcOutput.SetNewOutputAttributes(calcParameters, ref oHealtCareOutputElement); hcOutput.SetHealthBenefit1Attributes(sAttNameExtension, ref oHealtCareOutputElement); } //mark this linkedview as edited (GetCalculator uses it later) oHealtCareOutputElement.SetAttributeValue(CostBenefitStatistic01.TYPE_NEWCALCS, "true"); //update output agmach linkedview with new calcs oOutputElement = new XElement(output.XmlDocElement); CalculatorHelpers.ReplaceElementInDocument(oHealtCareOutputElement, ref oOutputElement); //update output with new prices and amounts output.XmlDocElement = oOutputElement; output.Price = hcOutput.Price; //tells calculators to swap out output being calculated with this one output.Type = CostBenefitCalculator.TYPE_NEWCALCS; } } } } } }