Beispiel #1
0
 //copy constructor
 public BudgetInvestment(CalculatorParameters calcParameters,
                         BudgetInvestment budgetOrInvestment)
 {
     //several extensions store some calculator props in base element (observations, targettype)
     //no harm done in setting them but never set their attributes
     this.CopyCalculatorProperties(budgetOrInvestment);
     this.CopySharedObjectProperties(budgetOrInvestment);
     this.InitialValue  = budgetOrInvestment.InitialValue;
     this.SalvageValue  = budgetOrInvestment.SalvageValue;
     this.InvestmentEAA = budgetOrInvestment.InvestmentEAA;
     this.Type          = budgetOrInvestment.Type;
     //calculators are always app-specific and must be copied subsequently
     this.Calculators = new List <Calculator1>();
     //better to set in base
     this.CopyTotalBenefitsProperties(budgetOrInvestment);
     this.CopyTotalCostsProperties(budgetOrInvestment);
     this.ErrorMessage = budgetOrInvestment.ErrorMessage;
     if (budgetOrInvestment.Local == null)
     {
         budgetOrInvestment.Local = new Local();
     }
     this.Local = new Local(calcParameters, budgetOrInvestment.Local);
     if (budgetOrInvestment.XmlDocElement != null)
     {
         this.XmlDocElement = new XElement(budgetOrInvestment.XmlDocElement);
     }
 }
Beispiel #2
0
        private void AddNewBudgetToCollection(BudgetInvestment budI, List <BudgetInvestment> bis)
        {
            BudgetInvestment bi = new BudgetInvestment(this.GCCalculatorParams, budI);

            bi.Calculators = new List <Calculator1>();
            if (budI.Calculators != null)
            {
                ME2AnalyzerHelper.CopyStockCalculator(this.GCCalculatorParams, budI.Calculators, bi.Calculators);
            }
            //calculators start with inputs and outputs
            bi.TimePeriods = new List <Extensions.TimePeriod>();
            if (budI.TimePeriods != null)
            {
                foreach (TimePeriod tp in budI.TimePeriods)
                {
                    AddNewTPToCollection(tp, bi.TimePeriods);
                }
            }
            bis.Add(bi);
        }