public bool AddCalculationsToCurrentElement(XElement currentCalculationsElement, XElement currentElement) { bool bHasCalculations = false; if (currentElement.Name.LocalName == OperationComponent.OPERATION_PRICE_TYPES.operationgroup.ToString() || currentElement.Name.LocalName == OperationComponent.COMPONENT_PRICE_TYPES.componentgroup.ToString()) { if (BIM2Calculator.GCCalculatorParams.AnalyzerParms.AnalyzerType == ARSAnalyzerHelper.ANALYZER_TYPES.resources02.ToString()) { //fill in the collections with base timeliness penalties bHasCalculations = BIM2Calculator.SetTotalMachinery2StockJointCalculations( currentCalculationsElement, currentElement); } else if (BIM2Calculator.GCCalculatorParams.AnalyzerParms.AnalyzerType == ARSAnalyzerHelper.ANALYZER_TYPES.resources02a.ToString()) { //fill in the collections with feasible machinery selections //if further work is needed use this.TimelinessTimePeriod.TimelinessOpComps collection bHasCalculations = BIM2aCalculator.SetTotalMachinery2aStockCalculations( currentCalculationsElement, currentElement); } } else if (currentElement.Name.LocalName .EndsWith(OperationComponent.OPERATION_PRICE_TYPES.operation.ToString()) || currentElement.Name.LocalName .EndsWith(OperationComponent.COMPONENT_PRICE_TYPES.component.ToString())) { if (BIM2Calculator.GCCalculatorParams.AnalyzerParms.AnalyzerType == ARSAnalyzerHelper.ANALYZER_TYPES.resources02.ToString()) { //fill in the collections with base timeliness penalties bHasCalculations = BIM2Calculator.SetOpOrCompMachinery2StockJointCalculations( currentCalculationsElement, currentElement); } else if (BIM2Calculator.GCCalculatorParams.AnalyzerParms.AnalyzerType == ARSAnalyzerHelper.ANALYZER_TYPES.resources02a.ToString()) { //fill in the collections with optimum machinery selections bHasCalculations = BIM2aCalculator.SetOpOrCompMachinery2aStockCalculations( currentCalculationsElement, currentElement); } } else if (currentElement.Name.LocalName .EndsWith(Input.INPUT_PRICE_TYPES.input.ToString())) { if (BIM2Calculator.GCCalculatorParams.AnalyzerParms.AnalyzerType == ARSAnalyzerHelper.ANALYZER_TYPES.resources02.ToString()) { //fill in the collections with base timeliness penalties bHasCalculations = BIM2Calculator.SetInputMachinery2StockJointCalculations( currentCalculationsElement, currentElement); } else if (BIM2Calculator.GCCalculatorParams.AnalyzerParms.AnalyzerType == ARSAnalyzerHelper.ANALYZER_TYPES.resources02a.ToString()) { //fill in the collections with optimum machinery selections bHasCalculations = BIM2aCalculator.SetInputMachinery2aStockCalculations( currentCalculationsElement, currentElement); } } return(bHasCalculations); }
private bool RunBudgetInvestmentCalculation(ref XElement currentElement, ref XElement currentCalculationsElement) { bool bHasCalculations = false; CalculatorHelpers.CALCULATOR_TYPES eCalculatorType = CalculatorHelpers.GetCalculatorType(this.GCCalculatorParams.CalculatorType); switch (eCalculatorType) { case CalculatorHelpers.CALCULATOR_TYPES.budget: if (this.GCCalculatorParams.RelatedCalculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.agmachinery.ToString()) { if (this.GCCalculatorParams.AnalyzerParms.AnalyzerType == ARSAnalyzerHelper.ANALYZER_TYPES.resources02.ToString()) { bHasCalculations = BIM2Calculator.AddStock2CalculationsToCurrentElement( ref currentCalculationsElement, ref currentElement); } else if (this.GCCalculatorParams.AnalyzerParms.AnalyzerType == ARSAnalyzerHelper.ANALYZER_TYPES.resources02a.ToString()) { bHasCalculations = BIM2aCalculator.AddStock2aCalculationsToCurrentElement( ref currentCalculationsElement, ref currentElement); } else { bHasCalculations = BIM1Calculator.AddStock1CalculationsToCurrentElement( ref currentCalculationsElement, ref currentElement); } } else if (this.GCCalculatorParams.RelatedCalculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.irrpower.ToString()) { bHasCalculations = BIIP1Calculator.AddCalculationsToCurrentElement( ref currentCalculationsElement, ref currentElement); } else if (this.GCCalculatorParams.RelatedCalculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.gencapital.ToString()) { bHasCalculations = BIGC1Calculator.AddCalculationsToCurrentElement( ref currentCalculationsElement, ref currentElement); } break; case CalculatorHelpers.CALCULATOR_TYPES.investment: if (this.GCCalculatorParams.RelatedCalculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.agmachinery.ToString()) { if (this.GCCalculatorParams.AnalyzerParms.AnalyzerType == ARSAnalyzerHelper.ANALYZER_TYPES.resources02.ToString()) { bHasCalculations = BIM2Calculator.AddStock2CalculationsToCurrentElement( ref currentCalculationsElement, ref currentElement); } else if (this.GCCalculatorParams.AnalyzerParms.AnalyzerType == ARSAnalyzerHelper.ANALYZER_TYPES.resources02a.ToString()) { bHasCalculations = BIM2aCalculator.AddStock2aCalculationsToCurrentElement( ref currentCalculationsElement, ref currentElement); } else { bHasCalculations = BIM1Calculator.AddStock1CalculationsToCurrentElement( ref currentCalculationsElement, ref currentElement); } } else if (this.GCCalculatorParams.RelatedCalculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.irrpower.ToString()) { bHasCalculations = BIIP1Calculator.AddCalculationsToCurrentElement( ref currentCalculationsElement, ref currentElement); } else if (this.GCCalculatorParams.RelatedCalculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.gencapital.ToString()) { bHasCalculations = BIGC1Calculator.AddCalculationsToCurrentElement( ref currentCalculationsElement, ref currentElement); } break; default: break; } bHasCalculations = TransferErrors(bHasCalculations); //some calcparams have to be passed back to this.calcparams UpdateCalculatorParams(currentElement.Name.LocalName); return(bHasCalculations); }