Beispiel #1
0
        public SimpleMathSeries(TimeSeriesDatabase db, Reclamation.TimeSeries.TimeSeriesDatabaseDataSet.SeriesCatalogRow sr) : base(db, sr)
        {
            string[] idList = ConnectionStringUtility.GetToken(ConnectionString, "SeriesList", "").Split(',');
            string[] opList = ConnectionStringUtility.GetToken(ConnectionString, "OperatorList", "").Split(',');
            m_operation = new MathOperation[opList.Length];


            m_items = new SeriesList();

            for (int i = 0; i < idList.Length; i++)
            {
                int id = -1;
                if (!Int32.TryParse(idList[i], out id) || !db.SeriesExists(id))
                {
                    Logger.WriteLine("Cannot calculate series.  Has the data this calculation needs been deleted?");
                    Name            = "Error: source data missing " + Name;
                    m_sourceDeleted = true;
                    break;
                }
                else
                {
                    Series s = db.GetSeries(id);
                    m_items.Add(s);
                }
            }
            ScenarioName = m_items[0].ScenarioName;
            // TO DO assuming all scenarioNames are the same.

            for (int i = 0; i < opList.Length; i++)
            {
                m_operation[i] = MathOperationFromString(opList[i]);
            }
        }