//set the class properties using the XElement
 public virtual void SetHealthBenefit2Properties(XElement currentCalculationsElement)
 {
     if (Demographics == null)
     {
         Demographics = new Demog1();
     }
     Demographics.SetDemog1Properties(currentCalculationsElement);
     //don't set any input properties; each calculator should set what's needed separately
     this.OutputCost               = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputCost);
     this.BenefitAdjustment        = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cBenefitAdjustment);
     this.AdjustedBenefit          = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cAdjustedBenefit);
     this.OutputEffect1Name        = CalculatorHelpers.GetAttribute(currentCalculationsElement, cOutputEffect1Name);
     this.OutputEffect1Unit        = CalculatorHelpers.GetAttribute(currentCalculationsElement, cOutputEffect1Unit);
     this.OutputEffect1Amount      = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputEffect1Amount);
     this.OutputEffect1Price       = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputEffect1Price);
     this.OutputEffect1Cost        = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputEffect1Cost);
     this.AverageBenefitRating     = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cAverageBenefitRating);
     this.PhysicalHealthRating     = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cPhysicalHealthRating);
     this.EmotionalHealthRating    = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cEmotionalHealthRating);
     this.SocialHealthRating       = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cSocialHealthRating);
     this.EconomicHealthRating     = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cEconomicHealthRating);
     this.HealthCareDeliveryRating = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cHealthCareDeliveryRating);
     this.BeforeQOLRating          = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cBeforeQOLRating);
     this.AfterQOLRating           = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cAfterQOLRating);
     this.BeforeYears              = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cBeforeYears);
     this.AfterYears               = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cAfterYears);
     this.AfterYearsProb           = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cAfterYearsProb);
     this.TimeTradeoffYears        = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimeTradeoffYears);
     this.EquityMultiplier         = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cEquityMultiplier);
     this.BenefitAssessment        = CalculatorHelpers.GetAttribute(currentCalculationsElement, cBenefitAssessment);
     this.QALY         = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cQALY);
     this.ICERQALY     = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cICERQALY);
     this.TTOQALY      = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTTOQALY);
     this.WillDoSurvey = CalculatorHelpers.GetAttributeBool(currentCalculationsElement, cWillDoSurvey);
 }
Пример #2
0
 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);
 }
Пример #3
0
 public void SetTotalME2Stat1Properties(ME2Stat1 ind,
                                        string attNameExtension, XElement calculator)
 {
     //stats always based on indicators
     SetTotalME2IndicatorStockProperties(ind, attNameExtension, calculator);
     //stats
     ind.TME2N = CalculatorHelpers.GetAttributeInt(calculator,
                                                   string.Concat(cTME2N, attNameExtension));
     ind.TotalME2MMean = CalculatorHelpers.GetAttributeDouble(calculator,
                                                              string.Concat(cTotalME2MMean, attNameExtension));
     ind.TotalME2MMedian = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                string.Concat(cTotalME2MMedian, attNameExtension));
     ind.TotalME2MVariance = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                  string.Concat(cTotalME2MVariance, attNameExtension));
     ind.TotalME2MStandDev = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                  string.Concat(cTotalME2MStandDev, attNameExtension));
     ind.TotalME2LMean = CalculatorHelpers.GetAttributeDouble(calculator,
                                                              string.Concat(cTotalME2LMean, attNameExtension));
     ind.TotalME2LMedian = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                string.Concat(cTotalME2LMedian, attNameExtension));
     ind.TotalME2LVariance = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                  string.Concat(cTotalME2LVariance, attNameExtension));
     ind.TotalME2LStandDev = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                  string.Concat(cTotalME2LStandDev, attNameExtension));
     ind.TotalME2UMean = CalculatorHelpers.GetAttributeDouble(calculator,
                                                              string.Concat(cTotalME2UMean, attNameExtension));
     ind.TotalME2UMedian = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                string.Concat(cTotalME2UMedian, attNameExtension));
     ind.TotalME2UVariance = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                  string.Concat(cTotalME2UVariance, attNameExtension));
     ind.TotalME2UStandDev = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                  string.Concat(cTotalME2UStandDev, attNameExtension));
 }
Пример #4
0
 //set the class properties using the XElement
 public void SetCEGeneralProperties(XElement calculator)
 {
     this.Outputs = CalculatorHelpers.GetAttributeInt(calculator,
                                                      OUTPUTS);
     this.Inputs = CalculatorHelpers.GetAttributeInt(calculator,
                                                     INPUTS);
 }
Пример #5
0
 public void SetLocalProperties(CalculatorParameters calcParameters,
                                XElement elementWithLocals, XElement currentElement)
 {
     //the host base is based on base calculator/analyzer properties (not currentElement)
     this.SetSharedObjectProperties(currentElement);
     this.Id          = CalculatorHelpers.GetAttributeInt(currentElement, Calculator1.cId);
     this.UnitGroupId = CalculatorHelpers.GetAttributeInt(elementWithLocals,
                                                          DataAppHelpers.Locals.UNITGROUP_ID);
     this.CurrencyGroupId = CalculatorHelpers.GetAttributeInt(elementWithLocals,
                                                              DataAppHelpers.Locals.CURRENCYGROUP_ID);
     this.RealRateId = CalculatorHelpers.GetAttributeInt(elementWithLocals,
                                                         DataAppHelpers.Locals.REAL_RATE_ID);
     this.NominalRateId = CalculatorHelpers.GetAttributeInt(elementWithLocals,
                                                            DataAppHelpers.Locals.NOMINAL_RATE_ID);
     this.RatingGroupId = CalculatorHelpers.GetAttributeInt(elementWithLocals,
                                                            DataAppHelpers.Locals.RATINGGROUP_ID);
     if (calcParameters.SubApplicationType == Constants.SUBAPPLICATION_TYPES.locals)
     {
         this.DataSourcePriceId = CalculatorHelpers.GetAttributeInt(elementWithLocals,
                                                                    DataAppHelpers.Locals.DATASOURCEPRICE_ID);
         this.GeoCodePriceId = CalculatorHelpers.GetAttributeInt(elementWithLocals,
                                                                 DataAppHelpers.Locals.GEOCODEPRICE_ID);
         this.DataSourceTechId = CalculatorHelpers.GetAttributeInt(elementWithLocals,
                                                                   DataAppHelpers.Locals.DATASOURCETECH_ID);
         this.GeoCodeTechId = CalculatorHelpers.GetAttributeInt(elementWithLocals,
                                                                DataAppHelpers.Locals.GEOCODETECH_ID);
     }
     this.RealRate = CalculatorHelpers.GetAttributeDouble(elementWithLocals,
                                                          DataAppHelpers.Locals.REAL_RATE);
     this.NominalRate = CalculatorHelpers.GetAttributeDouble(elementWithLocals,
                                                             DataAppHelpers.Locals.NOMINAL_RATE);
     this.InflationRate = CalculatorHelpers.GetAttributeDouble(elementWithLocals,
                                                               DataAppHelpers.Locals.INFLATION_RATE);
     this.XmlDocElement = elementWithLocals;
 }
Пример #6
0
        public bool SetOutput2Collection(
            XElement currentCalculationsElement, XElement currentElement)
        {
            bool bHasCalculations = false;
            //make an output object
            //note that the parent timeperiod resets timeliness penalties using the calcParams.ParentOutputs collection
            Output newOutput = new Output();

            newOutput.SetOutputProperties(this.GCCalculatorParams,
                                          currentCalculationsElement, currentElement);
            bHasCalculations = true;
            int iOutcomeId = CalculatorHelpers.GetAttributeInt(currentElement, BudgetInvestment.BUDGETSYSTEM_TO_OUTCOME_ID);

            if (this.GCCalculatorParams.SubApplicationType == Constants.SUBAPPLICATION_TYPES.investments)
            {
                iOutcomeId = CalculatorHelpers.GetAttributeInt(currentElement, BudgetInvestment.COSTSYSTEM_TO_OUTCOME_ID);
            }
            //the base subscriber's AddAncestor method sets this.GCCalculatorParams.ParentOutcome property
            if (this.GCCalculatorParams.ParentOutcome != null)
            {
                if (this.GCCalculatorParams.ParentOutcome.Id == iOutcomeId)
                {
                    //add it to collection
                    if (this.GCCalculatorParams.ParentOutcome.Outputs == null)
                    {
                        this.GCCalculatorParams.ParentOutcome.Outputs = new List <Output>();
                    }
                    this.GCCalculatorParams.ParentOutcome.Outputs.Add(newOutput);
                }
            }
            return(bHasCalculations);
        }
Пример #7
0
 public void SetFN1ConstantProperties(XElement currentCalculationsElement)
 {
     this.FNC1Id = CalculatorHelpers.GetAttributeInt(currentCalculationsElement,
                                                     cFNC1Id);
     this.FNC1Label = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                     cFNC1Label);
     this.FNC1Name = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                    cFNC1Name);
     this.FNC1Child1to3 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                         cFNC1Child1to3);
     this.FNC1Female4to8 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                          cFNC1Female4to8);
     this.FNC1Male4to8 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                        cFNC1Male4to8);
     this.FNC1Female9to13 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                           cFNC1Female9to13);
     this.FNC1Male9to13 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                         cFNC1Male9to13);
     this.FNC1Female14to18 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                            cFNC1Female14to18);
     this.FNC1Male14to18 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                          cFNC1Male14to18);
     this.FNC1Female19to30 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                            cFNC1Female19to30);
     this.FNC1Male19to30 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                          cFNC1Male19to30);
     this.FNC1Female31to50 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                            cFNC1Female31to50);
     this.FNC1Male31to50 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                          cFNC1Male31to50);
     this.FNC1Female51Plus = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                            cFNC1Female51Plus);
     this.FNC1Male51Plus = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                          cFNC1Male51Plus);
 }
Пример #8
0
 //set the class properties using the XElement
 public virtual void SetDemog3Properties(XElement currentCalculationsElement)
 {
     //don't set any input properties; each calculator should set what's needed separately
     this.Housing              = CalculatorHelpers.GetAttribute(currentCalculationsElement, cHousing);
     this.WorkStatus           = CalculatorHelpers.GetAttribute(currentCalculationsElement, cWorkStatus);
     this.MaritalStatus        = CalculatorHelpers.GetAttribute(currentCalculationsElement, cMaritalStatus);
     this.LocationId           = CalculatorHelpers.GetAttribute(currentCalculationsElement, cLocationId);
     this.FamilyIncomeCurrency = CalculatorHelpers.GetAttribute(currentCalculationsElement, cFamilyIncomeCurrency);
     this.FamilyIncomePerYear  = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cFamilyIncomePerYear);
 }
Пример #9
0
        public virtual void SetMachinery1InputProperties(XElement calculator)
        {
            //set this object's properties
            this.MarketValue = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                    cMarketValue);
            this.ListPriceAdj = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                     cListPriceAdj);
            this.SalvageValue = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                     cSalvageValue);
            this.FuelAmount = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                   cFuelAmount);
            this.FuelUnit = CalculatorHelpers.GetAttribute(calculator,
                                                           cFuelUnit);
            this.FuelPrice = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                  cFuelPrice);
            this.FuelCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                 cFuelCost);
            this.LubeOilAmount = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                      cLubeOilAmount);
            this.LubeOilUnit = CalculatorHelpers.GetAttribute(calculator,
                                                              cLubeOilUnit);
            this.LubeOilPrice = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                     cLubeOilPrice);
            this.LubeOilCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                    cLubeOilCost);
            this.RepairCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                   cRepairCost);
            this.LaborAmount = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                    cLaborAmount);
            this.LaborUnit = CalculatorHelpers.GetAttribute(calculator,
                                                            cLaborUnit);
            this.LaborPrice = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                   cLaborPrice);
            this.LaborCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                  cLaborCost);

            this.ServiceUnits = CalculatorHelpers.GetAttribute(calculator,
                                                               cServiceUnits);
            this.ServiceCapacityUnits = CalculatorHelpers.GetAttribute(calculator,
                                                                       cServiceCapacityUnits);
            this.CapitalRecoveryCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                            cCapitalRecoveryCost);
            this.TaxesHousingInsuranceCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                                  cTaxesHousingInsuranceCost);
            this.OptionForCapacity = CalculatorHelpers.GetAttributeInt(calculator,
                                                                       cOptionForCapacity);
            this.OptionForInflation = CalculatorHelpers.GetAttributeInt(calculator,
                                                                        cOptionForInflation);
            this.OptionForTime = CalculatorHelpers.GetAttributeInt(calculator,
                                                                   cOptionForTime);
            this.OptionForFuel = CalculatorHelpers.GetAttributeInt(calculator,
                                                                   cOptionForFuel);
            this.LaborAmountAdj = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                       cLaborAmountAdj);
        }
Пример #10
0
        //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;
        }
Пример #11
0
 //set the class properties using the XElement
 public void SetInputGroupProperties(
     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.DocStatus = CalculatorHelpers.GetAttribute(currentElement,
                                                     DataAppHelpers.General.DOC_STATUS);
     this.ServiceId = CalculatorHelpers.GetAttributeInt(currentElement,
                                                        DataAppHelpers.Agreement.SERVICE_ID);
     this.Local = new Local();
     //use the calculator params to set locals (they can be changed in calcor)
     this.Local.SetLocalProperties(calcParameters,
                                   currentCalculationsElement, currentElement);
     this.XmlDocElement = currentCalculationsElement;
 }
Пример #12
0
 //set the class properties using the XElement
 public void SetTimePeriodProperties(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.SetTotalCostsProperties(currentElement);
     if (currentElement.Name.LocalName.StartsWith(
         DataAppHelpers.Economics1.BUDGET_TYPES.budget.ToString()))
     {
         this.Amount = CalculatorHelpers.GetAttributeDouble(currentElement,
             DataAppHelpers.Economics1.BUDGET_TPENTERPRISE_AMOUNT);
     }
     else
     {
         this.Amount = CalculatorHelpers.GetAttributeDouble(currentElement,
             DataAppHelpers.Economics1.INVEST_TPENTERPRISE_AMOUNT);
     }
     this.Unit = CalculatorHelpers.GetAttribute(currentElement,
         DataAppHelpers.General.UNIT);
     this.IsDiscounted = CalculatorHelpers.GetAttributeBool(currentElement,
        DataAppHelpers.Economics1.ISDISCOUNTED);
     this.IsCommonReference = CalculatorHelpers.GetAttributeBool(currentElement,
         DataAppHelpers.Economics1.ISCOMMON_REFERENCE);
     this.GrowthPeriods = CalculatorHelpers.GetAttributeInt(currentElement,
         DataAppHelpers.Economics1.GROWTH_PERIODS);
     this.GrowthTypeId = CalculatorHelpers.GetAttributeInt(currentElement,
         DataAppHelpers.Economics1.GROWTH_TYPE_ID);
     this.OverheadFactor = CalculatorHelpers.GetAttributeDouble(currentElement,
         DataAppHelpers.Economics1.OVERHEAD_FACTOR);
     this.IncentiveAmount = CalculatorHelpers.GetAttributeDouble(currentElement,
         DataAppHelpers.General.INCENTIVE_AMOUNT);
     this.IncentiveRate = CalculatorHelpers.GetAttributeDouble(currentElement,
         DataAppHelpers.General.INCENTIVE_RATE);
     this.AnnuityType = GetAnnuityType(currentElement);
     this.XmlDocElement = currentCalculationsElement;
 }
Пример #13
0
 public void SetMachinery1ConstantProperties(CalculatorParameters calcParameters,
                                             XElement currentCalculationsElement, XElement currentElement)
 {
     this.MachConstantId = CalculatorHelpers.GetAttributeInt(currentCalculationsElement,
                                                             cMachConstantId);
     this.MachConstantGroupId = CalculatorHelpers.GetAttributeInt(currentCalculationsElement,
                                                                  cMachConstantGroupId);
     this.ServiceCapacity = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                                 cServiceCapacity);
     this.RF1 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                     cRF1);
     this.RF2 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                     cRF2);
     this.RV1 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                     cRV1);
     this.RV2 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                     cRV2);
     this.RV3 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                     cRV3);
     this.FuelType = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                    cFuelType);
     this.LaborType = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                     cLaborType);
     this.Width = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                       cWidth);
     this.StartingHrs = CalculatorHelpers.GetAttributeInt(currentCalculationsElement,
                                                          cStartingHrs);
     this.PlannedUseHrs = CalculatorHelpers.GetAttributeInt(currentCalculationsElement,
                                                            cPlannedUseHrs);
     this.UsefulLifeHrs = CalculatorHelpers.GetAttributeInt(currentCalculationsElement,
                                                            cUsefulLifeHrs);
     this.HP = CalculatorHelpers.GetAttributeInt(currentCalculationsElement,
                                                 cHP);
     this.HPPTOEquiv = CalculatorHelpers.GetAttributeInt(currentCalculationsElement,
                                                         cHPPTOEquiv);
     this.HPPTOMax = CalculatorHelpers.GetAttributeInt(currentCalculationsElement,
                                                       cHPPTOMax);
     this.FieldEffRange = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                         cFieldEffRange);
     this.FieldSpeedRange = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                           cFieldSpeedRange);
     this.FieldSpeedRangekm = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                             cFieldSpeedRangekm);
     this.FieldSpeedTypical = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                                   cFieldSpeedTypical);
     this.FieldSpeedTypicalkm = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                                     cFieldSpeedTypicalkm);
     this.FieldEffTypical = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                                 cFieldEffTypical);
     this.TotalLifeRandM = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                                cTotalLifeRandM);
     this.PriceGas = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                          cPriceGas);
     this.PriceDiesel = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                             cPriceDiesel);
     this.PriceLP = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                         cPriceLP);
     this.PriceElectric = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                               cPriceElectric);
     this.PriceNG = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                         cPriceNG);
     this.PriceOil = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                          cPriceOil);
     this.PriceRegularLabor = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                                   cPriceRegularLabor);
     this.PriceMachineryLabor = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                                     cPriceMachineryLabor);
     this.PriceSupervisorLabor = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                                      cPriceSupervisorLabor);
     this.HousingPercent = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                                cHousingPercent);
     this.TaxPercent = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                            cTaxPercent);
     this.InsurePercent = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement,
                                                               cInsurePercent);
 }
Пример #14
0
        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;
                    }
                }
            }
        }
Пример #15
0
 //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;
 }
Пример #16
0
 //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;
 }