示例#1
0
        //set the class properties using the XElement
        public void SetBudgetInvestmentProperties(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);
            //this.Id = CalculatorHelpers.GetAttributeInt(currentElement, Calculator1.cId);
            this.InitialValue = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                                     DataAppHelpers.Prices.INITIAL_VALUE);
            this.SalvageValue = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                                     DataAppHelpers.Prices.SALVAGE_VALUE);
            this.InvestmentEAA = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                                      INVESTMENTEAA);
            this.Local = new Local();
            //can't use calcParams.CurrentElementURIPattern because also gets set from ancestors
            string sCurrentNodeURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(
                      calcParameters.ExtensionDocToCalcURI.URIPattern, currentElement);

            this.Local = CalculatorHelpers.GetLocal(sCurrentNodeURIPattern, calcParameters,
                                                    currentCalculationsElement, currentElement);
            this.XmlDocElement = currentCalculationsElement;
        }
        //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;
        }
示例#3
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;
 }
示例#4
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;
 }