Exemplo n.º 1
0
        //kept for consistency with Extension pattern, but NPV calculators use the NPVCalcs extension
        public async Task <bool> RunCalculatorStep(
            ExtensionContentURI extDocToCalcURI, ExtensionContentURI extCalcDocURI,
            string stepNumber, IList <string> urisToAnalyze,
            IDictionary <string, string> updates, CancellationToken cancellationToken)
        {
            bool bHasCalculation = false;
            CalculatorHelpers    eCalcHelpers = new CalculatorHelpers();
            CalculatorParameters NPV1CalcParams
                = CalculatorHelpers.SetCalculatorParameters(
                      extDocToCalcURI, extCalcDocURI, stepNumber, urisToAnalyze,
                      updates);
            NPV1CalculatorHelper npv1BudgetHelper
                = new NPV1CalculatorHelper(NPV1CalcParams);

            ContractHelpers.EXTENSION_STEPS eStepNumber
                = ContractHelpers.GetEnumStepNumber(stepNumber);
            bool bHasUpdates = false;

            switch (eStepNumber)
            {
            case ContractHelpers.EXTENSION_STEPS.stepzero:
                bHasCalculation = true;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepone:
                bHasCalculation = true;
                break;

            case ContractHelpers.EXTENSION_STEPS.steptwo:
                //clear updates collection
                updates.Clear();
                if (NPV1CalcParams != null)
                {
                    //set constants for this step
                    bHasCalculation
                        = await NPV1CalculatorHelper.SetConstants(NPV1CalcParams);
                }
                extDocToCalcURI.URIDataManager.NeedsFullView    = false;
                extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepthree:
                //get rid of any update member that was added after running the same step 2x
                bHasUpdates = await CalculatorHelpers.RefreshUpdates(NPV1CalcParams, stepNumber, updates);

                if (NPV1CalcParams != null)
                {
                    //no constants; just an xml edit of NRImpacts
                    bHasCalculation = true;
                }
                extDocToCalcURI.URIDataManager.NeedsFullView    = false;
                extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepfour:
                //get rid of any update member that was added after running the same step 2x
                bHasUpdates = await CalculatorHelpers.RefreshUpdates(NPV1CalcParams, stepNumber, updates);

                if (NPV1CalcParams != null)
                {
                    if (NPV1CalcParams.ExtensionDocToCalcURI.URIDataManager.SubAppType
                        != Constants.SUBAPPLICATION_TYPES.devpacks.ToString())
                    {
                        //run the calculations
                        bHasCalculation = await npv1BudgetHelper.RunNPV1CalculatorCalculations();
                    }
                    else
                    {
                        //run custom document calculations
                        bHasCalculation
                            = await npv1BudgetHelper.RunDevPacksCalculations(NPV1CalcParams);
                    }
                    extDocToCalcURI.ErrorMessage  = NPV1CalcParams.ErrorMessage;
                    extDocToCalcURI.ErrorMessage += NPV1CalcParams.ExtensionDocToCalcURI.ErrorMessage;
                    if (!bHasCalculation)
                    {
                        extDocToCalcURI.ErrorMessage = (extDocToCalcURI.ErrorMessage == string.Empty) ?
                                                       Errors.MakeStandardErrorMsg("CALCULATORS_URI_MISMATCH")
                                : extDocToCalcURI.ErrorMessage;
                        return(bHasCalculation);
                    }
                    if (string.IsNullOrEmpty(extDocToCalcURI.ErrorMessage))
                    {
                        //two step calculators need to be saved now
                        CheckForLastStepCalculator(NPV1CalcParams,
                                                   eStepNumber, extDocToCalcURI);
                        //replace the old calculator with the new one
                        //and save the new calculations document
                        bHasCalculation
                            = await CalculatorHelpers.SaveNewCalculationsDocument(NPV1CalcParams);
                    }
                    else
                    {
                        bHasCalculation = false;
                    }
                }
                extDocToCalcURI.URIDataManager.NeedsFullView    = true;
                extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepfive:
                extDocToCalcURI.URIDataManager.NeedsFullView    = false;
                extDocToCalcURI.URIDataManager.NeedsSummaryView = true;
                extCalcDocURI.URIFileExtensionType = CalculatorHelpers.GetAttribute(NPV1CalcParams.LinkedViewElement,
                                                                                    Calculator1.cFileExtensionType);
                bHasCalculation = true;
                //tells addinhelper to save calcs
                CalculatorHelpers.SetTempDocSaveCalcsProperty(extDocToCalcURI);
                break;

            default:
                //as many steps as needed can be added to this addin
                break;
            }
            extDocToCalcURI.ErrorMessage += NPV1CalcParams.ErrorMessage;
            return(bHasCalculation);
        }
Exemplo n.º 2
0
        public async Task <bool> RunAnalyzerStep(
            ExtensionContentURI extDocToCalcURI, ExtensionContentURI extCalcDocURI,
            string stepNumber, IList <string> urisToAnalyze,
            IDictionary <string, string> updates, CancellationToken cancellationToken)
        {
            bool bHasAnalysis = false;
            CalculatorParameters npv1CalcParams
                = CalculatorHelpers.SetCalculatorParameters(
                      extDocToCalcURI, extCalcDocURI, stepNumber, urisToAnalyze,
                      updates);
            NPV1AnalyzerHelper npv1AnalyzerHelper = new NPV1AnalyzerHelper(npv1CalcParams);

            //check to make sure the analyzer can be run
            npv1AnalyzerHelper.SetOptions();
            bool bHasUpdates = false;

            if (npv1AnalyzerHelper.NPV1CalculatorParams.ErrorMessage != string.Empty)
            {
                extDocToCalcURI.ErrorMessage += npv1AnalyzerHelper.NPV1CalculatorParams.ErrorMessage;
                return(false);
            }
            ContractHelpers.EXTENSION_STEPS eStepNumber
                = ContractHelpers.GetEnumStepNumber(stepNumber);
            switch (eStepNumber)
            {
            case ContractHelpers.EXTENSION_STEPS.stepzero:
                bHasAnalysis = true;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepone:
                bHasAnalysis = true;
                break;

            case ContractHelpers.EXTENSION_STEPS.steptwo:
                //clear updates collection
                updates.Clear();
                //just need the html form edits in this step
                bHasAnalysis = true;
                extDocToCalcURI.URIDataManager.NeedsFullView    = false;
                extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepthree:
                //get rid of any update member that was added after running the same step 2x
                bHasUpdates = await CalculatorHelpers.RefreshUpdates(npv1CalcParams, stepNumber, updates);

                //linked view insertions needs some analysis parameters
                SetAnalyzerParameters(npv1AnalyzerHelper, npv1CalcParams);
                if (npv1CalcParams.SubApplicationType == Constants.SUBAPPLICATION_TYPES.devpacks)
                {
                    bHasAnalysis = await npv1AnalyzerHelper.RunAnalysis(npv1CalcParams.UrisToAnalyze);
                }
                else
                {
                    bHasAnalysis = await npv1AnalyzerHelper.RunAnalysis();
                }
                extDocToCalcURI.ErrorMessage  = npv1CalcParams.ErrorMessage;
                extDocToCalcURI.ErrorMessage += npv1AnalyzerHelper.NPV1CalculatorParams.ErrorMessage;
                if (!bHasAnalysis)
                {
                    extDocToCalcURI.ErrorMessage = (extDocToCalcURI.ErrorMessage == string.Empty) ?
                                                   Errors.MakeStandardErrorMsg("CALCULATORS_URI_MISMATCH")
                            : extDocToCalcURI.ErrorMessage;
                    return(bHasAnalysis);
                }
                if (string.IsNullOrEmpty(extDocToCalcURI.ErrorMessage))
                {
                    //two step analyzers need to be saved now
                    NPV1AnalyzerHelper.ANALYZER_TYPES eAnalyzerType
                        = npv1AnalyzerHelper.GetAnalyzerType(
                              npv1AnalyzerHelper.NPV1CalculatorParams.AnalyzerParms.AnalyzerType);
                    //when 3+ step analyzers start being used
                    CheckForLastStepAnalyzer(eAnalyzerType,
                                             eStepNumber, extDocToCalcURI);
                    if (!CalculatorHelpers.IsSaveAction(extDocToCalcURI))
                    {
                        //replace the old calculator with the new one
                        //and save the new calculations document
                        bool bHasReplacedCalcDoc
                            = await CalculatorHelpers.SaveNewCalculationsDocument(
                                  npv1AnalyzerHelper.NPV1CalculatorParams);

                        if (bHasReplacedCalcDoc)
                        {
                            bHasAnalysis = true;
                        }
                        else
                        {
                            extDocToCalcURI.ErrorMessage = Errors.MakeStandardErrorMsg("ANALYSES_ID_MISMATCH");
                        }
                    }
                }
                else
                {
                    bHasAnalysis = false;
                }
                extDocToCalcURI.URIDataManager.NeedsFullView    = true;
                extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepfour:
                bHasAnalysis = true;
                if (npv1AnalyzerHelper.AnalyzerType
                    == NPV1AnalyzerHelper.ANALYZER_TYPES.npvtotal1 ||
                    npv1AnalyzerHelper.AnalyzerType
                    == NPV1AnalyzerHelper.ANALYZER_TYPES.npvstat1 ||
                    npv1AnalyzerHelper.AnalyzerType
                    == NPV1AnalyzerHelper.ANALYZER_TYPES.npvchangeyr ||
                    npv1AnalyzerHelper.AnalyzerType
                    == NPV1AnalyzerHelper.ANALYZER_TYPES.npvchangeid ||
                    npv1AnalyzerHelper.AnalyzerType
                    == NPV1AnalyzerHelper.ANALYZER_TYPES.npvchangealt ||
                    npv1AnalyzerHelper.AnalyzerType
                    == NPV1AnalyzerHelper.ANALYZER_TYPES.npvprogress1)
                {
                    if (npv1CalcParams.NeedsFullView)
                    {
                        extDocToCalcURI.URIDataManager.NeedsFullView    = true;
                        extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                    }
                    else
                    {
                        extDocToCalcURI.URIDataManager.NeedsFullView    = false;
                        extDocToCalcURI.URIDataManager.NeedsSummaryView = true;
                    }
                    extCalcDocURI.URIFileExtensionType = CalculatorHelpers.GetAttribute(npv1CalcParams.LinkedViewElement,
                                                                                        Calculator1.cFileExtensionType);
                }
                if (extDocToCalcURI.URIDataManager.TempDocSaveMethod
                    == Constants.SAVECALCS_METHOD.saveastext.ToString())
                {
                    //analyzers aren't yet available
                }
                else
                {
                    //tells addinhelper to save calcs
                    CalculatorHelpers.SetTempDocSaveAnalysesProperty(extDocToCalcURI);
                }
                break;

            default:
                //as many steps as needed can be added to this addin
                break;
            }
            extDocToCalcURI.ErrorMessage += npv1AnalyzerHelper.NPV1CalculatorParams.ErrorMessage;
            return(bHasAnalysis);
        }
Exemplo n.º 3
0
        public async Task <bool> RunCalculatorStep(
            ExtensionContentURI extDocToCalcURI, ExtensionContentURI extCalcDocURI,
            string stepNumber, IList <string> urisToAnalyze,
            IDictionary <string, string> updates, CancellationToken cancellationToken)
        {
            bool bHasCalculation = false;
            CalculatorHelpers    eCalcHelpers = new CalculatorHelpers();
            CalculatorParameters ME2CalcParams
                = CalculatorHelpers.SetCalculatorParameters(
                      extDocToCalcURI, extCalcDocURI, stepNumber, urisToAnalyze,
                      updates);
            ME2CalculatorHelper me2CalcHelper
                = new ME2CalculatorHelper(ME2CalcParams);

            ContractHelpers.EXTENSION_STEPS eStepNumber
                = ContractHelpers.GetEnumStepNumber(stepNumber);
            bool bHasUpdates = false;

            switch (eStepNumber)
            {
            case ContractHelpers.EXTENSION_STEPS.stepzero:
                bHasCalculation = true;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepone:
                bHasCalculation = true;
                break;

            case ContractHelpers.EXTENSION_STEPS.steptwo:
                //clear updates collection
                updates.Clear();
                //just save this step's edits
                bHasCalculation = true;
                extDocToCalcURI.URIDataManager.NeedsFullView    = false;
                extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepthree:
                //get rid of any update member that was added after running the same step 2x
                bHasUpdates = await CalculatorHelpers.RefreshUpdates(ME2CalcParams, stepNumber, updates);

                if (ME2CalcParams != null)
                {
                    bHasCalculation = await me2CalcHelper.RunME2CalculatorCalculations();

                    extDocToCalcURI.ErrorMessage  = ME2CalcParams.ErrorMessage;
                    extDocToCalcURI.ErrorMessage += ME2CalcParams.ExtensionDocToCalcURI.ErrorMessage;
                    if (!bHasCalculation)
                    {
                        extDocToCalcURI.ErrorMessage = (extDocToCalcURI.ErrorMessage == string.Empty) ?
                                                       Errors.MakeStandardErrorMsg("CALCULATORS_URI_MISMATCH")
                                : extDocToCalcURI.ErrorMessage;
                        return(bHasCalculation);
                    }
                    if (string.IsNullOrEmpty(extDocToCalcURI.ErrorMessage))
                    {
                        //two step calculators need to be saved now
                        CheckForLastStepCalculator(ME2CalcParams,
                                                   eStepNumber, extDocToCalcURI);
                        //replace the old calculator with the new one
                        //and save the new calculations document
                        bHasCalculation
                            = await CalculatorHelpers.SaveNewCalculationsDocument(ME2CalcParams);
                    }
                    else
                    {
                        bHasCalculation = false;
                    }
                }
                extDocToCalcURI.URIDataManager.NeedsFullView    = true;
                extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepfour:
                //show all indicators (unlike most calculators)
                extDocToCalcURI.URIDataManager.NeedsFullView    = true;
                extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                extCalcDocURI.URIFileExtensionType = CalculatorHelpers.GetAttribute(ME2CalcParams.LinkedViewElement,
                                                                                    Calculator1.cFileExtensionType);
                bHasCalculation = true;
                //tells addinhelper to save calcs
                CalculatorHelpers.SetTempDocSaveCalcsProperty(extDocToCalcURI);
                break;

            default:
                //as many steps as needed can be added to this addin
                break;
            }
            extDocToCalcURI.ErrorMessage += ME2CalcParams.ErrorMessage;
            return(bHasCalculation);
        }
Exemplo n.º 4
0
        public async Task <bool> RunAnalyzerStep(
            ExtensionContentURI extDocToCalcURI, ExtensionContentURI extCalcDocURI,
            string stepNumber, IList <string> urisToAnalyze,
            IDictionary <string, string> updates, CancellationToken cancellationToken)
        {
            bool bHasAnalysis = false;
            CalculatorParameters fnCalcParams
                = CalculatorHelpers.SetCalculatorParameters(
                      extDocToCalcURI, extCalcDocURI, stepNumber, urisToAnalyze,
                      updates);
            FNAnalyzerHelper fnAnalyzerHelper = new FNAnalyzerHelper(fnCalcParams);

            //check to make sure the analyzer can be run
            fnAnalyzerHelper.SetOptions();
            if (fnAnalyzerHelper.FNCalculatorParams.ErrorMessage != string.Empty)
            {
                extDocToCalcURI.ErrorMessage += fnAnalyzerHelper.FNCalculatorParams.ErrorMessage;
                return(false);
            }
            ContractHelpers.EXTENSION_STEPS eStepNumber
                = ContractHelpers.GetEnumStepNumber(stepNumber);
            bool bHasUpdates = false;

            switch (eStepNumber)
            {
            case ContractHelpers.EXTENSION_STEPS.stepzero:
                bHasAnalysis = true;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepone:
                bHasAnalysis = true;
                break;

            case ContractHelpers.EXTENSION_STEPS.steptwo:
                //clear updates collection
                updates.Clear();
                //just need the html form edits in this step
                bHasAnalysis = true;
                extDocToCalcURI.URIDataManager.NeedsFullView    = false;
                extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepthree:
                //get rid of any update member that was added after running the same step 2x
                bHasUpdates = await CalculatorHelpers.RefreshUpdates(fnCalcParams, stepNumber, updates);

                if (fnAnalyzerHelper.AnalyzerType
                    == FNAnalyzerHelper.ANALYZER_TYPES.resources01)
                {
                    //linked view insertions needs some analysis parameters
                    SetAnalyzerParameters(fnAnalyzerHelper, fnCalcParams);
                    //the calculator pattern handles children linked view insertions
                    //better than the analyzer pattern
                    FNCalculatorHelper fnCalculatorHelper
                                 = new FNCalculatorHelper(fnCalcParams);
                    bHasAnalysis = await fnCalculatorHelper.RunCalculations();
                }
                else
                {
                    //run the analysis (when analyses are available)
                    //bHasAnalysis = fnAnalyzerHelper
                    //    .RunAnalysis(urisToAnalyze);
                }
                extDocToCalcURI.ErrorMessage  = fnCalcParams.ErrorMessage;
                extDocToCalcURI.ErrorMessage += fnAnalyzerHelper.FNCalculatorParams.ErrorMessage;
                if (!bHasAnalysis)
                {
                    extDocToCalcURI.ErrorMessage = (extDocToCalcURI.ErrorMessage == string.Empty) ?
                                                   Errors.MakeStandardErrorMsg("CALCULATORS_URI_MISMATCH")
                            : extDocToCalcURI.ErrorMessage;
                    return(bHasAnalysis);
                }
                if (string.IsNullOrEmpty(extDocToCalcURI.ErrorMessage))
                {
                    //two step analyzers need to be saved now
                    FNAnalyzerHelper.ANALYZER_TYPES eAnalyzerType
                        = fnAnalyzerHelper.GetAnalyzerType(
                              fnAnalyzerHelper.FNCalculatorParams.AnalyzerParms.AnalyzerType);
                    //when 3+ step analyzers start being used
                    CheckForLastStepAnalyzer(eAnalyzerType,
                                             eStepNumber, extDocToCalcURI);
                    if (!CalculatorHelpers.IsSaveAction(extDocToCalcURI))
                    {
                        //replace the old calculator with the new one
                        //and save the new calculations document
                        bool bHasReplacedCalcDoc
                            = await CalculatorHelpers.SaveNewCalculationsDocument(
                                  fnAnalyzerHelper.FNCalculatorParams);

                        if (bHasReplacedCalcDoc)
                        {
                            //the resource01 app uses the calculator, rather
                            //than analyzer, pattern (i.e. children linked views
                            //can be inserted)
                            if (fnAnalyzerHelper.AnalyzerType
                                != FNAnalyzerHelper.ANALYZER_TYPES.resources01)
                            {
                                //and add xmldoc params to update collection
                                //only doctocalc gets updated
                                CalculatorHelpers.AddXmlDocAndXmlDocIdsToUpdates(
                                    fnAnalyzerHelper.FNCalculatorParams);
                            }
                            bHasAnalysis = true;
                        }
                        else
                        {
                            extDocToCalcURI.ErrorMessage = Errors.MakeStandardErrorMsg("ANALYSES_ID_MISMATCH");
                        }
                    }
                }
                else
                {
                    bHasAnalysis = false;
                }
                extDocToCalcURI.URIDataManager.NeedsFullView    = true;
                extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepfour:
                bHasAnalysis = true;
                if (fnAnalyzerHelper.AnalyzerType
                    == FNAnalyzerHelper.ANALYZER_TYPES.resources01)
                {
                    extDocToCalcURI.URIDataManager.NeedsFullView    = false;
                    extDocToCalcURI.URIDataManager.NeedsSummaryView = true;
                    extCalcDocURI.URIFileExtensionType = CalculatorHelpers.GetAttribute(fnCalcParams.LinkedViewElement,
                                                                                        Calculator1.cFileExtensionType);
                }
                if (extDocToCalcURI.URIDataManager.TempDocSaveMethod
                    == Constants.SAVECALCS_METHOD.saveastext.ToString())
                {
                    //analyzers aren't yet available
                }
                else
                {
                    //tells addinhelper to save calcs
                    CalculatorHelpers.SetTempDocSaveAnalysesProperty(extDocToCalcURI);
                }
                break;

            default:
                //as many steps as needed can be added to this addin
                break;
            }
            extDocToCalcURI.ErrorMessage += fnAnalyzerHelper.FNCalculatorParams.ErrorMessage;
            return(bHasAnalysis);
        }
Exemplo n.º 5
0
        public override async Task <bool> RunCalculatorStep(
            ExtensionContentURI extDocToCalcURI, ExtensionContentURI extCalcDocURI,
            string stepNumber, IList <string> urisToAnalyze,
            IDictionary <string, string> updates, CancellationToken cancellationToken)
        {
            bool bHasCalculation = false;
            CalculatorHelpers    eCalcHelpers = new CalculatorHelpers();
            CalculatorParameters npvCalcParams
                = CalculatorHelpers.SetCalculatorParameters(
                      extDocToCalcURI, extCalcDocURI, stepNumber, urisToAnalyze,
                      updates);

            if (!CalculatorHelpers.URIAbsoluteExists(extDocToCalcURI,
                                                     extDocToCalcURI.URIDataManager.TempDocPath))
            {
                //this calculator requires the base document to be built first
                extDocToCalcURI.ErrorMessage = Errors.MakeStandardErrorMsg("CALCULATORS_MISSINGBASEDOC");
                return(false);
            }
            NPVCalculatorHelper npvBudgetHelpers = new NPVCalculatorHelper(npvCalcParams);

            ContractHelpers.EXTENSION_STEPS eStepNumber
                = ContractHelpers.GetEnumStepNumber(stepNumber);
            switch (eStepNumber)
            {
            case ContractHelpers.EXTENSION_STEPS.stepzero:
                bHasCalculation = true;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepone:
                bHasCalculation = true;
                break;

            case ContractHelpers.EXTENSION_STEPS.steptwo:
                updates.Clear();
                if (npvCalcParams != null)
                {
                    //set constants for this step
                    bHasCalculation = NPVCalculatorHelper.SetConstants(npvCalcParams);
                    //this step does not generate 3rd htmldocs
                    extDocToCalcURI.URIDataManager.NeedsFullView    = false;
                    extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                }
                break;

            case ContractHelpers.EXTENSION_STEPS.stepthree:
                //get rid of any update member that was added after running the same step 2x
                CalculatorHelpers.RefreshUpdates(npvCalcParams, stepNumber, updates);
                if (npvCalcParams != null)
                {
                    if (npvCalcParams.CalculatorType == CalculatorHelpers.CALCULATOR_TYPES.operation2.ToString() ||
                        npvCalcParams.CalculatorType == CalculatorHelpers.CALCULATOR_TYPES.component2.ToString())
                    {
                        //run the scheduling calculations
                        bHasCalculation = NPVCalculatorHelper.RunSchedulingCalculations(npvCalcParams);
                    }
                    else
                    {
                        //run the calculations
                        bHasCalculation = npvBudgetHelpers.RunCalculations();
                    }
                    extDocToCalcURI.ErrorMessage  = npvCalcParams.ErrorMessage;
                    extDocToCalcURI.ErrorMessage += npvCalcParams.ExtensionDocToCalcURI.ErrorMessage;
                    if (!bHasCalculation)
                    {
                        extDocToCalcURI.ErrorMessage = (extDocToCalcURI.ErrorMessage == string.Empty) ?
                                                       Errors.MakeStandardErrorMsg("CALCULATORS_URI_MISMATCH")
                                : extDocToCalcURI.ErrorMessage;
                        return(bHasCalculation);
                    }
                    if (string.IsNullOrEmpty(extDocToCalcURI.ErrorMessage))
                    {
                        //two step calculators need to be saved now
                        CheckForLastStepCalculator(npvCalcParams,
                                                   eStepNumber, extDocToCalcURI);
                        //replace the old calculator with the new one
                        //and save the new calculations document
                        bHasCalculation
                            = CalculatorHelpers.SaveNewCalculationsDocument(npvCalcParams);
                    }
                    else
                    {
                        bHasCalculation = false;
                    }
                }
                //this step needs a full 3rd htmldocs
                extDocToCalcURI.URIDataManager.NeedsFullView    = true;
                extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                break;

            case ContractHelpers.EXTENSION_STEPS.stepfour:
                if (npvCalcParams.ExtensionDocToCalcURI.URIDataManager.SubAppType
                    == Constants.SUBAPPLICATION_TYPES.componentprices.ToString() ||
                    npvCalcParams.ExtensionDocToCalcURI.URIDataManager.SubAppType
                    == Constants.SUBAPPLICATION_TYPES.operationprices.ToString())
                {
                    if (npvCalcParams.CalculatorType == CalculatorHelpers.CALCULATOR_TYPES.operation2.ToString() ||
                        npvCalcParams.CalculatorType == CalculatorHelpers.CALCULATOR_TYPES.component2.ToString())
                    {
                        //get rid of any update member that was added after running the same step 2x
                        CalculatorHelpers.RefreshUpdates(npvCalcParams, stepNumber, updates);
                        //run the scheduling calculations
                        bHasCalculation = npvBudgetHelpers.RunCalculations();
                        bHasCalculation = CalculatorHelpers.SaveNewCalculationsDocument(npvCalcParams);
                        //this step needs a full 3rd htmldocs
                        extDocToCalcURI.URIDataManager.NeedsFullView    = true;
                        extDocToCalcURI.URIDataManager.NeedsSummaryView = false;
                    }
                    else
                    {
                        //save the calculations
                        bHasCalculation = SaveCalculations(extDocToCalcURI, extCalcDocURI,
                                                           npvCalcParams);
                    }
                }
                else
                {
                    //save the calculations
                    bHasCalculation = SaveCalculations(extDocToCalcURI, extCalcDocURI,
                                                       npvCalcParams);
                }
                break;

            case ContractHelpers.EXTENSION_STEPS.stepfive:
                if (npvCalcParams.ExtensionDocToCalcURI.URIDataManager.SubAppType
                    == Constants.SUBAPPLICATION_TYPES.componentprices.ToString() ||
                    npvCalcParams.ExtensionDocToCalcURI.URIDataManager.SubAppType
                    == Constants.SUBAPPLICATION_TYPES.operationprices.ToString())
                {
                    //save the calculations
                    bHasCalculation = SaveCalculations(extDocToCalcURI, extCalcDocURI,
                                                       npvCalcParams);
                }
                break;

            default:
                //as many steps as needed can be added to this addin
                break;
            }
            extDocToCalcURI.ErrorMessage += npvCalcParams.ErrorMessage;
            return(bHasCalculation);
        }