Exemplo n.º 1
0
 //set the class properties using the XElement
 private void SetDemog4Properties(Demog4 demog, string attNameExtension,
                                  XElement currentCalculationsElement)
 {
     //don't set any input properties; each calculator should set what's needed separately
     demog.D4Name        = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4Name, attNameExtension));
     demog.D4Label       = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4Label, attNameExtension));
     demog.D4Description = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4Description, attNameExtension));
     demog.D4NameA       = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4NameA, attNameExtension));
     demog.D4LabelA      = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4LabelA, attNameExtension));
     demog.D4AmountA     = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4AmountA, attNameExtension));
     demog.D4PopA        = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4PopA, attNameExtension));
     demog.D4UnitA       = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4UnitA, attNameExtension));
     demog.D4NameB       = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4NameB, attNameExtension));
     demog.D4LabelB      = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4LabelB, attNameExtension));
     demog.D4AmountB     = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4AmountB, attNameExtension));
     demog.D4PopB        = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4PopB, attNameExtension));
     demog.D4UnitB       = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4UnitB, attNameExtension));
     demog.D4NameC       = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4NameC, attNameExtension));
     demog.D4LabelC      = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4LabelC, attNameExtension));
     demog.D4AmountC     = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4AmountC, attNameExtension));
     demog.D4PopC        = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4PopC, attNameExtension));
     demog.D4UnitC       = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4UnitC, attNameExtension));
     demog.D4NameD       = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4NameD, attNameExtension));
     demog.D4LabelD      = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4LabelD, attNameExtension));
     demog.D4AmountD     = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4AmountD, attNameExtension));
     demog.D4PopD        = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4PopD, attNameExtension));
     demog.D4UnitD       = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4UnitD, attNameExtension));
     demog.D4NameE       = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4NameE, attNameExtension));
     demog.D4LabelE      = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4LabelE, attNameExtension));
     demog.D4AmountE     = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4AmountE, attNameExtension));
     demog.D4PopE        = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4PopE, attNameExtension));
     demog.D4UnitE       = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cD4UnitE, attNameExtension));
 }
Exemplo n.º 2
0
        //set the class properties using the XElement
        public virtual void SetTimelinessOC1Properties(XElement currentCalculationsElement)
        {
            this.PlannedStartDate   = CalculatorHelpers.GetAttributeDate(currentCalculationsElement, cPlannedStartDate);
            this.ActualStartDate    = CalculatorHelpers.GetAttributeDate(currentCalculationsElement, cActualStartDate);
            this.LaborAvailable     = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cLaborAvailable);
            this.WorkdayProbability = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cWorkdayProbability);
            this.TimelinessPenalty1 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimelinessPenalty1);
            this.TimelinessPenaltyDaysFromStart1 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimelinessPenaltyDaysFromStart1);
            this.TimelinessPenalty2 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimelinessPenalty2);
            this.TimelinessPenaltyDaysFromStart2 = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimelinessPenaltyDaysFromStart2);
            this.WorkdaysLimit = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cWorkdaysLimit);
            this.Amount        = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, Constants.AMOUNT);
            this.Unit          = CalculatorHelpers.GetAttribute(currentCalculationsElement, Constants.UNIT);
            this.FieldCapacity = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cFieldCapacity);
            this.AreaCovered   = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cAreaCovered);
            this.FieldDays     = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cFieldDays);

            this.OutputName                   = CalculatorHelpers.GetAttribute(currentCalculationsElement, cOutputName);
            this.OutputUnit                   = CalculatorHelpers.GetAttribute(currentCalculationsElement, cOutputUnit);
            this.OutputPrice                  = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputPrice);
            this.OutputYield                  = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputYield);
            this.CompositionUnit              = CalculatorHelpers.GetAttribute(currentCalculationsElement, cCompositionUnit);
            this.CompositionAmount            = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cCompositionAmount);
            this.OutputTimes                  = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputTimes);
            this.ProbableFieldDays            = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cProbableFieldDays);
            this.ProbableFinishDate           = CalculatorHelpers.GetAttributeDate(currentCalculationsElement, cProbableFinishDate);
            this.TimelinessPenaltyCost        = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimelinessPenaltyCost);
            this.TimelinessPenaltyCostPerHour = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimelinessPenaltyCostPerHour);
            this.TotalR = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, CostBenefitCalculator.TR);
        }
Exemplo n.º 3
0
 public void SetFN1ConstantProperties(XElement currentCalculationsElement)
 {
     this.FNC1Id = CalculatorHelpers.GetAttributeInt(currentCalculationsElement,
                                                     cFNC1Id);
     this.FNC1Label = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                     cFNC1Label);
     this.FNC1Name = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                    cFNC1Name);
     this.FNC1Child1to3 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                         cFNC1Child1to3);
     this.FNC1Female4to8 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                          cFNC1Female4to8);
     this.FNC1Male4to8 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                        cFNC1Male4to8);
     this.FNC1Female9to13 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                           cFNC1Female9to13);
     this.FNC1Male9to13 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                         cFNC1Male9to13);
     this.FNC1Female14to18 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                            cFNC1Female14to18);
     this.FNC1Male14to18 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                          cFNC1Male14to18);
     this.FNC1Female19to30 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                            cFNC1Female19to30);
     this.FNC1Male19to30 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                          cFNC1Male19to30);
     this.FNC1Female31to50 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                            cFNC1Female31to50);
     this.FNC1Male31to50 = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                          cFNC1Male31to50);
     this.FNC1Female51Plus = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                            cFNC1Female51Plus);
     this.FNC1Male51Plus = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                          cFNC1Male51Plus);
 }
Exemplo n.º 4
0
 //set the class properties using the XElement
 public virtual void SetLCC1Properties(XElement calculator,
                                       XElement currentElement)
 {
     this.SetCalculatorProperties(calculator);
     //need the aggregating params (label, groupid, typeid and Date for sorting)
     this.SetSharedObjectProperties(currentElement);
     this.SetSubPrice1sProperties(calculator);
     this.ServiceLifeYears = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                  cServiceLifeYears);
     this.YearsFromBaseDate = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                   cYearsFromBaseDate);
     this.PlanningConstructionYears = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                           cPlanningConstructionYears);
     this.PerUnitAmount = CalculatorHelpers.GetAttributeDouble(calculator,
                                                               cPerUnitAmount);
     this.PerUnitUnit = CalculatorHelpers.GetAttribute(calculator,
                                                       cPerUnitUnit);
     this.OCTotalCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                             cOCTotalCost);
     this.AOHTotalCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                              cAOHTotalCost);
     this.CAPTotalCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                              cCAPTotalCost);
     this.LCCTotalCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                              cLCCTotalCost);
     this.EAATotalCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                              cEAATotalCost);
     this.UnitTotalCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                               cUnitTotalCost);
 }
Exemplo n.º 5
0
 public void SetOutputProperties(XElement currentElement)
 {
     this.SetSharedObjectProperties(currentElement);
     this.SetTotalBenefitsProperties(currentElement);
     this.AnnuityType = TimePeriod.GetAnnuityType(currentElement);
     this.Amount      = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                             OUTPUT_AMOUNT);
     this.Price = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                       OUTPUT_PRICE);
     this.Date = CalculatorHelpers.GetAttributeDate(currentElement,
                                                    OUTPUT_DATE);
     this.Unit = CalculatorHelpers.GetAttribute(currentElement,
                                                OUTPUT_BASE_UNIT);
     this.CompositionAmount = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                                   COMPOSITION_AMOUNT);
     this.CompositionUnit = CalculatorHelpers.GetAttribute(currentElement,
                                                           COMPOSITION_UNIT);
     this.Times = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                       OUTPUT_TIMES);
     this.IncentiveAmount = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                                 DataAppHelpers.General.INCENTIVE_AMOUNT);
     this.IncentiveRate = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                               DataAppHelpers.General.INCENTIVE_RATE);
     this.OutputGroupId = CalculatorHelpers.GetAttributeInt(currentElement,
                                                            DataAppHelpers.Prices.OUTPUT_GROUP_ID);
     this.OutputGroupName = CalculatorHelpers.GetAttribute(currentElement,
                                                           DataAppHelpers.Prices.OUTPUT_GROUP_NAME);
 }
Exemplo n.º 6
0
        public virtual void SetSubPrice1sProperties(XElement calculator)
        {
            //remember that the calculator inheriting from this class must set id and name
            //this.SetCalculatorProperties(calculator);
            if (this.SubPrice1s == null)
            {
                this.SubPrice1s = new List <SubPrice1>();
            }
            int i = 1;
            //standard attname used throughout DevTreks
            string sAttNameExtension = string.Empty;
            //don't make unnecessary collection members
            string sHasAttribute = string.Empty;

            for (i = 1; i < this.MaximumNumberOfSubPrice1s; i++)
            {
                sAttNameExtension = i.ToString();
                sHasAttribute     = CalculatorHelpers.GetAttribute(calculator,
                                                                   string.Concat(cSubPName, sAttNameExtension));
                if (!string.IsNullOrEmpty(sHasAttribute))
                {
                    SubPrice1 subP1 = new SubPrice1();
                    SetSubPrice1Properties(subP1, sAttNameExtension, calculator);
                    this.SubPrice1s.Add(subP1);
                }
                sHasAttribute = string.Empty;
            }
        }
Exemplo n.º 7
0
 public void SetOptions()
 {
     this.AnalyzerType = GetAnalyzerType();
     this.ME2CalculatorParams.AnalyzerParms.AnalyzerType = this.AnalyzerType.ToString();
     if (this.ME2CalculatorParams.AnalyzerParms.AnalyzerType == string.Empty ||
         this.ME2CalculatorParams.AnalyzerParms.AnalyzerType == Constants.NONE)
     {
         this.ME2CalculatorParams.ErrorMessage
             = Errors.MakeStandardErrorMsg("ANALYSES_CHOOSEONE");
     }
     this.ME2CalculatorParams.AnalyzerParms.AnalyzerGeneralType
         = GetBaseAnalyzerType(this.AnalyzerType);
     this.ME2CalculatorParams.AnalyzerParms.SubFolderType
         = AnalyzerHelper.GetSubFolderType(this.ME2CalculatorParams.LinkedViewElement);
     this.ME2CalculatorParams.AnalyzerParms.ComparisonType
         = AnalyzerHelper.GetComparisonType(this.ME2CalculatorParams.LinkedViewElement);
     this.ME2CalculatorParams.AnalyzerParms.AggregationType
         = AnalyzerHelper.GetAggregationType(this.ME2CalculatorParams.LinkedViewElement);
     //new in v1.4.5 (user can choose whether or not to display full calcs)
     this.ME2CalculatorParams.NeedsFullView
         = AnalyzerHelper.GetDisplayFullViewOption(this.ME2CalculatorParams.LinkedViewElement);
     this.ME2CalculatorParams.AnalyzerParms.FilesToAnalyzeExtensionType
         = CalculatorHelpers.GetAttribute(this.ME2CalculatorParams.LinkedViewElement,
                                          Calculator1.cFilesToAnalyzeExtensionType);
     this.ME2CalculatorParams.StartingDocToCalcNodeName
         = GetNodeNameFromFileExtensionType(this.ME2CalculatorParams.AnalyzerParms.FilesToAnalyzeExtensionType);
     this.ME2CalculatorParams.SubApplicationType
         = CalculatorHelpers.GetSubAppTypeFromNodeName2(
               this.ME2CalculatorParams.StartingDocToCalcNodeName);
 }
Exemplo n.º 8
0
        public virtual void SetStatistic02sProperties(XElement calculator)
        {
            if (this.Stat2s == null)
            {
                this.Stat2s = new List <Statistic02>();
            }
            int i = 1;
            //standard attname used throughout DevTreks
            string sAttNameExtension = string.Empty;
            //don't make unnecessary collection members
            string sHasAttribute = string.Empty;

            for (i = 1; i < this.MaximumNumberOfIndicator1s; i++)
            {
                sAttNameExtension = i.ToString();
                sHasAttribute     = CalculatorHelpers.GetAttribute(calculator,
                                                                   string.Concat(cAmount, sAttNameExtension));
                if (!string.IsNullOrEmpty(sHasAttribute))
                {
                    Statistic02 stat = new Statistic02();
                    SetStatistic02Properties(stat, sAttNameExtension, calculator);
                    this.Stat2s.Add(stat);
                }
                sHasAttribute = string.Empty;
            }
        }
Exemplo n.º 9
0
 private void SetTotalSubPrice3StockProperties(SubPrice3Stock ind,
                                               string attNameExtension, XElement calculator)
 {
     ind.TotalInd1Description = CalculatorHelpers.GetAttribute(calculator,
                                                               string.Concat(cTotalInd1Description, attNameExtension));
     ind.TotalInd1RiskType = CalculatorHelpers.GetAttribute(calculator,
                                                            string.Concat(cTotalInd1RiskType, attNameExtension));
     ind.TotalInd1Name = CalculatorHelpers.GetAttribute(calculator,
                                                        string.Concat(cTotalInd1Name, attNameExtension));
     ind.TotalInd1Label = CalculatorHelpers.GetAttribute(calculator,
                                                         string.Concat(cTotalInd1Label, attNameExtension));
     ind.TotalInd1Total = CalculatorHelpers.GetAttributeDouble(calculator,
                                                               string.Concat(cTotalInd1Total, attNameExtension));
     ind.TotalInd1BM = CalculatorHelpers.GetAttributeDouble(calculator,
                                                            string.Concat(cTotalInd1BM, attNameExtension));
     ind.TotalInd1BMProg = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                string.Concat(cTotalInd1BMProg, attNameExtension));
     ind.TotalInd1Unit = CalculatorHelpers.GetAttribute(calculator,
                                                        string.Concat(cTotalInd1Unit, attNameExtension));
     //ind.SubP1PTDate = CalculatorHelpers.GetAttributeDate(calculator,
     //   string.Concat(cInd1PTDate, attNameExtension));
     //ind.SubP1YTDDate = CalculatorHelpers.GetAttributeDate(calculator,
     //   string.Concat(cInd1YTDDate, attNameExtension));
     ind.TotalInd1PartTarget = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                    string.Concat(cTotalInd1PartTarget, attNameExtension));
     ind.TotalInd1FullTarget = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                    string.Concat(cTotalInd1FullTarget, attNameExtension));
     ind.TotalInd1PTProg = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                string.Concat(cTotalInd1PTProg, attNameExtension));
     ind.TotalInd1FTProg = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                string.Concat(cTotalInd1FTProg, attNameExtension));
 }
Exemplo n.º 10
0
 private void SetNameProperties(CostBenefitStatistic01 stat,
                                XElement currentElement)
 {
     if (this.CalcParams.AnalyzerParms.AnalyzerGeneralType
         == ANALYZER_GENERAL_TYPES.outputbased)
     {
         //need to set the existing name and unit to a stat name and unit
         //(if it hasn't already been done)
         string sName = CalculatorHelpers
                        .GetAttribute(currentElement, CostBenefitStatistic01.TRName);
         if (string.IsNullOrEmpty(sName))
         {
             //analyzers sometimes use more than one analyzer
             //so the first may or may not have converted the name already
             sName = CalculatorHelpers
                     .GetAttribute(currentElement, Calculator1.cName);
         }
         stat.TotalRName = sName;
         string sUnit = CalculatorHelpers
                        .GetAttribute(currentElement, CostBenefitStatistic01.TRUnit);
         if (string.IsNullOrEmpty(sUnit))
         {
             sUnit = CalculatorHelpers
                     .GetAttribute(currentElement, Constants.UNIT);
             if (string.IsNullOrEmpty(sUnit))
             {
                 sUnit = CalculatorHelpers
                         .GetAttribute(currentElement, Output.OUTPUT_BASE_UNIT);
             }
         }
         stat.TotalRUnit = sUnit;
     }
 }
Exemplo n.º 11
0
        public virtual void SetIndicatorQ1sProperties(XElement calculator)
        {
            if (this.IndicatorQ1s == null)
            {
                this.IndicatorQ1s = new List <IndicatorQ1>();
            }
            int i = 1;
            //standard attname used throughout DevTreks
            string sAttNameExtension = string.Empty;
            //don't make unnecessary collection members
            string sHasAttribute = string.Empty;

            for (i = 1; i < this.MaximumNumberOfIndicatorQ1s; i++)
            {
                sAttNameExtension = i.ToString();
                sHasAttribute     = CalculatorHelpers.GetAttribute(calculator,
                                                                   string.Concat(cIQ1NameA, sAttNameExtension));
                if (!string.IsNullOrEmpty(sHasAttribute))
                {
                    IndicatorQ1 indQ = new IndicatorQ1();
                    SetIndicatorQ1Properties(indQ, sAttNameExtension, calculator);
                    this.IndicatorQ1s.Add(indQ);
                }
                sHasAttribute = string.Empty;
            }
        }
Exemplo n.º 12
0
        public virtual void SetDemog4sProperties(XElement calculator)
        {
            if (this.Demog4s == null)
            {
                this.Demog4s = new List <Demog4>();
            }
            int i = 1;
            //standard attname used throughout DevTreks
            string sAttNameExtension = string.Empty;
            //don't make unnecessary collection members
            string sHasAttribute = string.Empty;

            for (i = 1; i < this.MaximumNumberOfDemog4s; i++)
            {
                sAttNameExtension = i.ToString();
                sHasAttribute     = CalculatorHelpers.GetAttribute(calculator,
                                                                   string.Concat(cD4Name, sAttNameExtension));
                if (!string.IsNullOrEmpty(sHasAttribute))
                {
                    Demog4 demog = new Demog4();
                    SetDemog4Properties(demog, sAttNameExtension, calculator);
                    this.Demog4s.Add(demog);
                }
                sHasAttribute = string.Empty;
            }
        }
Exemplo n.º 13
0
 //set the class properties using the XElement
 public virtual void SetHealthBenefit1Properties(XElement currentCalculationsElement)
 {
     if (Demographics == null)
     {
         Demographics = new Demog1();
     }
     Demographics.SetDemog1Properties(currentCalculationsElement);
     //don't set any input properties; each calculator should set what's needed separately
     this.OutputCost               = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputCost);
     this.BenefitAdjustment        = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cBenefitAdjustment);
     this.AdjustedBenefit          = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cAdjustedBenefit);
     this.OutputEffect1Name        = CalculatorHelpers.GetAttribute(currentCalculationsElement, cOutputEffect1Name);
     this.OutputEffect1Unit        = CalculatorHelpers.GetAttribute(currentCalculationsElement, cOutputEffect1Unit);
     this.OutputEffect1Amount      = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputEffect1Amount);
     this.OutputEffect1Price       = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputEffect1Price);
     this.OutputEffect1Cost        = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cOutputEffect1Cost);
     this.AverageBenefitRating     = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cAverageBenefitRating);
     this.PhysicalHealthRating     = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cPhysicalHealthRating);
     this.EmotionalHealthRating    = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cEmotionalHealthRating);
     this.SocialHealthRating       = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cSocialHealthRating);
     this.EconomicHealthRating     = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cEconomicHealthRating);
     this.HealthCareDeliveryRating = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cHealthCareDeliveryRating);
     this.BeforeQOLRating          = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cBeforeQOLRating);
     this.AfterQOLRating           = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cAfterQOLRating);
     this.BeforeYears              = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cBeforeYears);
     this.AfterYears               = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cAfterYears);
     this.AfterYearsProb           = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cAfterYearsProb);
     this.TimeTradeoffYears        = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTimeTradeoffYears);
     this.EquityMultiplier         = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cEquityMultiplier);
     this.BenefitAssessment        = CalculatorHelpers.GetAttribute(currentCalculationsElement, cBenefitAssessment);
     this.QALY         = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cQALY);
     this.ICERQALY     = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cICERQALY);
     this.TTOQALY      = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cTTOQALY);
     this.WillDoSurvey = CalculatorHelpers.GetAttributeBool(currentCalculationsElement, cWillDoSurvey);
 }
Exemplo n.º 14
0
 public void AdjustJointOutputCalculations(
     Output output, ref XElement currentCalculationsElement,
     CalculatorParameters calcParameters)
 {
     //transfer changes found in calcParams.ParentOutcome.Outputs[]
     //to this output, prior to discounting
     if (calcParameters.ParentOutcome.Outputs != null)
     {
         int    iOutputId = output.Id;
         Output adjustedOutput
             = calcParameters.ParentOutcome.Outputs
               .FirstOrDefault(i => i.Id == iOutputId &&
                               i.Type == CostBenefitCalculator.TYPE_NEWCALCS);
         if (adjustedOutput != null)
         {
             //replace output
             output.CopyOutput(adjustedOutput);
             //output = new Output(adjustedOutput);
             if (adjustedOutput.XmlDocElement != null)
             {
                 //adjustments can change fuel amounts, AOHAmounts ...
                 output.XmlDocElement
                     = new XElement(adjustedOutput.XmlDocElement);
                 string sId = CalculatorHelpers.GetAttribute(currentCalculationsElement,
                                                             Calculator1.cId);
                 currentCalculationsElement
                     = CalculatorHelpers.GetChildLinkedViewUsingAttribute(
                           adjustedOutput.XmlDocElement, Calculator1.cId, sId);
             }
         }
     }
 }
Exemplo n.º 15
0
 public void SetOptions()
 {
     this.AnalyzerType = GetAnalyzerType();
     this.HCCalculatorParams.AnalyzerParms.AnalyzerType = this.AnalyzerType.ToString();
     if (this.HCCalculatorParams.AnalyzerParms.AnalyzerType == string.Empty ||
         this.HCCalculatorParams.AnalyzerParms.AnalyzerType == Constants.NONE)
     {
         this.HCCalculatorParams.ErrorMessage
             = Errors.MakeStandardErrorMsg("ANALYSES_CHOOSEONE");
     }
     this.HCCalculatorParams.AnalyzerParms.AnalyzerGeneralType
         = GetBaseAnalyzerType(this.AnalyzerType);
     this.HCCalculatorParams.AnalyzerParms.SubFolderType
         = AnalyzerHelper.GetSubFolderType(this.HCCalculatorParams.LinkedViewElement);
     this.HCCalculatorParams.AnalyzerParms.ComparisonType
         = AnalyzerHelper.GetComparisonType(this.HCCalculatorParams.LinkedViewElement);
     this.HCCalculatorParams.AnalyzerParms.AggregationType
         = AnalyzerHelper.GetAggregationType(this.HCCalculatorParams.LinkedViewElement);
     this.HCCalculatorParams.AnalyzerParms.FilesToAnalyzeExtensionType
         = CalculatorHelpers.GetAttribute(this.HCCalculatorParams.LinkedViewElement,
                                          Calculator1.cFilesToAnalyzeExtensionType);
     this.HCCalculatorParams.CalculatorType
         = this.HCCalculatorParams.AnalyzerParms.FilesToAnalyzeExtensionType;
     if (this.AnalyzerType != ANALYZER_TYPES.resources01)
     {
         //resources01 uses the calculator pattern, which does not change startingdoctocalc
         this.HCCalculatorParams.StartingDocToCalcNodeName
             = GetNodeNameFromFileExtensionType(this.HCCalculatorParams.AnalyzerParms.FilesToAnalyzeExtensionType);
     }
     this.HCCalculatorParams.SubApplicationType
         = CalculatorHelpers.GetSubAppTypeFromNodeName2(
               this.HCCalculatorParams.StartingDocToCalcNodeName);
 }
Exemplo n.º 16
0
        private void AddObservation(ref XElement obsElement, ref CalculatorParameters calcParameters,
                                    ref string attName, ref string attValue)
        {
            string sAttributeValueList = string.Empty;

            //convert the attribute name to the statistical object property names
            //used in further analyses (i.e. output.amount to output.tramount)
            CostBenefitCalculator.ConvertAttributeNameToStatisticName(
                calcParameters.CurrentElementNodeName, ref attName);
            if (!string.IsNullOrEmpty(attName))
            {
                if (obsElement.Attribute(attName)
                    != null)
                {
                    //add to the existing observations
                    string sOldAttValue = CalculatorHelpers.GetAttribute(
                        obsElement, attName);
                    string sTotalAttsValue = string.Concat(sOldAttValue,
                                                           Constants.STRING_DELIMITER, attValue);
                    sAttributeValueList = string.Concat(sTotalAttsValue,
                                                        Constants.FILENAME_DELIMITER, calcParameters.AnalyzerParms.FilePositionIndex.ToString());
                    //double delimited string: 2.52_1;3.25_1
                    attValue = sAttributeValueList;
                }
                else
                {
                    //add to a new observation
                    //always use standard delimited string
                    sAttributeValueList = string.Concat(attValue,
                                                        Constants.FILENAME_DELIMITER, calcParameters.AnalyzerParms.FilePositionIndex.ToString());
                    //double delimited string: 2.52_1;3.25_1
                    attValue = sAttributeValueList;
                }
            }
        }
Exemplo n.º 17
0
        public virtual void SetTotalME2IndicatorStocksProperties(XElement calculator)
        {
            //remember that the analyzer inheriting from this must .SetAnalyzerProps
            if (this.ME2IndicatorStocks == null)
            {
                this.ME2IndicatorStocks = new List <ME2IndicatorStock>();
            }
            //score, or index = 0, is just another stock that can be aggreg and compared to other scores
            int i = 0;
            //standard attname used throughout DevTreks
            string sAttNameExtension = string.Empty;
            //don't make unnecessary collection members
            string sHasAttribute = string.Empty;

            for (i = 0; i < this.MaximumNumberOfME2IndicatorStocks; i++)
            {
                sAttNameExtension = i.ToString();
                sHasAttribute     = CalculatorHelpers.GetAttribute(calculator,
                                                                   string.Concat(cTME2Name, sAttNameExtension));
                if (!string.IsNullOrEmpty(sHasAttribute))
                {
                    sHasAttribute = CalculatorHelpers.GetAttribute(calculator,
                                                                   string.Concat(cTME2Label, sAttNameExtension));
                    if (!string.IsNullOrEmpty(sHasAttribute))
                    {
                        ME2IndicatorStock ind1 = new ME2IndicatorStock(this.CalcParameters);
                        SetTotalME2IndicatorStockProperties(ind1, sAttNameExtension, calculator);
                        this.ME2IndicatorStocks.Add(ind1);
                    }
                }
                sHasAttribute = string.Empty;
            }
        }
Exemplo n.º 18
0
        public virtual void SetTotalSubPrice2StocksProperties(XElement calculator)
        {
            //remember that the analyzer inheriting from this must .SetAnalyzerProps
            if (this.SubPrice2Stocks == null)
            {
                this.SubPrice2Stocks = new List <SubPrice2Stock>();
            }
            int i = 1;
            //standard attname used throughout DevTreks
            string sAttNameExtension = string.Empty;
            //don't make unnecessary collection members
            string sHasAttribute = string.Empty;

            for (i = 1; i < this.MaximumNumberOfSubPrice2Stocks; i++)
            {
                sAttNameExtension = i.ToString();
                sHasAttribute     = CalculatorHelpers.GetAttribute(calculator,
                                                                   string.Concat(SubPrice1.cSubPName, sAttNameExtension));
                if (!string.IsNullOrEmpty(sHasAttribute))
                {
                    SubPrice2Stock ind1 = new SubPrice2Stock();
                    SetTotalSubPrice2StockProperties(ind1, sAttNameExtension, calculator);
                    this.SubPrice2Stocks.Add(ind1);
                }
                sHasAttribute = string.Empty;
            }
        }
Exemplo n.º 19
0
 public void SetTimelinessBaseProperties(XElement currentElement)
 {
     //need some base props to be displayed in calculator
     //opcomp.amount
     this.Amount = CalculatorHelpers.GetAttributeDouble(currentElement, Constants.AMOUNT);
     //opcomp.unit
     this.Unit = CalculatorHelpers.GetAttribute(currentElement, Constants.UNIT);
 }
Exemplo n.º 20
0
 //set the class properties using the XElement
 public virtual void SetDemog3Properties(XElement currentCalculationsElement)
 {
     //don't set any input properties; each calculator should set what's needed separately
     this.Housing              = CalculatorHelpers.GetAttribute(currentCalculationsElement, cHousing);
     this.WorkStatus           = CalculatorHelpers.GetAttribute(currentCalculationsElement, cWorkStatus);
     this.MaritalStatus        = CalculatorHelpers.GetAttribute(currentCalculationsElement, cMaritalStatus);
     this.LocationId           = CalculatorHelpers.GetAttribute(currentCalculationsElement, cLocationId);
     this.FamilyIncomeCurrency = CalculatorHelpers.GetAttribute(currentCalculationsElement, cFamilyIncomeCurrency);
     this.FamilyIncomePerYear  = CalculatorHelpers.GetAttributeInt(currentCalculationsElement, cFamilyIncomePerYear);
 }
Exemplo n.º 21
0
        public virtual void SetMachinery1InputProperties(XElement calculator)
        {
            //set this object's properties
            this.MarketValue = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                    cMarketValue);
            this.ListPriceAdj = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                     cListPriceAdj);
            this.SalvageValue = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                     cSalvageValue);
            this.FuelAmount = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                   cFuelAmount);
            this.FuelUnit = CalculatorHelpers.GetAttribute(calculator,
                                                           cFuelUnit);
            this.FuelPrice = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                  cFuelPrice);
            this.FuelCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                 cFuelCost);
            this.LubeOilAmount = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                      cLubeOilAmount);
            this.LubeOilUnit = CalculatorHelpers.GetAttribute(calculator,
                                                              cLubeOilUnit);
            this.LubeOilPrice = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                     cLubeOilPrice);
            this.LubeOilCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                    cLubeOilCost);
            this.RepairCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                   cRepairCost);
            this.LaborAmount = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                    cLaborAmount);
            this.LaborUnit = CalculatorHelpers.GetAttribute(calculator,
                                                            cLaborUnit);
            this.LaborPrice = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                   cLaborPrice);
            this.LaborCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                  cLaborCost);

            this.ServiceUnits = CalculatorHelpers.GetAttribute(calculator,
                                                               cServiceUnits);
            this.ServiceCapacityUnits = CalculatorHelpers.GetAttribute(calculator,
                                                                       cServiceCapacityUnits);
            this.CapitalRecoveryCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                            cCapitalRecoveryCost);
            this.TaxesHousingInsuranceCost = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                                  cTaxesHousingInsuranceCost);
            this.OptionForCapacity = CalculatorHelpers.GetAttributeInt(calculator,
                                                                       cOptionForCapacity);
            this.OptionForInflation = CalculatorHelpers.GetAttributeInt(calculator,
                                                                        cOptionForInflation);
            this.OptionForTime = CalculatorHelpers.GetAttributeInt(calculator,
                                                                   cOptionForTime);
            this.OptionForFuel = CalculatorHelpers.GetAttributeInt(calculator,
                                                                   cOptionForFuel);
            this.LaborAmountAdj = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                       cLaborAmountAdj);
        }
Exemplo n.º 22
0
 public void SetIndicatorT1Properties(string attNameExtension,
                                      XElement calculator)
 {
     //set this object's properties
     this.IT1NodeType = CalculatorHelpers.GetAttribute(calculator,
                                                       string.Concat(cIT1NodeType, attNameExtension));
     this.IT1CalcName = CalculatorHelpers.GetAttribute(calculator,
                                                       string.Concat(cIT1CalcName, attNameExtension));
     this.IT1PropertyName = CalculatorHelpers.GetAttribute(calculator,
                                                           string.Concat(cIT1PropertyName, attNameExtension));
 }
Exemplo n.º 23
0
 //set the class properties using the XElement
 public virtual void SetDemog1Properties(XElement currentCalculationsElement)
 {
     //don't set any input properties; each calculator should set what's needed separately
     this.Age            = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cAge);
     this.EducationYears = CalculatorHelpers.GetAttributeDouble(currentCalculationsElement, cEducationYears);
     this.Race           = CalculatorHelpers.GetAttribute(currentCalculationsElement, cRace);
     this.Housing        = CalculatorHelpers.GetAttribute(currentCalculationsElement, cHousing);
     this.Gender         = CalculatorHelpers.GetAttribute(currentCalculationsElement, cGender);
     this.WorkStatus     = CalculatorHelpers.GetAttribute(currentCalculationsElement, cWorkStatus);
     this.MaritalStatus  = CalculatorHelpers.GetAttribute(currentCalculationsElement, cMaritalStatus);
     this.LocationId     = CalculatorHelpers.GetAttribute(currentCalculationsElement, cLocationId);
 }
Exemplo n.º 24
0
 public static bool IsAnnuity(XElement currentElement)
 {
     bool bIsAnnuity = false;
     ANNUITY_TYPES eAnnuityType = GetAnnuityType(currentElement);
     string sAnnuityLabel = CalculatorHelpers.GetAttribute(currentElement, 
         Calculator1.cLabel);
     if (eAnnuityType != ANNUITY_TYPES.none
         || sAnnuityLabel == DataAppHelpers.Economics1.ANNUITY)
     {
         bIsAnnuity = true;
     }
     return bIsAnnuity;
 }
Exemplo n.º 25
0
 private void SetSubPrice3Properties(SubPrice3 subP, string attNameExtension,
                                     XElement calculator)
 {
     //set this object's properties
     subP.SubPName = CalculatorHelpers.GetAttribute(calculator,
                                                    string.Concat(cSubPName, attNameExtension));
     subP.SubPDescription = CalculatorHelpers.GetAttribute(calculator,
                                                           string.Concat(cSubPDescription, attNameExtension));
     subP.SubPLabel = CalculatorHelpers.GetAttribute(calculator,
                                                     string.Concat(cSubPLabel, attNameExtension));
     subP.SubPAltType = CalculatorHelpers.GetAttribute(calculator,
                                                       string.Concat(cSubPAltType, attNameExtension));
     subP.SubPType = CalculatorHelpers.GetAttribute(calculator,
                                                    string.Concat(cSubPType, attNameExtension));
     subP.SubPAmount = CalculatorHelpers.GetAttributeDouble(calculator,
                                                            string.Concat(cSubPAmount, attNameExtension));
     subP.SubPUnit = CalculatorHelpers.GetAttribute(calculator,
                                                    string.Concat(cSubPUnit, attNameExtension));
     subP.SubPPrice = CalculatorHelpers.GetAttributeDouble(calculator,
                                                           string.Concat(cSubPPrice, attNameExtension));
     subP.SubPFactor = CalculatorHelpers.GetAttributeDouble(calculator,
                                                            string.Concat(cSubPFactor, attNameExtension));
     subP.SubPYears = CalculatorHelpers.GetAttributeDouble(calculator,
                                                           string.Concat(cSubPYears, attNameExtension));
     subP.SubPEscRate = CalculatorHelpers.GetAttributeDouble(calculator,
                                                             string.Concat(cSubPEscRate, attNameExtension));
     subP.SubPEscType = CalculatorHelpers.GetAttribute(calculator,
                                                       string.Concat(cSubPEscType, attNameExtension));
     subP.SubPTotal = CalculatorHelpers.GetAttributeDouble(calculator,
                                                           string.Concat(cSubPTotal, attNameExtension));
     subP.SubPTotalPerUnit = CalculatorHelpers.GetAttributeDouble(calculator,
                                                                  string.Concat(cSubPTotalPerUnit, attNameExtension));
     subP.SubPDistType = CalculatorHelpers.GetAttribute(calculator,
                                                        string.Concat(cSubPDistType, attNameExtension));
     subP.SubPAmountB = CalculatorHelpers.GetAttributeDouble(calculator,
                                                             string.Concat(cSubPAmountB, attNameExtension));
     subP.SubPPriceB = CalculatorHelpers.GetAttributeDouble(calculator,
                                                            string.Concat(cSubPPriceB, attNameExtension));
     subP.SubPEscRateB = CalculatorHelpers.GetAttributeDouble(calculator,
                                                              string.Concat(cSubPEscRateB, attNameExtension));
     subP.SubPTotalB = CalculatorHelpers.GetAttributeDouble(calculator,
                                                            string.Concat(cSubPTotalB, attNameExtension));
     subP.SubPAmountC = CalculatorHelpers.GetAttributeDouble(calculator,
                                                             string.Concat(cSubPAmountC, attNameExtension));
     subP.SubPPriceC = CalculatorHelpers.GetAttributeDouble(calculator,
                                                            string.Concat(cSubPPriceC, attNameExtension));
     subP.SubPEscRateC = CalculatorHelpers.GetAttributeDouble(calculator,
                                                              string.Concat(cSubPEscRateC, attNameExtension));
     subP.SubPTotalC = CalculatorHelpers.GetAttributeDouble(calculator,
                                                            string.Concat(cSubPTotalC, attNameExtension));
 }
Exemplo n.º 26
0
        //set the class properties using the XElement
        public void SetOperationComponentProperties(CalculatorParameters calcParameters,
                                                    XElement currentCalculationsElement, XElement currentElement)
        {
            //several extensions store some calculator props in base element (observations, targettype)
            //no harm done in setting them but never set their attributes in base element
            this.SetCalculatorProperties(currentCalculationsElement);
            this.SetSharedObjectProperties(currentElement);
            this.SetTotalCostsProperties(currentElement);
            this.AnnuityType = TimePeriod.GetAnnuityType(currentElement);
            if (currentElement.Name.LocalName
                != DataAppHelpers.Prices.OPERATION_PRICE_TYPES.operationgroup.ToString() &&
                currentElement.Name.LocalName
                != DataAppHelpers.Prices.COMPONENT_PRICE_TYPES.componentgroup.ToString())
            {
                this.Amount = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                                   DataAppHelpers.General.AMOUNT);
                this.Date = CalculatorHelpers.GetAttributeDate(currentElement,
                                                               ENDOFPERIOD_DATE);
                this.Unit = CalculatorHelpers.GetAttribute(currentElement,
                                                           DataAppHelpers.General.UNIT);
                this.Weight = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                                   DataAppHelpers.Prices.WEIGHT);
                this.EffectiveLife = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                                          DataAppHelpers.Prices.EFFECTIVE_LIFE);
                this.SalvageValue = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                                         DataAppHelpers.Prices.SALVAGE_VALUE);
                this.IncentiveAmount = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                                            DataAppHelpers.General.INCENTIVE_AMOUNT);
                this.IncentiveRate = CalculatorHelpers.GetAttributeDouble(currentElement,
                                                                          DataAppHelpers.General.INCENTIVE_RATE);
                if (this.SubApplicationType == Constants.SUBAPPLICATION_TYPES.budgets.ToString())
                {
                    this.TimePeriodId = CalculatorHelpers.GetAttributeInt(currentElement,
                                                                          DataAppHelpers.Economics1.BUDGETSYSTEM_TO_TIME_ID);
                }
                else if (this.SubApplicationType == Constants.SUBAPPLICATION_TYPES.investments.ToString())
                {
                    this.TimePeriodId = CalculatorHelpers.GetAttributeInt(currentElement,
                                                                          DataAppHelpers.Economics1.COSTSYSTEM_TO_TIME_ID);
                }
            }
            this.AnnuityCount = 0;
            this.Local        = new Local();
            string sCurrentNodeURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(
                      calcParameters.ExtensionDocToCalcURI.URIPattern, currentElement);

            this.Local = CalculatorHelpers.GetLocal(sCurrentNodeURIPattern, calcParameters,
                                                    currentCalculationsElement, currentElement);
            this.XmlDocElement = currentCalculationsElement;
        }
Exemplo n.º 27
0
 //set the class properties using the XElement
 private void SetIndicatorQ1Properties(IndicatorQ1 indQ, string attNameExtension,
                                       XElement currentCalculationsElement)
 {
     //don't set any input properties; each calculator should set what's needed separately
     indQ.IQ1NameA   = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cIQ1NameA, attNameExtension));
     indQ.IQ1AmountA = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cIQ1AmountA, attNameExtension));
     indQ.IQ1UnitA   = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cIQ1UnitA, attNameExtension));
     indQ.IQ1NameB   = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cIQ1NameB, attNameExtension));
     indQ.IQ1AmountB = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cIQ1AmountB, attNameExtension));
     indQ.IQ1UnitB   = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cIQ1UnitB, attNameExtension));
     indQ.IQ1NameC   = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cIQ1NameC, attNameExtension));
     indQ.IQ1AmountC = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cIQ1AmountC, attNameExtension));
     indQ.IQ1UnitC   = CalculatorHelpers.GetAttribute(currentCalculationsElement, string.Concat(cIQ1UnitC, attNameExtension));
 }
Exemplo n.º 28
0
        public static async Task <bool> AddConstants(CONSTANTS_TYPES constantType,
                                                     CalculatorParameters calcParameters)
        {
            bool   bHasAdded             = false;
            string sConstantsIdAttName   = string.Empty;
            string sConstantsFullDocPath = string.Empty;
            string sConstantsId          = string.Empty;
            string sConstantsNodeQry     = string.Empty;

            switch (constantType)
            {
            case CONSTANTS_TYPES.machineryconstant:
                sConstantsIdAttName = Constants.MACHINERY_CONSTANTS_ID;
                break;

            case CONSTANTS_TYPES.randmconstant:
                sConstantsIdAttName = Constants.RANDM_ID;
                break;

            default:
                break;
            }
            sConstantsFullDocPath = CalculatorHelpers.GetLinkedListPath(
                calcParameters, constantType.ToString());
            //use the calculator node constant id fields to find the correct node
            sConstantsId
                = CalculatorHelpers.GetAttribute(
                      calcParameters.LinkedViewElement, sConstantsIdAttName);
            if (!string.IsNullOrEmpty(sConstantsId))
            {
                string sURIPath = await CalculatorHelpers.GetResourceURIPath(calcParameters.ExtensionDocToCalcURI,
                                                                             sConstantsFullDocPath);

                calcParameters.ErrorMessage += calcParameters.ExtensionDocToCalcURI.ErrorMessage;
                if (string.IsNullOrEmpty(calcParameters.ErrorMessage))
                {
                    XElement rootConstants = CalculatorHelpers.LoadXElement(calcParameters.ExtensionDocToCalcURI,
                                                                            sConstantsFullDocPath);
                    if (rootConstants != null)
                    {
                        //add the remaining constants attributes
                        CalculatorHelpers.AddAttributesWithoutIdNameDesc(
                            constantType.ToString(), sConstantsId,
                            rootConstants, calcParameters.LinkedViewElement);
                    }
                    bHasAdded = true;
                }
            }
            return(bHasAdded);
        }
Exemplo n.º 29
0
 public void ChangeCalculator(XElement currentElement,
                              ref XElement calculator)
 {
     //these analyzers use atts from calculators only
     if (this.GCCalculatorParams.AnalyzerParms.AnalyzerType
         == ME2AnalyzerHelper.ANALYZER_TYPES.mechangealt.ToString() ||
         this.GCCalculatorParams.AnalyzerParms.AnalyzerType
         == ME2AnalyzerHelper.ANALYZER_TYPES.meprogress1.ToString())
     {
         //don't change the starting calculator
         if (this.GCCalculatorParams.StartingDocToCalcNodeName
             == currentElement.Name.LocalName)
         {
             return;
         }
         bool bIsChildren
             = CalculatorHelpers.IsSelfOrChildNode(this.GCCalculatorParams, currentElement.Name.LocalName);
         bool bIsTPGrandChild =
             (currentElement.Name.LocalName == BudgetInvestment.BUDGET_TYPES.budgettimeperiod.ToString() ||
              currentElement.Name.LocalName == BudgetInvestment.INVESTMENT_TYPES.investmenttimeperiod.ToString())
             ? true : false;
         //need the alt or target type from mecalcs
         if (bIsChildren || bIsTPGrandChild)
         {
             bool   bIsMECalculator  = false;
             string sCurrentCalcType = string.Empty;
             if (calculator != null)
             {
                 sCurrentCalcType = CalculatorHelpers.GetAttribute(calculator, Calculator1.cCalculatorType);
             }
             if (!string.IsNullOrEmpty(sCurrentCalcType))
             {
                 //see if it matches a real me calctype
                 CalculatorHelpers.CALCULATOR_TYPES calcType
                     = CalculatorHelpers.GetCalculatorType(sCurrentCalcType);
                 if (calcType != CalculatorHelpers.CALCULATOR_TYPES.none)
                 {
                     bIsMECalculator = true;
                 }
             }
             if (calculator == null ||
                 bIsMECalculator == false)
             {
                 calculator = CalculatorHelpers.GetChildLinkedViewUsingAttribute(currentElement,
                                                                                 Calculator1.cCalculatorType, currentElement.Name.LocalName);
             }
         }
     }
 }
Exemplo n.º 30
0
        public static SUBFOLDER_OPTIONS GetSubFolderType(XElement calculationsElement)
        {
            SUBFOLDER_OPTIONS eType = SUBFOLDER_OPTIONS.no;
            string            sType = CalculatorHelpers.GetAttribute(calculationsElement,
                                                                     Calculator1.cOption4);

            if (sType == SUBFOLDER_OPTIONS.no.ToString())
            {
                eType = SUBFOLDER_OPTIONS.no;
            }
            else if (sType == SUBFOLDER_OPTIONS.yes.ToString())
            {
                eType = SUBFOLDER_OPTIONS.yes;
            }
            return(eType);
        }