public void CopyTotalME2Total1Properties(ME2Total1 calculator) { this.ErrorMessage = calculator.ErrorMessage; //copy the initial totals and the indicators (used in RunAnalyses) CopyTotalME2IndicatorStockProperties(this, calculator); //copy the calculator.ME2Stocks collection if (this.Stocks == null) { this.Stocks = new List <ME2Stock>(); } if (calculator.Stocks == null) { calculator.Stocks = new List <ME2Stock>(); } //copy the calculated totals and the indicators //obsStock.Total1.Stocks holds a collection of total1s if (calculator.Stocks != null) { foreach (ME2Stock totalStock in calculator.Stocks) { ME2Total1 total = new ME2Total1(this.CalcParameters); if (totalStock.GetType().Equals(total.GetType())) { total = (ME2Total1)totalStock; if (total != null) { ME2Total1 newTotal = new ME2Total1(this.CalcParameters); //copy the totals and the indicators CopyTotalME2IndicatorStockProperties(newTotal, total); this.Stocks.Add(newTotal); } } } } }
public virtual void SetTotalME2Total1Attributes(string attNameExt, ref XmlWriter writer) { //the calling procedure processes the regular observation stock //obsStock.Total1.Stocks holds a collection of total1s if (this.Stocks != null) { int i = 0; string sAttNameExtension = string.Empty; foreach (ME2Stock totalStock in this.Stocks) { ME2Total1 total = new ME2Total1(this.CalcParameters); if (totalStock.GetType().Equals(total.GetType())) { total = (ME2Total1)totalStock; //1 index : Name2; not 2: Name2_3 sAttNameExtension = string.Concat(i.ToString(), attNameExt); SetTotalME2IndicatorStockAttributes(total, sAttNameExtension, ref writer); i++; } } } }