public static void SetOutputAllAttributes(Output output, XElement elementNeedingAttributes) { CalculatorHelpers.SetAttributeInt(elementNeedingAttributes, Calculator1.cId, output.Id); CalculatorHelpers.SetAttribute(elementNeedingAttributes, Calculator1.cName, output.Name.ToString()); CalculatorHelpers.SetAttribute(elementNeedingAttributes, Calculator1.cDescription, output.Description.ToString()); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, OUTPUT_AMOUNT, output.Amount); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, OUTPUT_PRICE, output.Price); CalculatorHelpers.SetAttribute(elementNeedingAttributes, OUTPUT_BASE_UNIT, output.Unit); CalculatorHelpers.SetAttributeDateS(elementNeedingAttributes, OUTPUT_DATE, output.Date); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, COMPOSITION_AMOUNT, output.CompositionAmount); CalculatorHelpers.SetAttribute(elementNeedingAttributes, COMPOSITION_UNIT, output.CompositionUnit); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, OUTPUT_TIMES, output.Times); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.General.INCENTIVE_AMOUNT, output.IncentiveAmount); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.General.INCENTIVE_RATE, output.IncentiveRate); CalculatorHelpers.SetAttributeInt(elementNeedingAttributes, DataAppHelpers.Prices.OUTPUT_GROUP_ID, output.OutputGroupId); CalculatorHelpers.SetAttribute(elementNeedingAttributes, DataAppHelpers.Prices.OUTPUT_GROUP_NAME, output.OutputGroupName); }
public virtual void SetTotalSubPrice3StockAttributes(SubPrice3Stock ind, string attNameExtension, XElement calculator) { CalculatorHelpers.SetAttribute(calculator, string.Concat(cTotalInd1Description, attNameExtension), ind.TotalInd1Description); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTotalInd1RiskType, attNameExtension), ind.TotalInd1RiskType); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTotalInd1Name, attNameExtension), ind.TotalInd1Name); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTotalInd1Label, attNameExtension), ind.TotalInd1Label); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cTotalInd1Total, attNameExtension), ind.TotalInd1Total); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cTotalInd1BM, attNameExtension), ind.TotalInd1BM); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cTotalInd1BMProg, attNameExtension), ind.TotalInd1BMProg); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTotalInd1Unit, attNameExtension), ind.TotalInd1Unit); //CalculatorHelpers.SetAttributeDateS(calculator, // string.Concat(cInd1PTDate, attNameExtension), ind.SubP1PTDate); //CalculatorHelpers.SetAttributeDateS(calculator, // string.Concat(cInd1YTDDate, attNameExtension), ind.SubP1YTDDate); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cTotalInd1PartTarget, attNameExtension), ind.TotalInd1PartTarget); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cTotalInd1FullTarget, attNameExtension), ind.TotalInd1FullTarget); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cTotalInd1PTProg, attNameExtension), ind.TotalInd1PTProg); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cTotalInd1FTProg, attNameExtension), ind.TotalInd1FTProg); }
//serialize regular input properties public void SetNewInputAttributes(CalculatorParameters calcParameters, ref XElement elementNeedingAttributes) { CalculatorHelpers.SetAttributeDateS(elementNeedingAttributes, DataAppHelpers.Prices.INPUT_DATE, this.Date); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.OC_AMOUNT, this.OCAmount); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.OC_PRICE, this.OCPrice); CalculatorHelpers.SetAttribute(elementNeedingAttributes, DataAppHelpers.Prices.OC_UNIT, this.OCUnit); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.AOH_AMOUNT, this.AOHAmount); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.AOH_PRICE, this.AOHPrice); CalculatorHelpers.SetAttribute(elementNeedingAttributes, DataAppHelpers.Prices.AOH_UNIT, this.AOHUnit); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.CAP_AMOUNT, this.CAPAmount); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.CAP_PRICE, this.CAPPrice); CalculatorHelpers.SetAttribute(elementNeedingAttributes, DataAppHelpers.Prices.CAP_UNIT, this.CAPUnit); CalculatorHelpers.SetAttribute(elementNeedingAttributes, DataAppHelpers.Economics1.ANNUITY_TYPE, this.AnnuityType.ToString()); if (this.Local != null) { //locals only for calculator this.Local.SetLocalAttributesForCalculator(calcParameters, ref elementNeedingAttributes); } }
public void SetLCB1Attributes(string attNameExtension, XElement calculator) { //must remove old unwanted attributes if (calculator != null) { //do not remove atts here, they were removed in prior this.LCCOutput.SetOutputAtts //and now include good locals //this also sets the aggregating atts this.SetAndRemoveCalculatorAttributes(attNameExtension, calculator); } this.SetSubPrice1sAttributes(calculator); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cServiceLifeYears, attNameExtension), this.ServiceLifeYears); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cYearsFromBaseDate, attNameExtension), this.YearsFromBaseDate); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cPlanningConstructionYears, attNameExtension), this.PlanningConstructionYears); CalculatorHelpers.SetAttributeDoubleF3(calculator, string.Concat(cPerUnitAmount, attNameExtension), this.PerUnitAmount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cPerUnitUnit, attNameExtension), this.PerUnitUnit); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cRTotalBenefit, attNameExtension), this.RTotalBenefit); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cLCBTotalBenefit, attNameExtension), this.LCBTotalBenefit); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cEAATotalBenefit, attNameExtension), this.EAATotalBenefit); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cUnitTotalBenefit, attNameExtension), this.UnitTotalBenefit); }
public void SetTimelinessOC1Attributes(string attNameExtension, XElement currentCalculationsElement) { //don't set any input attributes; each calculator should set what's needed separately CalculatorHelpers.SetAttributeDateS(currentCalculationsElement, string.Concat(cPlannedStartDate, attNameExtension), this.PlannedStartDate); CalculatorHelpers.SetAttributeDateS(currentCalculationsElement, string.Concat(cActualStartDate, attNameExtension), this.ActualStartDate); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cLaborAvailable, attNameExtension), this.LaborAvailable); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cWorkdayProbability, attNameExtension), this.WorkdayProbability); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cTimelinessPenalty1, attNameExtension), this.TimelinessPenalty1); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cTimelinessPenaltyDaysFromStart1, attNameExtension), this.TimelinessPenaltyDaysFromStart1); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cTimelinessPenalty2, attNameExtension), this.TimelinessPenalty2); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cTimelinessPenaltyDaysFromStart2, attNameExtension), this.TimelinessPenaltyDaysFromStart2); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cWorkdaysLimit, attNameExtension), this.WorkdaysLimit); //child power input ocamount CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cFieldCapacity, attNameExtension), this.FieldCapacity); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cAreaCovered, attNameExtension), this.AreaCovered); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cFieldDays, attNameExtension), this.FieldDays); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cOutputName, attNameExtension), this.OutputName); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cOutputUnit, attNameExtension), this.OutputUnit); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cOutputPrice, attNameExtension), this.OutputPrice); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cOutputYield, attNameExtension), this.OutputYield); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cCompositionUnit, attNameExtension), this.CompositionUnit); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cCompositionAmount, attNameExtension), this.CompositionAmount); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cOutputTimes, attNameExtension), this.OutputTimes); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cProbableFieldDays, attNameExtension), this.ProbableFieldDays); CalculatorHelpers.SetAttributeDateS(currentCalculationsElement, string.Concat(cProbableFinishDate, attNameExtension), this.ProbableFinishDate); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cTimelinessPenaltyCost, attNameExtension), this.TimelinessPenaltyCost); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cTimelinessPenaltyCostPerHour, attNameExtension), this.TimelinessPenaltyCostPerHour); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(CostBenefitCalculator.TR, attNameExtension), this.TotalR); }
public void SetIndicatorT1Attributes(string attNameExtension, XElement calculator) { CalculatorHelpers.SetAttribute(calculator, string.Concat(cIT1NodeType, attNameExtension), this.IT1NodeType); CalculatorHelpers.SetAttribute(calculator, string.Concat(cIT1CalcName, attNameExtension), this.IT1CalcName); CalculatorHelpers.SetAttribute(calculator, string.Concat(cIT1PropertyName, attNameExtension), this.IT1PropertyName); }
//serialize regular properties public void SetNewGroupAttributes( XElement elementNeedingAttributes) { this.SetSharedObjectAttributes(string.Empty, elementNeedingAttributes); this.SetTotalCostsAttributes(string.Empty, elementNeedingAttributes); CalculatorHelpers.SetAttributeInt(elementNeedingAttributes, DataAppHelpers.Agreement.SERVICE_ID, this.ServiceId); CalculatorHelpers.SetAttribute(elementNeedingAttributes, DataAppHelpers.General.DOC_STATUS, this.DocStatus); }
public virtual void SetMachinery1InputAttributes(string attNameExtension, ref XElement calculator) { CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cMarketValue, attNameExtension), this.MarketValue); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cListPriceAdj, attNameExtension), this.ListPriceAdj); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSalvageValue, attNameExtension), this.SalvageValue); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cFuelAmount, attNameExtension), this.FuelAmount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cFuelUnit, attNameExtension), this.FuelUnit); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cFuelPrice, attNameExtension), this.FuelPrice); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cFuelCost, attNameExtension), this.FuelCost); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cLubeOilAmount, attNameExtension), this.LubeOilAmount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cLubeOilUnit, attNameExtension), this.LubeOilUnit); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cLubeOilPrice, attNameExtension), this.LubeOilPrice); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cLubeOilCost, attNameExtension), this.LubeOilCost); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cRepairCost, attNameExtension), this.RepairCost); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cLaborAmount, attNameExtension), this.LaborAmount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cLaborUnit, attNameExtension), this.LaborUnit); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cLaborPrice, attNameExtension), this.LaborPrice); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cLaborCost, attNameExtension), this.LaborCost); CalculatorHelpers.SetAttribute(calculator, string.Concat(cServiceUnits, attNameExtension), this.ServiceUnits); CalculatorHelpers.SetAttribute(calculator, string.Concat(cServiceCapacityUnits, attNameExtension), this.ServiceCapacityUnits); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cCapitalRecoveryCost, attNameExtension), this.CapitalRecoveryCost); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cTaxesHousingInsuranceCost, attNameExtension), this.TaxesHousingInsuranceCost); CalculatorHelpers.SetAttributeInt(calculator, string.Concat(cOptionForCapacity, attNameExtension), this.OptionForCapacity); CalculatorHelpers.SetAttributeInt(calculator, string.Concat(cOptionForInflation, attNameExtension), this.OptionForInflation); CalculatorHelpers.SetAttributeInt(calculator, string.Concat(cOptionForTime, attNameExtension), this.OptionForTime); CalculatorHelpers.SetAttributeInt(calculator, string.Concat(cOptionForFuel, attNameExtension), this.OptionForFuel); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cLaborAmountAdj, attNameExtension), this.LaborAmountAdj); }
public void SetTimelinessBaseAttributes(string attNameExtension, XElement currentCalculationsElement) { //need some base props to be displayed in calculator //opcomp.amount CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(Constants.AMOUNT, attNameExtension), this.Amount); //opcomp.unit CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(Constants.UNIT, attNameExtension), this.Unit); }
private void SetSubPrice3Attributes(SubPrice3 subP, string attNameExtension, ref XElement calculator) { //remember that the calculator inheriting from this class must set id and name atts //and remove unwanted old atts i.e. this.SetCalculatorAttributes(calculator); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPName, attNameExtension), subP.SubPName); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPDescription, attNameExtension), subP.SubPDescription); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPLabel, attNameExtension), subP.SubPLabel); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPType, attNameExtension), subP.SubPType); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPAltType, attNameExtension), subP.SubPAltType); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPFactor, attNameExtension), subP.SubPFactor); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPYears, attNameExtension), subP.SubPYears); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPAmount, attNameExtension), subP.SubPAmount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPUnit, attNameExtension), subP.SubPUnit); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPPrice, attNameExtension), subP.SubPPrice); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPEscRate, attNameExtension), subP.SubPEscRate); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPEscType, attNameExtension), subP.SubPEscType); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPTotal, attNameExtension), subP.SubPTotal); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPTotalPerUnit, attNameExtension), subP.SubPTotalPerUnit); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPDistType, attNameExtension), subP.SubPDistType); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPAmountB, attNameExtension), subP.SubPAmountB); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPPriceB, attNameExtension), subP.SubPPriceB); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPEscRateB, attNameExtension), subP.SubPEscRateB); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPTotalB, attNameExtension), subP.SubPTotalB); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPAmountC, attNameExtension), subP.SubPAmountC); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPPriceC, attNameExtension), subP.SubPPriceC); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPEscRateC, attNameExtension), subP.SubPEscRateC); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPTotalC, attNameExtension), subP.SubPTotalC); }
private void SetStylesheetNamespace() { string sStylesheetExtObjNamespace = GetCalculatorStyleSheetExtObjNamespace(); string sExistingStylesheetExtObjNamespace = CalculatorHelpers.GetAttribute(this.MN1CalculatorParams.LinkedViewElement, Calculator1.cStylesheet2ObjectNS); if ((string.IsNullOrEmpty(sExistingStylesheetExtObjNamespace)) || (!sExistingStylesheetExtObjNamespace.Equals(sStylesheetExtObjNamespace))) { CalculatorHelpers.SetAttribute(this.MN1CalculatorParams.LinkedViewElement, Calculator1.cStylesheet2ObjectNS, sStylesheetExtObjNamespace); } }
public void SetDemog3Attributes(string attNameExtension, ref XElement currentCalculationsElement) { //don't set any input attributes; each calculator should set what's needed separately CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cHousing, attNameExtension), this.Housing); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cWorkStatus, attNameExtension), this.WorkStatus); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cMaritalStatus, attNameExtension), this.MaritalStatus); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cLocationId, attNameExtension), this.LocationId); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cFamilyIncomeCurrency, attNameExtension), this.FamilyIncomeCurrency); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, string.Concat(cFamilyIncomePerYear, attNameExtension), this.FamilyIncomePerYear); }
//growth periods and other new tps that don't affect db public void SetNewTimePeriodAttributes(CalculatorParameters calcParameters, ref XElement currentCalculationsElement, ref XElement currentElement, IDictionary<string, string> updates) { CalculatorHelpers.SetAttribute(currentElement, DataAppHelpers.General.NAME2, this.Name2); if (currentElement.Name.LocalName.StartsWith( DataAppHelpers.Economics1.BUDGET_TYPES.budget.ToString())) { CalculatorHelpers.SetAttributeDoubleF4(currentElement, DataAppHelpers.Economics1.BUDGET_TPENTERPRISE_AMOUNT, this.Amount); } else { CalculatorHelpers.SetAttributeDoubleF4(currentElement, DataAppHelpers.Economics1.INVEST_TPENTERPRISE_AMOUNT, this.Amount); } CalculatorHelpers.SetAttributeDateS(currentElement, Calculator1.cDate, this.Date); CalculatorHelpers.SetAttribute(currentElement, DataAppHelpers.General.UNIT, this.Unit); CalculatorHelpers.SetAttributeBool(currentElement, DataAppHelpers.Economics1.ISDISCOUNTED, this.IsDiscounted); CalculatorHelpers.SetAttributeBool(currentElement, DataAppHelpers.Economics1.ISCOMMON_REFERENCE, this.IsCommonReference); CalculatorHelpers.SetAttributeInt(currentElement, DataAppHelpers.Economics1.GROWTH_PERIODS, this.GrowthPeriods); CalculatorHelpers.SetAttributeInt(currentElement, DataAppHelpers.Economics1.GROWTH_TYPE_ID, this.GrowthTypeId); CalculatorHelpers.SetAttributeDoubleF4(currentElement, DataAppHelpers.Economics1.OVERHEAD_FACTOR, this.OverheadFactor); CalculatorHelpers.SetAttributeDoubleF4(currentElement, DataAppHelpers.General.INCENTIVE_AMOUNT, this.IncentiveAmount); CalculatorHelpers.SetAttributeDoubleF4(currentElement, DataAppHelpers.General.INCENTIVE_RATE, this.IncentiveRate); CalculatorHelpers.SetAttribute(currentElement, DataAppHelpers.Economics1.ANNUITY_TYPE, this.AnnuityType.ToString()); //any outcome annuities on hand are serialized using: AddOutcomesToTimePeriod(calcParameters, this.Outcomes, currentCalculationsElement, ref currentElement); //any opcomp annuities on hand are serialized using: AddOpCompsToTimePeriod(calcParameters, this.OperationComponents, currentCalculationsElement, ref currentElement); }
public void SetSubPrice1Attributes(SubPrice1 subP, string attNameExtension, ref XElement calculator) { //don't needlessly add these to linkedviews if they are not being used if (subP.SubPName != string.Empty && subP.SubPName != Constants.NONE) { //remember that the calculator inheriting from this class must set id and name atts //and remove unwanted old atts i.e. this.SetCalculatorAttributes(calculator); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPName, attNameExtension), subP.SubPName); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPDescription, attNameExtension), subP.SubPDescription); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPLabel, attNameExtension), subP.SubPLabel); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPType, attNameExtension), subP.SubPType); CalculatorHelpers.SetAttributeDoubleF4(calculator, string.Concat(cSubPFactor, attNameExtension), subP.SubPFactor); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPYears, attNameExtension), subP.SubPYears); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPYearTimes, attNameExtension), subP.SubPYearTimes); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPSalvValue, attNameExtension), subP.SubPSalvValue); CalculatorHelpers.SetAttributeDoubleF3(calculator, string.Concat(cSubPAmount, attNameExtension), subP.SubPAmount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPUnit, attNameExtension), subP.SubPUnit); CalculatorHelpers.SetAttributeDoubleF3(calculator, string.Concat(cSubPPrice, attNameExtension), subP.SubPPrice); CalculatorHelpers.SetAttributeDoubleF3(calculator, string.Concat(cSubPEscRate, attNameExtension), subP.SubPEscRate); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPEscType, attNameExtension), subP.SubPEscType); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPTotal, attNameExtension), subP.SubPTotal); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cSubPTotalPerUnit, attNameExtension), subP.SubPTotalPerUnit); CalculatorHelpers.SetAttribute(calculator, string.Concat(cSubPOtherType, attNameExtension), subP.SubPOtherType); } }
public static void SetInputAllAttributes(Input input, ref XElement elementNeedingAttributes) { CalculatorHelpers.SetAttributeInt(elementNeedingAttributes, Calculator1.cId, input.Id); CalculatorHelpers.SetAttribute(elementNeedingAttributes, Calculator1.cName, input.Name.ToString()); CalculatorHelpers.SetAttribute(elementNeedingAttributes, Calculator1.cDescription, input.Description.ToString()); CalculatorHelpers.SetAttributeDateS(elementNeedingAttributes, DataAppHelpers.Prices.INPUT_DATE, input.Date); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.OC_AMOUNT, input.OCAmount); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.OC_PRICE, input.OCPrice); CalculatorHelpers.SetAttribute(elementNeedingAttributes, DataAppHelpers.Prices.OC_UNIT, input.OCUnit); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.AOH_AMOUNT, input.AOHAmount); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.AOH_PRICE, input.AOHPrice); CalculatorHelpers.SetAttribute(elementNeedingAttributes, DataAppHelpers.Prices.AOH_UNIT, input.AOHUnit); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.CAP_AMOUNT, input.CAPAmount); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.CAP_PRICE, input.CAPPrice); CalculatorHelpers.SetAttribute(elementNeedingAttributes, DataAppHelpers.Prices.CAP_UNIT, input.CAPUnit); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.General.INCENTIVE_AMOUNT, input.IncentiveAmount); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.General.INCENTIVE_RATE, input.IncentiveRate); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.INPUT_TIMES, input.Times); CalculatorHelpers.SetAttributeBool(elementNeedingAttributes, DataAppHelpers.Prices.USE_AOH, input.UseAOH); CalculatorHelpers.SetAttributeInt(elementNeedingAttributes, DataAppHelpers.Prices.INPUT_GROUP_ID, input.InputGroupId); CalculatorHelpers.SetAttribute(elementNeedingAttributes, DataAppHelpers.Prices.INPUT_GROUP_NAME, input.InputGroupName.ToString()); }
public virtual void SetTotalSubPrice2StockAttributes(SubPrice2Stock ind, string attNameExtension, ref XElement calculator) { CalculatorHelpers.SetAttribute(calculator, string.Concat(cTotalSubP2Description, attNameExtension), ind.TotalSubP2Description); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTotalSubP2Name, attNameExtension), ind.TotalSubP2Name); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTotalSubP2Label, attNameExtension), ind.TotalSubP2Label); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cTotalSubP2Total, attNameExtension), ind.TotalSubP2Total); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cTotalSubP2TotalPerUnit, attNameExtension), ind.TotalSubP2TotalPerUnit); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cTotalSubP2Price, attNameExtension), ind.TotalSubP2Price); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTotalSubP2Unit, attNameExtension), ind.TotalSubP2Unit); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cTotalSubP2Amount, attNameExtension), ind.TotalSubP2Amount); }
public void SetDemog1Attributes(string attNameExtension, ref XElement currentCalculationsElement) { //don't set any input attributes; each calculator should set what's needed separately CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cAge, attNameExtension), this.Age); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cEducationYears, attNameExtension), this.EducationYears); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cRace, attNameExtension), this.Race); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cHousing, attNameExtension), this.Housing); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cGender, attNameExtension), this.Gender); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cWorkStatus, attNameExtension), this.WorkStatus); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cMaritalStatus, attNameExtension), this.MaritalStatus); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cLocationId, attNameExtension), this.LocationId); }
//serialize regular properties public void SetNewOperationComponentAttributes( XElement elementNeedingAttributes) { CalculatorHelpers.SetAttributeDateS(elementNeedingAttributes, ENDOFPERIOD_DATE, this.Date); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.General.AMOUNT, this.Amount); CalculatorHelpers.SetAttribute(elementNeedingAttributes, DataAppHelpers.General.UNIT, this.Unit); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.WEIGHT, this.Weight); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.EFFECTIVE_LIFE, this.EffectiveLife); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.Prices.SALVAGE_VALUE, this.SalvageValue); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.General.INCENTIVE_AMOUNT, this.IncentiveAmount); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.General.INCENTIVE_RATE, this.IncentiveRate); CalculatorHelpers.SetAttribute(elementNeedingAttributes, DataAppHelpers.Economics1.ANNUITY_TYPE, this.AnnuityType.ToString()); }
//sets linkedview (analysisdoc) props needed by client to load and display doc public void SetLinkedViewParams() { string sStylesheetName = GetCalculatorStyleSheet(); //sStylesheetName will be used to find the Stylesheet and, if its a first time view, //to set two more params: StylesheetResourceURIPattern and StylesheetDocPath string sExistingStylesheetName = CalculatorHelpers.GetAttribute(this.NPVCalculatorParams.LinkedViewElement, Calculator1.cStylesheet2ResourceFileName); if (string.IsNullOrEmpty(sStylesheetName)) { sStylesheetName = sExistingStylesheetName; } if ((string.IsNullOrEmpty(sExistingStylesheetName)) || (!sExistingStylesheetName.Equals(sStylesheetName))) { CalculatorHelpers.SetAttribute(this.NPVCalculatorParams.LinkedViewElement, Calculator1.cStylesheet2ResourceFileName, sStylesheetName); } //set the ss's extension object's namespace SetStylesheetNamespace(); }
//some output calculators will also use output attributes within the calculator public void SetNewOutputAttributes(CalculatorParameters calcParameters, XElement elementNeedingAttributes) { CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, OUTPUT_AMOUNT, this.Amount); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, OUTPUT_PRICE, this.Price); CalculatorHelpers.SetAttribute(elementNeedingAttributes, OUTPUT_BASE_UNIT, this.Unit); CalculatorHelpers.SetAttributeDateS(elementNeedingAttributes, OUTPUT_DATE, this.Date); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, COMPOSITION_AMOUNT, this.CompositionAmount); CalculatorHelpers.SetAttribute(elementNeedingAttributes, COMPOSITION_UNIT, this.CompositionUnit); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, OUTPUT_TIMES, this.Times); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.General.INCENTIVE_AMOUNT, this.IncentiveAmount); CalculatorHelpers.SetAttributeDoubleF3(elementNeedingAttributes, DataAppHelpers.General.INCENTIVE_RATE, this.IncentiveRate); //totals CalculatorHelpers.SetAttributeDoubleF2(elementNeedingAttributes, CostBenefitCalculator.TR, this.TotalR); CalculatorHelpers.SetAttributeDoubleF2(elementNeedingAttributes, CostBenefitCalculator.TR_INT, this.TotalR_INT); CalculatorHelpers.SetAttributeDoubleF2(elementNeedingAttributes, CostBenefitCalculator.TRINCENT, this.TotalRINCENT); CalculatorHelpers.SetAttributeDoubleF2(elementNeedingAttributes, CostBenefitCalculator.TAMR, this.TotalAMR); CalculatorHelpers.SetAttributeDoubleF2(elementNeedingAttributes, CostBenefitCalculator.TAMR_INT, this.TotalAMR_INT); if (this.Local != null) { //locals only for calculator this.Local.SetLocalAttributesForCalculator(calcParameters, elementNeedingAttributes); } }
private void SetIndicatorQ1Attributes(IndicatorQ1 indQ, string attNameExtension, XElement currentCalculationsElement) { CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cIQ1NameA, attNameExtension), indQ.IQ1NameA); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cIQ1AmountA, attNameExtension), indQ.IQ1AmountA); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cIQ1UnitA, attNameExtension), indQ.IQ1UnitA); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cIQ1NameB, attNameExtension), indQ.IQ1NameB); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cIQ1AmountB, attNameExtension), indQ.IQ1AmountB); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cIQ1UnitB, attNameExtension), indQ.IQ1UnitB); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cIQ1NameC, attNameExtension), indQ.IQ1NameC); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cIQ1AmountC, attNameExtension), indQ.IQ1AmountC); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cIQ1UnitC, attNameExtension), indQ.IQ1UnitC); }
public void SetFN1ConstantAttributes(string attNameExtension, XElement currentCalculationsElement) { CalculatorHelpers.SetAttributeInt(currentCalculationsElement, cFNC1Id, this.FNC1Id); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Label, this.FNC1Label); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Name, this.FNC1Name); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Child1to3, this.FNC1Child1to3); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Female4to8, this.FNC1Female4to8); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Male4to8, this.FNC1Male4to8); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Female9to13, this.FNC1Female9to13); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Male9to13, this.FNC1Male9to13); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Female14to18, this.FNC1Female14to18); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Male14to18, this.FNC1Male14to18); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Female19to30, this.FNC1Female19to30); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Male19to30, this.FNC1Male19to30); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Female31to50, this.FNC1Female31to50); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Male31to50, this.FNC1Male31to50); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Female51Plus, this.FNC1Female51Plus); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFNC1Male51Plus, this.FNC1Male51Plus); }
public void SetLCC1Attributes(string attNameExtension, ref XElement calculator) { //must remove old unwanted attributes if (calculator != null) { //do not remove atts here, they were removed in prior this.SubPrice1.SetInputAtts //and now include good locals //this also sets the aggregating atts this.SetAndRemoveCalculatorAttributes(attNameExtension, ref calculator); } this.SubPrice1.SetSubPrice1Attributes(this.SubPrice1, string.Empty, ref calculator); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cServiceLifeYears, attNameExtension), this.ServiceLifeYears); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cYearsFromBaseDate, attNameExtension), this.YearsFromBaseDate); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cPlanningConstructionYears, attNameExtension), this.PlanningConstructionYears); CalculatorHelpers.SetAttributeDoubleF3(calculator, string.Concat(cPerUnitAmount, attNameExtension), this.PerUnitAmount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cPerUnitUnit, attNameExtension), this.PerUnitUnit); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cOCTotalCost, attNameExtension), this.OCTotalCost); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cAOHTotalCost, attNameExtension), this.AOHTotalCost); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cCAPTotalCost, attNameExtension), this.CAPTotalCost); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cLCCTotalCost, attNameExtension), this.LCCTotalCost); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cEAATotalCost, attNameExtension), this.EAATotalCost); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cUnitTotalCost, attNameExtension), this.UnitTotalCost); }
private void SetDemog4Attributes(Demog4 demog, string attNameExtension, XElement currentCalculationsElement) { if (demog.D4Name != string.Empty && demog.D4Name != Constants.NONE) { CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4Name, attNameExtension), demog.D4Name); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4Label, attNameExtension), demog.D4Label); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4Description, attNameExtension), demog.D4Description); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4NameA, attNameExtension), demog.D4NameA); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4LabelA, attNameExtension), demog.D4LabelA); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4AmountA, attNameExtension), demog.D4AmountA); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4PopA, attNameExtension), demog.D4PopA); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4UnitA, attNameExtension), demog.D4UnitA); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4NameB, attNameExtension), demog.D4NameB); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4LabelB, attNameExtension), demog.D4LabelB); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4AmountB, attNameExtension), demog.D4AmountB); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4PopB, attNameExtension), demog.D4PopB); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4UnitB, attNameExtension), demog.D4UnitB); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4NameC, attNameExtension), demog.D4NameC); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4LabelC, attNameExtension), demog.D4LabelC); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4AmountC, attNameExtension), demog.D4AmountC); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4PopC, attNameExtension), demog.D4PopC); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4UnitC, attNameExtension), demog.D4UnitC); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4NameD, attNameExtension), demog.D4NameD); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4LabelD, attNameExtension), demog.D4LabelD); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4AmountD, attNameExtension), demog.D4AmountD); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4PopD, attNameExtension), demog.D4PopD); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4UnitD, attNameExtension), demog.D4UnitD); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4NameE, attNameExtension), demog.D4NameE); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4LabelE, attNameExtension), demog.D4LabelE); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4AmountE, attNameExtension), demog.D4AmountE); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4PopE, attNameExtension), demog.D4PopE); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cD4UnitE, attNameExtension), demog.D4UnitE); } }
public void SetHealthBenefit1Attributes(string attNameExtension, ref XElement currentCalculationsElement) { if (Demographics == null) { Demographics = new Demog1(); } Demographics.SetDemog1Attributes(attNameExtension, ref currentCalculationsElement); //don't set any input attributes; each calculator should set what's needed separately CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cOutputCost, attNameExtension), this.OutputCost); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cBenefitAdjustment, attNameExtension), this.BenefitAdjustment); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cAdjustedBenefit, attNameExtension), this.AdjustedBenefit); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cOutputEffect1Name, attNameExtension), this.OutputEffect1Name); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cOutputEffect1Unit, attNameExtension), this.OutputEffect1Unit); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cOutputEffect1Amount, attNameExtension), this.OutputEffect1Amount); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cOutputEffect1Price, attNameExtension), this.OutputEffect1Price); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cOutputEffect1Cost, attNameExtension), this.OutputEffect1Cost); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cAverageBenefitRating, attNameExtension), this.AverageBenefitRating); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, string.Concat(cPhysicalHealthRating, attNameExtension), this.PhysicalHealthRating); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, string.Concat(cEmotionalHealthRating, attNameExtension), this.EmotionalHealthRating); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, string.Concat(cSocialHealthRating, attNameExtension), this.SocialHealthRating); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, string.Concat(cEconomicHealthRating, attNameExtension), this.EconomicHealthRating); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, string.Concat(cHealthCareDeliveryRating, attNameExtension), this.HealthCareDeliveryRating); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, string.Concat(cBeforeQOLRating, attNameExtension), this.BeforeQOLRating); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, string.Concat(cAfterQOLRating, attNameExtension), this.AfterQOLRating); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, string.Concat(cBeforeYears, attNameExtension), this.BeforeYears); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, string.Concat(cAfterYears, attNameExtension), this.AfterYears); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, string.Concat(cAfterYearsProb, attNameExtension), this.AfterYearsProb); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, string.Concat(cTimeTradeoffYears, attNameExtension), this.TimeTradeoffYears); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, string.Concat(cEquityMultiplier, attNameExtension), this.EquityMultiplier); CalculatorHelpers.SetAttribute(currentCalculationsElement, string.Concat(cBenefitAssessment, attNameExtension), this.BenefitAssessment); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cQALY, attNameExtension), this.QALY); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cICERQALY, attNameExtension), this.ICERQALY); CalculatorHelpers.SetAttributeDoubleF3(currentCalculationsElement, string.Concat(cTTOQALY, attNameExtension), this.TTOQALY); CalculatorHelpers.SetAttributeBool(currentCalculationsElement, string.Concat(cWillDoSurvey, attNameExtension), this.WillDoSurvey); }
public void SetMachinery1ConstantAttributes( ref XElement currentCalculationsElement) { CalculatorHelpers.SetAttributeInt(currentCalculationsElement, cMachConstantId, this.MachConstantId); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, cMachConstantGroupId, this.MachConstantGroupId); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cServiceCapacity, this.ServiceCapacity); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cRF1, this.RF1); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cRF2, this.RF2); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cRV1, this.RV1); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cRV2, this.RV2); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cRV3, this.RV3); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFuelType, this.FuelType); CalculatorHelpers.SetAttribute(currentCalculationsElement, cLaborType, this.LaborType); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cWidth, this.Width); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, cStartingHrs, this.StartingHrs); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, cPlannedUseHrs, this.PlannedUseHrs); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, cUsefulLifeHrs, this.UsefulLifeHrs); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, cHP, this.HP); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, cHPPTOEquiv, this.HPPTOEquiv); CalculatorHelpers.SetAttributeInt(currentCalculationsElement, cHPPTOMax, this.HPPTOMax); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFieldEffRange, this.FieldEffRange); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFieldSpeedRange, this.FieldSpeedRange); CalculatorHelpers.SetAttribute(currentCalculationsElement, cFieldSpeedRangekm, this.FieldSpeedRangekm); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cFieldSpeedTypical, this.FieldSpeedTypical); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cFieldSpeedTypicalkm, this.FieldSpeedTypicalkm); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cFieldEffTypical, this.FieldEffTypical); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cTotalLifeRandM, this.TotalLifeRandM); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, cPriceGas, this.PriceGas); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, cPriceDiesel, this.PriceDiesel); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, cPriceLP, this.PriceLP); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, cPriceElectric, this.PriceElectric); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, cPriceNG, this.PriceNG); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, cPriceOil, this.PriceOil); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, cPriceRegularLabor, this.PriceRegularLabor); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, cPriceMachineryLabor, this.PriceMachineryLabor); CalculatorHelpers.SetAttributeDoubleF2(currentCalculationsElement, cPriceSupervisorLabor, this.PriceSupervisorLabor); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cHousingPercent, this.HousingPercent); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cTaxPercent, this.TaxPercent); CalculatorHelpers.SetAttributeDoubleF4(currentCalculationsElement, cInsurePercent, this.InsurePercent); }
private void ChangeCalculatorIdForUpdatedChildren(XElement currentElement, ref XElement calculator, ME2Stock me2) { //alternatives are set using ME calculators (or input/output calculators) bool bIsChildrenUpdate = CalculatorHelpers.IsSelfOrChildNode(this.GCCalculatorParams, currentElement.Name.LocalName); if (bIsChildrenUpdate) { //don't change the starting calculator if (this.GCCalculatorParams.StartingDocToCalcNodeName == currentElement.Name.LocalName) { return; } XElement lv = CalculatorHelpers.GetChildLinkedViewUsingAttribute(currentElement, Calculator1.cAnalyzerType, this.GCCalculatorParams.AnalyzerParms.AnalyzerType.ToString()); //init with random calculator id if (this.GCCalculatorParams.RndGenerator == null) { this.GCCalculatorParams.RndGenerator = new Random(); } int iCalcId = this.GCCalculatorParams.RndGenerator.Next(); if (lv != null) { //switch to a calc that needs to be updated iCalcId = CalculatorHelpers.GetAttributeInt(lv, Calculator1.cId); } else { if (calculator != null) { //use the existing calc (gencalcsubscriber will replace with a new one anyway) lv = new XElement(calculator); } } if (lv != null) { //change analyzer so that it can be inserted or updated (instead of the existing me calc) CalculatorHelpers.SetAttributeInt(lv, Calculator1.cId, iCalcId); CalculatorHelpers.SetAttributeInt(lv, Calculator1.cCalculatorId, iCalcId); //important for updates that this get set to string.empty CalculatorHelpers.SetAttribute(lv, Calculator1.cCalculatorType, string.Empty); CalculatorHelpers.SetAttribute(lv, Calculator1.cAnalyzerType, this.GCCalculatorParams.AnalyzerParms.AnalyzerType); //tells subscriber to update/insert child calculator = new XElement(lv); } if (iCalcId != 0) { me2.Id = iCalcId; me2.CalculatorId = iCalcId; if (me2.Total1 != null) { me2.Total1.Id = iCalcId; me2.Total1.CalculatorId = iCalcId; } if (me2.Stat1 != null) { me2.Stat1.Id = iCalcId; me2.Stat1.CalculatorId = iCalcId; } if (me2.Change1 != null) { me2.Change1.Id = iCalcId; me2.Change1.CalculatorId = iCalcId; } if (me2.Progress1 != null) { me2.Progress1.Id = iCalcId; me2.Progress1.CalculatorId = iCalcId; } } } }
public virtual void SetTotalME2IndicatorStockAttributes(ME2IndicatorStock ind, string attNameExtension, ref XElement calculator) { if (!string.IsNullOrEmpty(ind.TME2Name) && ind.TME2Name != Constants.NONE) { //remember that the calculator inheriting from this class must set id and name atts //and remove unwanted old atts i.e. ind.SetCalculatorAttributes(calculator); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2Name, attNameExtension), ind.TME2Name); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2Label, attNameExtension), ind.TME2Label); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2Description, attNameExtension), ind.TME2Description); CalculatorHelpers.SetAttributeDateS(calculator, string.Concat(cTME2Date, attNameExtension), ind.TME2Date); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2MathType, attNameExtension), ind.TME2MathType); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2BaseIO, attNameExtension), ind.TME2BaseIO); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2Type, attNameExtension), ind.TME2Type); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2RelLabel, attNameExtension), ind.TME2RelLabel); CalculatorHelpers.SetAttributeDoubleN4(calculator, string.Concat(cTME2TAmount, attNameExtension), ind.TME2TAmount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2TUnit, attNameExtension), ind.TME2TUnit); CalculatorHelpers.SetAttributeDoubleN4(calculator, string.Concat(cTME2TD1Amount, attNameExtension), ind.TME2TD1Amount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2TD1Unit, attNameExtension), ind.TME2TD1Unit); CalculatorHelpers.SetAttributeDoubleN4(calculator, string.Concat(cTME2TD2Amount, attNameExtension), ind.TME2TD2Amount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2TD2Unit, attNameExtension), ind.TME2TD2Unit); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2MathResult, attNameExtension), ind.TME2MathResult); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2MathSubType, attNameExtension), ind.TME2MathSubType); CalculatorHelpers.SetAttributeDoubleN4(calculator, string.Concat(cTME2TMAmount, attNameExtension), ind.TME2TMAmount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2TMUnit, attNameExtension), ind.TME2TMUnit); CalculatorHelpers.SetAttributeDoubleN4(calculator, string.Concat(cTME2TLAmount, attNameExtension), ind.TME2TLAmount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2TLUnit, attNameExtension), ind.TME2TLUnit); CalculatorHelpers.SetAttributeDoubleN4(calculator, string.Concat(cTME2TUAmount, attNameExtension), ind.TME2TUAmount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2TUUnit, attNameExtension), ind.TME2TUUnit); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2MathOperator, attNameExtension), ind.TME2MathOperator); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME2MathExpression, attNameExtension), ind.TME2MathExpression); CalculatorHelpers.SetAttributeDoubleF2(calculator, string.Concat(cTME2N, attNameExtension), ind.TME2N); CalculatorHelpers.SetAttributeDoubleN4(calculator, string.Concat(cTME25Amount, attNameExtension), ind.TME25Amount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME25Unit, attNameExtension), ind.TME25Unit); CalculatorHelpers.SetAttributeDoubleN4(calculator, string.Concat(cTME21Amount, attNameExtension), ind.TME21Amount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME21Unit, attNameExtension), ind.TME21Unit); CalculatorHelpers.SetAttributeDoubleN4(calculator, string.Concat(cTME22Amount, attNameExtension), ind.TME22Amount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME22Unit, attNameExtension), ind.TME22Unit); CalculatorHelpers.SetAttributeDoubleN4(calculator, string.Concat(cTME23Amount, attNameExtension), ind.TME23Amount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME23Unit, attNameExtension), ind.TME23Unit); CalculatorHelpers.SetAttributeDoubleN4(calculator, string.Concat(cTME24Amount, attNameExtension), ind.TME24Amount); CalculatorHelpers.SetAttribute(calculator, string.Concat(cTME24Unit, attNameExtension), ind.TME24Unit); } }
private void ChangeLinkedViewCalculator(XElement currentElement, ref XElement linkedViewElement) { //v137 pattern allows analyzers to update descendents using dbupdates //i.e. need i/o calculators to get totals, but don't want to //overwrite those calculations in db if (this.GCCalculatorParams.ExtensionCalcDocURI.URIDataManager.HostName == DevTreks.Data.Helpers.AddInHelper.HOSTS.extensionanalyzersteps.ToString() && this.GCCalculatorParams.NeedsCalculators && CalculatorHelpers.IsSelfOrChildNode(this.GCCalculatorParams, currentElement.Name.LocalName)) { //100% Rule 1: Analyzers never, ever, update calculators string sCalculatorType = CalculatorHelpers.GetAttribute(linkedViewElement, Calculator1.cCalculatorType); //pure calculators never have an analysis type string sAnalysisType = CalculatorHelpers.GetAttribute(linkedViewElement, Calculator1.cAnalyzerType); if (!string.IsNullOrEmpty(sCalculatorType) && string.IsNullOrEmpty(sAnalysisType)) { //order of lv retrieval gets calulators before analyzers XElement analyzerLV = CalculatorHelpers.GetChildLinkedViewUsingAttribute( currentElement, Calculator1.cAnalyzerType, this.GCCalculatorParams.AnalyzerParms.AnalyzerType); if (analyzerLV != null) { if (this.GCCalculatorParams.LinkedViewElement != null) { //keep the id and calculatorid, but update the rest of the atts with new lv string sId = CalculatorHelpers.GetAttribute(analyzerLV, Calculator1.cId); string sCalcId = CalculatorHelpers.GetAttribute(analyzerLV, Calculator1.cCalculatorId); analyzerLV = new XElement(this.GCCalculatorParams.LinkedViewElement); CalculatorHelpers.SetAttribute(analyzerLV, Calculator1.cId, sId); CalculatorHelpers.SetAttribute(analyzerLV, Calculator1.cCalculatorId, sCalcId); } //use it to update db (not the calculator) linkedViewElement = new XElement(analyzerLV); } else { //use the base linked view standard pattern //avoids updating the wrong lvs linkedViewElement = CalculatorHelpers.GetNewCalculator(this.GCCalculatorParams, currentElement); } } } //100% Rule 2: Analyzers and Calculators never, ever, allow descendent lvs //to have parent Overwrite or UseSameCalc properties if (this.GCCalculatorParams.StartingDocToCalcNodeName != currentElement.Name.LocalName) { if (linkedViewElement != null) { string sAttValue = CalculatorHelpers.GetAttribute(linkedViewElement, Calculator1.cUseSameCalculator); if ((!string.IsNullOrEmpty(sAttValue)) && sAttValue != Constants.NONE) { CalculatorHelpers.SetAttribute(linkedViewElement, Calculator1.cUseSameCalculator, string.Empty); } sAttValue = CalculatorHelpers.GetAttribute(linkedViewElement, Calculator1.cOverwrite); if ((!string.IsNullOrEmpty(sAttValue)) && sAttValue != Constants.NONE) { CalculatorHelpers.SetAttribute(linkedViewElement, Calculator1.cOverwrite, string.Empty); } } } }