public void SetOutputProperties(XElement currentElement) { this.SetSharedObjectProperties(currentElement); this.SetTotalBenefitsProperties(currentElement); this.AnnuityType = TimePeriod.GetAnnuityType(currentElement); this.Amount = CalculatorHelpers.GetAttributeDouble(currentElement, OUTPUT_AMOUNT); this.Price = CalculatorHelpers.GetAttributeDouble(currentElement, OUTPUT_PRICE); this.Date = CalculatorHelpers.GetAttributeDate(currentElement, OUTPUT_DATE); this.Unit = CalculatorHelpers.GetAttribute(currentElement, OUTPUT_BASE_UNIT); this.CompositionAmount = CalculatorHelpers.GetAttributeDouble(currentElement, COMPOSITION_AMOUNT); this.CompositionUnit = CalculatorHelpers.GetAttribute(currentElement, COMPOSITION_UNIT); this.Times = CalculatorHelpers.GetAttributeDouble(currentElement, OUTPUT_TIMES); this.IncentiveAmount = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.General.INCENTIVE_AMOUNT); this.IncentiveRate = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.General.INCENTIVE_RATE); this.OutputGroupId = CalculatorHelpers.GetAttributeInt(currentElement, DataAppHelpers.Prices.OUTPUT_GROUP_ID); this.OutputGroupName = CalculatorHelpers.GetAttribute(currentElement, DataAppHelpers.Prices.OUTPUT_GROUP_NAME); }
//set the class properties using the XElement public virtual void SetTimelinessOC1Properties(XElement currentCalculationsElement) { this.PlannedStartDate = CalculatorHelpers.GetAttributeDate(currentCalculationsElement, cPlannedStartDate); this.ActualStartDate = CalculatorHelpers.GetAttributeDate(currentCalculationsElement, cActualStartDate); this.LaborAvailable = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cLaborAvailable); this.WorkdayProbability = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cWorkdayProbability); this.TimelinessPenalty1 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimelinessPenalty1); this.TimelinessPenaltyDaysFromStart1 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimelinessPenaltyDaysFromStart1); this.TimelinessPenalty2 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimelinessPenalty2); this.TimelinessPenaltyDaysFromStart2 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimelinessPenaltyDaysFromStart2); this.WorkdaysLimit = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cWorkdaysLimit); this.Amount = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, Constants.AMOUNT); this.Unit = CalculatorHelpers.GetAttribute(currentCalculationsElement, Constants.UNIT); this.FieldCapacity = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cFieldCapacity); this.AreaCovered = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cAreaCovered); this.FieldDays = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cFieldDays); this.OutputName = CalculatorHelpers.GetAttribute(currentCalculationsElement, cOutputName); this.OutputUnit = CalculatorHelpers.GetAttribute(currentCalculationsElement, cOutputUnit); this.OutputPrice = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputPrice); this.OutputYield = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputYield); this.CompositionUnit = CalculatorHelpers.GetAttribute(currentCalculationsElement, cCompositionUnit); this.CompositionAmount = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cCompositionAmount); this.OutputTimes = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputTimes); this.ProbableFieldDays = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cProbableFieldDays); this.ProbableFinishDate = CalculatorHelpers.GetAttributeDate(currentCalculationsElement, cProbableFinishDate); this.TimelinessPenaltyCost = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimelinessPenaltyCost); this.TimelinessPenaltyCostPerHour = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimelinessPenaltyCostPerHour); this.TotalR = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, CostBenefitCalculator.TR); }
//set the class properties using the XElement public void SetOperationComponentProperties(CalculatorParameters calcParameters, XElement currentCalculationsElement, XElement currentElement) { //several extensions store some calculator props in base element (observations, targettype) //no harm done in setting them but never set their attributes in base element this.SetCalculatorProperties(currentCalculationsElement); this.SetSharedObjectProperties(currentElement); this.SetTotalCostsProperties(currentElement); this.AnnuityType = TimePeriod.GetAnnuityType(currentElement); if (currentElement.Name.LocalName != DataAppHelpers.Prices.OPERATION_PRICE_TYPES.operationgroup.ToString() && currentElement.Name.LocalName != DataAppHelpers.Prices.COMPONENT_PRICE_TYPES.componentgroup.ToString()) { this.Amount = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.General.AMOUNT); this.Date = CalculatorHelpers.GetAttributeDate(currentElement, ENDOFPERIOD_DATE); this.Unit = CalculatorHelpers.GetAttribute(currentElement, DataAppHelpers.General.UNIT); this.Weight = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.Prices.WEIGHT); this.EffectiveLife = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.Prices.EFFECTIVE_LIFE); this.SalvageValue = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.Prices.SALVAGE_VALUE); this.IncentiveAmount = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.General.INCENTIVE_AMOUNT); this.IncentiveRate = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.General.INCENTIVE_RATE); if (this.SubApplicationType == Constants.SUBAPPLICATION_TYPES.budgets.ToString()) { this.TimePeriodId = CalculatorHelpers.GetAttributeInt(currentElement, DataAppHelpers.Economics1.BUDGETSYSTEM_TO_TIME_ID); } else if (this.SubApplicationType == Constants.SUBAPPLICATION_TYPES.investments.ToString()) { this.TimePeriodId = CalculatorHelpers.GetAttributeInt(currentElement, DataAppHelpers.Economics1.COSTSYSTEM_TO_TIME_ID); } } this.AnnuityCount = 0; this.Local = new Local(); string sCurrentNodeURIPattern = CalculatorHelpers.MakeNewURIPatternFromElement( calcParameters.ExtensionDocToCalcURI.URIPattern, currentElement); this.Local = CalculatorHelpers.GetLocal(sCurrentNodeURIPattern, calcParameters, currentCalculationsElement, currentElement); this.XmlDocElement = currentCalculationsElement; }
public void SetOutputDiscountedProperties(CalculatorParameters calcParameters, XElement currentCalculationsElement, XElement currentElement) { //set the base output properties SetOutputProperties(calcParameters, currentCalculationsElement, currentElement); this.CompositionAmount = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, COMPOSITION_AMOUNT); this.CompositionUnit = CalculatorHelpers.GetAttribute(currentCalculationsElement, COMPOSITION_UNIT); this.IncentiveAmount = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, Constants.INCENTIVE_AMOUNT); this.IncentiveRate = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, Constants.INCENTIVE_RATE); //set the calculator properties this.IsDiscounted = CalculatorHelpers.GetAttributeBool(currentCalculationsElement, BudgetInvestment.ISDISCOUNTED); this.EndOfPeriodDate = CalculatorHelpers.GetAttributeDate(currentCalculationsElement, OperationComponent.ENDOFPERIOD_DATE); }
public void SetInputDiscountedProperties(CalculatorParameters calcParameters, XElement currentCalculationsElement, XElement currentElement) { //set the base input properties SetInputProperties(calcParameters, currentCalculationsElement, currentElement); //set the calculator properties this.IsDiscounted = CalculatorHelpers.GetAttributeBool(currentCalculationsElement, BudgetInvestment.ISDISCOUNTED); this.EndOfPeriodDate = CalculatorHelpers.GetAttributeDate(currentCalculationsElement, OperationComponent.ENDOFPERIOD_DATE); this.EffectiveLife = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, OperationComponent.EFFECTIVE_LIFE); this.SalvageValue = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, OperationComponent.SALVAGE_VALUE); this.Times = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, Input.INPUT_TIMES); this.IncentiveAmount = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, Constants.INCENTIVE_AMOUNT); this.IncentiveRate = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, Constants.INCENTIVE_RATE); }
public void SetTotalME2IndicatorStockProperties(ME2IndicatorStock ind, string attNameExtension, XElement calculator) { ind.TME2Description = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2Description, attNameExtension)); ind.TME2Name = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2Name, attNameExtension)); ind.TME2Label = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2Label, attNameExtension)); ind.TME2Type = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2Type, attNameExtension)); ind.TME21Amount = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cTME21Amount, attNameExtension)); ind.TME21Unit = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME21Unit, attNameExtension)); ind.TME2RelLabel = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2RelLabel, attNameExtension)); ind.TME2TAmount = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cTME2TAmount, attNameExtension)); ind.TME2TUnit = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2TUnit, attNameExtension)); ind.TME2TD1Amount = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cTME2TD1Amount, attNameExtension)); ind.TME2TD1Unit = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2TD1Unit, attNameExtension)); ind.TME2TD2Amount = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cTME2TD2Amount, attNameExtension)); ind.TME2TD2Unit = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2TD2Unit, attNameExtension)); ind.TME2MathResult = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2MathResult, attNameExtension)); ind.TME2MathSubType = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2MathSubType, attNameExtension)); ind.TME2TMAmount = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cTME2TMAmount, attNameExtension)); ind.TME2TMUnit = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2TMUnit, attNameExtension)); ind.TME2TLAmount = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cTME2TLAmount, attNameExtension)); ind.TME2TLUnit = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2TLUnit, attNameExtension)); ind.TME2TUAmount = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cTME2TUAmount, attNameExtension)); ind.TME2TUUnit = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2TUUnit, attNameExtension)); ind.TME2MathOperator = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2MathOperator, attNameExtension)); ind.TME2MathExpression = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2MathExpression, attNameExtension)); ind.TME2N = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cTME2N, attNameExtension)); ind.TME2Date = CalculatorHelpers.GetAttributeDate(calculator, string.Concat(cTME2Date, attNameExtension)); ind.TME2MathType = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2MathType, attNameExtension)); ind.TME2BaseIO = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME2BaseIO, attNameExtension)); ind.TME22Amount = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cTME22Amount, attNameExtension)); ind.TME22Unit = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME22Unit, attNameExtension)); ind.TME25Amount = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cTME25Amount, attNameExtension)); ind.TME25Unit = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME25Unit, attNameExtension)); ind.TME23Amount = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cTME23Amount, attNameExtension)); ind.TME23Unit = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME23Unit, attNameExtension)); ind.TME24Amount = CalculatorHelpers.GetAttributeDouble(calculator, string.Concat(cTME24Amount, attNameExtension)); ind.TME24Unit = CalculatorHelpers.GetAttribute(calculator, string.Concat(cTME24Unit, attNameExtension)); }
//set the class properties using the XElement public void SetInputProperties(CalculatorParameters calcParameters, XElement currentCalculationsElement, XElement currentElement) { //several extensions store some calculator props in base element (observations, targettype) //no harm done in setting them but never set their attributes in base element this.SetCalculatorProperties(currentCalculationsElement); this.SetSharedObjectProperties(currentElement); this.SetTotalCostsProperties(currentElement); this.AnnuityType = TimePeriod.GetAnnuityType(currentElement); //input calcs can be run from group nodes if (currentElement.Name.LocalName != DataAppHelpers.Prices.INPUT_PRICE_TYPES.inputgroup.ToString()) { //set this object's specific properties this.Date = CalculatorHelpers.GetAttributeDate(currentElement, DataAppHelpers.Prices.INPUT_DATE); this.OCAmount = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.Prices.OC_AMOUNT); this.OCPrice = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.Prices.OC_PRICE); this.OCUnit = CalculatorHelpers.GetAttribute(currentElement, DataAppHelpers.Prices.OC_UNIT); this.AOHAmount = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.Prices.AOH_AMOUNT); this.AOHPrice = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.Prices.AOH_PRICE); this.AOHUnit = CalculatorHelpers.GetAttribute(currentElement, DataAppHelpers.Prices.AOH_UNIT); this.CAPAmount = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.Prices.CAP_AMOUNT); this.CAPPrice = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.Prices.CAP_PRICE); this.CAPUnit = CalculatorHelpers.GetAttribute(currentElement, DataAppHelpers.Prices.CAP_UNIT); this.IncentiveAmount = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.General.INCENTIVE_AMOUNT); this.IncentiveRate = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.General.INCENTIVE_RATE); this.InputGroupId = CalculatorHelpers.GetAttributeInt(currentElement, DataAppHelpers.Prices.INPUT_GROUP_ID); this.InputGroupName = CalculatorHelpers.GetAttribute(currentElement, DataAppHelpers.Prices.INPUT_GROUP_NAME); this.Times = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.Prices.INPUT_TIMES); this.UseAOH = CalculatorHelpers.GetAttributeBool(currentElement, DataAppHelpers.Prices.USE_AOH); this.Local = new Local(); string sCurrentNodeURIPattern = CalculatorHelpers.MakeNewURIPatternFromElement( calcParameters.ExtensionDocToCalcURI.URIPattern, currentElement); this.Local = CalculatorHelpers.GetLocal(sCurrentNodeURIPattern, calcParameters, currentCalculationsElement, currentElement); } else { //set this object's properties using calculator attributes this.Date = CalculatorHelpers.GetAttributeDate(currentCalculationsElement, INPUT_DATE); this.OCAmount = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, DataAppHelpers.Prices.OC_AMOUNT); this.OCPrice = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, DataAppHelpers.Prices.OC_PRICE); this.OCUnit = CalculatorHelpers.GetAttribute(currentCalculationsElement, DataAppHelpers.Prices.OC_UNIT); this.AOHAmount = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, DataAppHelpers.Prices.AOH_AMOUNT); this.AOHPrice = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, DataAppHelpers.Prices.AOH_PRICE); this.AOHUnit = CalculatorHelpers.GetAttribute(currentCalculationsElement, DataAppHelpers.Prices.AOH_UNIT); this.CAPAmount = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, DataAppHelpers.Prices.CAP_AMOUNT); this.CAPPrice = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, DataAppHelpers.Prices.CAP_PRICE); this.CAPUnit = CalculatorHelpers.GetAttribute(currentCalculationsElement, DataAppHelpers.Prices.CAP_UNIT); this.IncentiveAmount = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, DataAppHelpers.General.INCENTIVE_AMOUNT); this.IncentiveRate = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, DataAppHelpers.General.INCENTIVE_RATE); this.Times = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, DataAppHelpers.Prices.INPUT_TIMES); this.UseAOH = CalculatorHelpers.GetAttributeBool(currentCalculationsElement, DataAppHelpers.Prices.USE_AOH); //use the calculator params to set locals (they can be changed in calcor) this.Local = new Local(); this.Local.SetLocalProperties(calcParameters, currentCalculationsElement, currentElement); } //joint input calcs can change this element this.XmlDocElement = currentCalculationsElement; }
//set the class properties using the XElement public void SetOutputProperties(CalculatorParameters calcParameters, XElement currentCalculationsElement, XElement currentElement) { //several extensions store some calculator props in base element (observations, targettype) //no harm done in setting them but never set their attributes in base element this.SetCalculatorProperties(currentCalculationsElement); this.SetSharedObjectProperties(currentElement); this.SetTotalBenefitsProperties(currentElement); this.AnnuityType = TimePeriod.GetAnnuityType(currentElement); if (currentElement.Name.LocalName != DataAppHelpers.Prices.OUTPUT_PRICE_TYPES.outputgroup.ToString()) { this.Date = CalculatorHelpers.GetAttributeDate(currentElement, DataAppHelpers.Prices.OUTPUT_DATE); this.Amount = CalculatorHelpers.GetAttributeDouble(currentElement, OUTPUT_AMOUNT); this.Price = CalculatorHelpers.GetAttributeDouble(currentElement, OUTPUT_PRICE); this.Unit = CalculatorHelpers.GetAttribute(currentElement, OUTPUT_BASE_UNIT); this.CompositionAmount = CalculatorHelpers.GetAttributeDouble(currentElement, COMPOSITION_AMOUNT); this.CompositionUnit = CalculatorHelpers.GetAttribute(currentElement, COMPOSITION_UNIT); this.Times = CalculatorHelpers.GetAttributeDouble(currentElement, OUTPUT_TIMES); this.IncentiveAmount = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.General.INCENTIVE_AMOUNT); this.IncentiveRate = CalculatorHelpers.GetAttributeDouble(currentElement, DataAppHelpers.General.INCENTIVE_RATE); this.OutputGroupId = CalculatorHelpers.GetAttributeInt(currentElement, DataAppHelpers.Prices.OUTPUT_GROUP_ID); this.OutputGroupName = CalculatorHelpers.GetAttribute(currentElement, DataAppHelpers.Prices.OUTPUT_GROUP_NAME); this.Local = new Local(); string sCurrentNodeURIPattern = CalculatorHelpers.MakeNewURIPatternFromElement( calcParameters.ExtensionDocToCalcURI.URIPattern, currentElement); this.Local = CalculatorHelpers.GetLocal(sCurrentNodeURIPattern, calcParameters, currentCalculationsElement, currentElement); } else { this.Date = CalculatorHelpers.GetAttributeDate(currentCalculationsElement, OUTPUT_DATE); this.Amount = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, OUTPUT_AMOUNT); this.Price = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, OUTPUT_PRICE); this.Unit = CalculatorHelpers.GetAttribute(currentCalculationsElement, OUTPUT_BASE_UNIT); this.CompositionAmount = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, COMPOSITION_AMOUNT); this.CompositionUnit = CalculatorHelpers.GetAttribute(currentCalculationsElement, COMPOSITION_UNIT); this.Times = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, OUTPUT_TIMES); this.IncentiveAmount = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, DataAppHelpers.General.INCENTIVE_AMOUNT); this.IncentiveRate = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, DataAppHelpers.General.INCENTIVE_RATE); //use the calculator params to set locals (they can be changed in calcor) this.Local = new Local(); this.Local.SetLocalProperties(calcParameters, currentCalculationsElement, currentElement); } //joint output calcs can change this element this.XmlDocElement = currentCalculationsElement; }