//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;
        }
Exemple #2
0
        private bool RunBasicCalculationsAndSetUpdates(ref XElement currentElement)
        {
            bool bHasCalculations = false;

            if (!currentElement.HasAttributes)
            {
                return(true);
            }
            //1. set parameters needed by updates collection
            this.GCCalculatorParams.CurrentElementNodeName
                = currentElement.Name.LocalName;
            this.GCCalculatorParams.CurrentElementURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                                                                 currentElement);
            //2. don't run calcs on ancestors
            bool bIsSelfOrDescendentNode = CalculatorHelpers.IsSelfOrDescendentNode(
                this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName);

            if (bIsSelfOrDescendentNode)
            {
                //3. get the calculator to use
                //(this.GCCalculatorParams.CalculationEl, or currentElement.xmldoc)
                XElement linkedViewElement = null;
                linkedViewElement = CalculatorHelpers.GetCalculator(
                    this.GCCalculatorParams, currentElement);
                //some apps, such as locals, work differently
                AdjustSpecialtyLinkedViewElements(currentElement, ref linkedViewElement);
                //4. Set bool to update base node attributes in db
                this.GCCalculatorParams.AttributeNeedsDbUpdate
                    = CalculatorHelpers.NeedsUpdateAttribute(this.GCCalculatorParams);
                //5. raise event to carry out calculations
                GCArguments.CurrentElement    = currentElement;
                GCArguments.LinkedViewElement = linkedViewElement;
                OnRunCalculation(GCArguments);
                currentElement    = GCArguments.CurrentElement;
                linkedViewElement = GCArguments.LinkedViewElement;
                bHasCalculations  = GCArguments.HasCalculations;
                if (bHasCalculations)
                {
                    //6. 100% Rules: don't allow analyzers to db update descendent calculators
                    ChangeLinkedViewCalculator(currentElement, ref linkedViewElement);
                    //7. replace the this.GCCalculatorParams.LinkedViewElement when
                    //the originating doctocalcuri node is processed
                    bool bHasReplacedCalculator = CalculatorHelpers.ReplaceCalculations(this.GCCalculatorParams,
                                                                                        currentElement, linkedViewElement);
                    //8. SetXmlDocAttributes
                    CalculatorHelpers.SetXmlDocUpdates(this.GCCalculatorParams,
                                                       linkedViewElement, ref currentElement,
                                                       this.GCCalculatorParams.Updates);
                }
            }
            else
            {
                //basic calculators don't need full collections that include ancestors
                bHasCalculations = true;
            }
            return(bHasCalculations);
        }
        //doesn't run analysis yet; just fills in stateful model for object analysis
        private async Task <bool> RunBasicAnalysisAndSetUpdates(XElement currentElement)
        {
            bool bHasCalculations = false;

            if (!currentElement.HasAttributes)
            {
                return(true);
            }
            //1. set parameters needed by updates collection
            this.GCCalculatorParams.CurrentElementNodeName
                = currentElement.Name.LocalName;
            this.GCCalculatorParams.CurrentElementURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                                                                 currentElement);
            //2. don't run calcs on ancestors
            bool bIsSelfOrDescendentNode = CalculatorHelpers.IsSelfOrDescendentNode(
                this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName);

            if (bIsSelfOrDescendentNode)
            {
                //3. get the calculator to use
                //(this.GCCalculatorParams.CalculationEl, or currentElement.xmldoc)
                XElement linkedViewElement = null;
                linkedViewElement = CalculatorHelpers.GetCalculator(
                    this.GCCalculatorParams, currentElement);
                //4. Set bool to update base node attributes in db
                this.GCCalculatorParams.AttributeNeedsDbUpdate
                    = CalculatorHelpers.NeedsUpdateAttribute(this.GCCalculatorParams);
                //5. raise event to carry out analysis (no tasks, just property manipulation)
                bHasCalculations = await SetAnalysisModel(currentElement, linkedViewElement);

                if (bHasCalculations)
                {
                    //6. allow analyzers to db update descendent analyzers
                    CalculatorHelpers.ChangeLinkedViewCalculatorForAnalysis(this.GCCalculatorParams, currentElement, ref linkedViewElement);
                    //7. replace the this.GCCalculatorParams.LinkedViewElement when
                    //the originating doctocalcuri node is processed
                    bool bHasReplacedCalculator = CalculatorHelpers.ReplaceCalculations(this.GCCalculatorParams,
                                                                                        currentElement, linkedViewElement);
                    //8. SetXmlDocAttributes
                    CalculatorHelpers.SetXmlDocUpdates(this.GCCalculatorParams,
                                                       linkedViewElement, ref currentElement,
                                                       this.GCCalculatorParams.Updates);
                }
            }
            else
            {
                XElement linkedViewElement = null;
                bHasCalculations = await SetAnalysisModel(currentElement, linkedViewElement);

                //always return true, so no error msg is generated
                bHasCalculations = true;
            }
            return(bHasCalculations);
        }
        //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;
        }
        private bool RunStatisticalCalculation(XElement currentElement)
        {
            bool bHasCalculations = false;

            //1. set parameters needed by updates collection
            this.GCCalculatorParams.CurrentElementNodeName
                = currentElement.Name.LocalName;
            this.GCCalculatorParams.CurrentElementURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(
                      this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern, currentElement);
            //2. carry out calculations
            bHasCalculations = RunOperationComponentStatistic(currentElement);
            if (!bHasCalculations &&
                string.IsNullOrEmpty(this.GCCalculatorParams.ErrorMessage))
            {
                this.GCCalculatorParams.ErrorMessage
                    += Errors.MakeStandardErrorMsg("ANALYSES_CANTRUN");
            }
            return(bHasCalculations);
        }
Exemple #6
0
        private bool RunStatisticalCalculation(ref XElement currentElement)
        {
            bool bHasCalculations = false;

            //1. set parameters needed by updates collection
            this.GCCalculatorParams.CurrentElementNodeName
                = currentElement.Name.LocalName;
            this.GCCalculatorParams.CurrentElementURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(
                      this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                      currentElement);
            GCArguments.CurrentElement = currentElement;
            OnRunCalculation(GCArguments);
            currentElement   = GCArguments.CurrentElement;
            bHasCalculations = GCArguments.HasCalculations;
            if (!bHasCalculations &&
                string.IsNullOrEmpty(this.GCCalculatorParams.ErrorMessage))
            {
                this.GCCalculatorParams.ErrorMessage
                    += Errors.MakeStandardErrorMsg("ANALYSES_CANTRUN");
            }
            return(bHasCalculations);
        }
        private async Task <bool> RunBasicCalculationsAndSetUpdatesAsync(XElement currentElement)
        {
            bool bHasCalculations = false;

            if (!currentElement.HasAttributes)
            {
                return(true);
            }
            //1. set parameters needed by updates collection
            this.GCCalculatorParams.CurrentElementNodeName
                = currentElement.Name.LocalName;
            this.GCCalculatorParams.CurrentElementURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                                                                 currentElement);
            //2. don't run calcs on ancestors
            bool bIsSelfOrDescendentNode = CalculatorHelpers.IsSelfOrDescendentNode(
                this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName);

            if (bIsSelfOrDescendentNode)
            {
                //3. get the calculator to use
                //(this.GCCalculatorParams.CalculationEl, or currentElement.xmldoc)
                XElement linkedViewElement = null;
                linkedViewElement = CalculatorHelpers.GetCalculator(
                    this.GCCalculatorParams, currentElement);
                //some apps, such as locals, work differently
                CalculatorHelpers.AdjustSpecialtyLinkedViewElements(currentElement, linkedViewElement, this.GCCalculatorParams);
                //4. Set bool to update base node attributes in db
                this.GCCalculatorParams.AttributeNeedsDbUpdate
                    = CalculatorHelpers.NeedsUpdateAttribute(this.GCCalculatorParams);
                //5. raise event to carry out calculations
                //v180: no children xml doc changes when Overwrite = false and UseSameCalc = false
                bool bNeedsLVUpdate = CalculatorHelpers.NeedsLVUpdate(this.GCCalculatorParams);
                if (bNeedsLVUpdate)
                {
                    bHasCalculations
                        = await RunCalculationAsync(currentElement, linkedViewElement);
                }
                else
                {
                    //but if it's a child it might still need to be displayed
                    //will only be displayed by setting CalculatorId or AnalyzerType in currentEl
                    if (CalculatorHelpers.IsSelfOrChildNode(this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName))
                    {
                        CalculatorHelpers.SetCalculatorId(linkedViewElement, currentElement);
                    }
                }
                if (bHasCalculations)
                {
                    //v182 added resetting because async starts next node (i.e. parent) and these change before the method is finished
                    //1. set parameters needed by updates collection
                    //this.GCCalculatorParams.CurrentElementNodeName
                    //    = currentElement.Name.LocalName;
                    //this.GCCalculatorParams.CurrentElementURIPattern
                    //    = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                    //    currentElement);
                    //6. 100% Rules: don't allow analyzers to db update descendent calculators
                    CalculatorHelpers.ChangeLinkedViewCalculator(currentElement, linkedViewElement, this.GCCalculatorParams);
                    //7. replace the this.GCCalculatorParams.LinkedViewElement when
                    //the originating doctocalcuri node is processed
                    bool bHasReplacedCalculator = CalculatorHelpers.ReplaceCalculations(this.GCCalculatorParams,
                                                                                        currentElement, linkedViewElement);
                    //8. v180 SetXmlDocAttributes only set db updates (xmldoc lvs are automatically changed by RunCalcAsync)
                    CalculatorHelpers.SetXmlDocUpdates(this.GCCalculatorParams,
                                                       linkedViewElement, currentElement, this.GCCalculatorParams.Updates);
                }
            }
            else
            {
                //basic calculators don't need full collections that include ancestobrs
                bHasCalculations = true;
            }
            return(bHasCalculations);
        }
Exemple #8
0
        private bool RunIOTechCalculationsAndSetUpdates(ref XElement currentElement)
        {
            bool bHasCalculations = false;

            if (!currentElement.HasAttributes)
            {
                return(true);
            }
            //1. set parameters needed by updates collection
            this.GCCalculatorParams.CurrentElementNodeName
                = currentElement.Name.LocalName;
            this.GCCalculatorParams.CurrentElementURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                                                                 currentElement);
            //2. don't run calcs on ancestors
            bool bIsSelfOrDescendentNode = CalculatorHelpers.IsSelfOrDescendentNode(
                this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName);

            if (bIsSelfOrDescendentNode)
            {
                //3. get the calculator to use
                //(this.GCCalculatorParams.CalculationEl, or currentElement.xmldoc)
                XElement linkedViewElement       = null;
                bool     bNeedsRelatedCalculator = NeedsRelatedCalculator();
                if (bNeedsRelatedCalculator)
                {
                    //no db updates -potential to continually have to update in/outs in db
                    linkedViewElement
                        = CalculatorHelpers.GetRelatedCalculator(this.GCCalculatorParams,
                                                                 currentElement);
                }
                else
                {
                    //don't use calctype = input; prefer using stronger relatedcalctype=agmachinery
                    string sCalculatorType = this.GCCalculatorParams.CalculatorType;
                    this.GCCalculatorParams.CalculatorType = string.Empty;
                    linkedViewElement
                        = CalculatorHelpers.GetCalculator(this.GCCalculatorParams,
                                                          currentElement);
                    this.GCCalculatorParams.CalculatorType = sCalculatorType;
                }
                //4. Set bool to update base node attributes in db
                this.GCCalculatorParams.AttributeNeedsDbUpdate
                    = CalculatorHelpers.NeedsUpdateAttribute(this.GCCalculatorParams);
                //5. raise event to carry out calculations
                GCArguments.CurrentElement    = currentElement;
                GCArguments.LinkedViewElement = linkedViewElement;
                OnRunCalculation(GCArguments);
                currentElement    = GCArguments.CurrentElement;
                linkedViewElement = GCArguments.LinkedViewElement;
                bHasCalculations  = GCArguments.HasCalculations;
                //6. 100% Rules: don't allow analyzers to db update descendent calculators
                ChangeLinkedViewCalculator(currentElement, ref linkedViewElement);
                //inputs have a join-side xmldoc that may need to be updated
                //to current calculator results (i.e. Input.Times can change
                //the amount of fuel, labor, and other resources for this input)
                //note that the base npvcalculator does not always adjust
                //resource calculator amounts, such as fuel and labor, when
                //Input.Times change (if it did, the following would not be needed).
                if (CalculatorHelpers.IsLinkedViewXmlDoc(
                        this.GCCalculatorParams.CurrentElementURIPattern,
                        this.GCCalculatorParams.ExtensionDocToCalcURI))
                {
                    //7. replace the this.GCCalculatorParams.CalculationsElement when
                    //the originating doctocalcuri node is processed
                    bool bHasReplacedCalculator = CalculatorHelpers.ReplaceCalculations(
                        this.GCCalculatorParams, currentElement,
                        linkedViewElement);
                    //8. this pattern combines analyzer and calculator patterns
                    CalculatorHelpers.SetAnalyzerParameters(
                        this.GCCalculatorParams, linkedViewElement);
                }
                //9. SetXmlDocAttributes
                CalculatorHelpers.SetXmlDocUpdates(this.GCCalculatorParams,
                                                   linkedViewElement, ref currentElement,
                                                   this.GCCalculatorParams.Updates);
            }
            else
            {
                //version 1.3.0 added this so that ancestors are always added to collections
                //to make analyses consistent (i.e. always start with group)
                GCArguments.CurrentElement = currentElement;
                //ancestors can never update or use a linkedview element
                GCArguments.LinkedViewElement = null;
                //but we want the ancestor current element added to the underlying collections
                OnRunCalculation(GCArguments);
                //always return true, so no error msg is generated
                bHasCalculations = true;
            }
            return(bHasCalculations);
        }
Exemple #9
0
        private bool RunBasicAnalysisAndSetUpdates(ref XElement currentElement)
        {
            bool bHasCalculations = false;

            if (!currentElement.HasAttributes)
            {
                return(true);
            }
            //1. set parameters needed by updates collection
            this.GCCalculatorParams.CurrentElementNodeName
                = currentElement.Name.LocalName;
            this.GCCalculatorParams.CurrentElementURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                                                                 currentElement);
            //2. don't run calcs on ancestors
            bool bIsSelfOrDescendentNode = CalculatorHelpers.IsSelfOrDescendentNode(
                this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName);

            if (bIsSelfOrDescendentNode)
            {
                //3. get the calculator to use
                //(this.GCCalculatorParams.CalculationEl, or currentElement.xmldoc)
                XElement linkedViewElement = null;
                linkedViewElement = CalculatorHelpers.GetCalculator(
                    this.GCCalculatorParams, currentElement);
                //4. Set bool to update base node attributes in db
                this.GCCalculatorParams.AttributeNeedsDbUpdate
                    = CalculatorHelpers.NeedsUpdateAttribute(this.GCCalculatorParams);
                //5. raise event to carry out calculations
                GCArguments.CurrentElement    = currentElement;
                GCArguments.LinkedViewElement = linkedViewElement;
                OnRunCalculation(GCArguments);
                currentElement = GCArguments.CurrentElement;
                //subscriber sets the lv to update
                linkedViewElement = GCArguments.LinkedViewElement;
                bHasCalculations  = GCArguments.HasCalculations;
                if (bHasCalculations)
                {
                    //6. allow analyzers to db update descendent analyzers
                    CalculatorHelpers.ChangeLinkedViewCalculatorForAnalysis(this.GCCalculatorParams, currentElement,
                                                                            ref linkedViewElement);
                    //7. replace the this.GCCalculatorParams.LinkedViewElement when
                    //the originating doctocalcuri node is processed
                    bool bHasReplacedCalculator = CalculatorHelpers.ReplaceCalculations(this.GCCalculatorParams,
                                                                                        currentElement, linkedViewElement);
                    //8. SetXmlDocAttributes
                    CalculatorHelpers.SetXmlDocUpdates(this.GCCalculatorParams,
                                                       linkedViewElement, ref currentElement,
                                                       this.GCCalculatorParams.Updates);
                }
            }
            else
            {
                //version 1.3.6 added this so that ancestors are always added to collections
                //to make analyses consistent (i.e. always start with group)
                GCArguments.CurrentElement = currentElement;
                //ancestors can never update or use a linkedview element
                GCArguments.LinkedViewElement = null;
                //but we want the ancestor current element added to the underlying collections
                OnRunCalculation(GCArguments);
                //always return true, so no error msg is generated
                bHasCalculations = true;
            }
            return(bHasCalculations);
        }
Exemple #10
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;
 }
Exemple #11
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;
 }