private static void SaveToDatabase(string[] args, TimeSeriesDatabase db, string cbtt, string pcode, Series s) { Series hmet; if (args[1] == "daily") { hmet = Math.HydrometDaily(cbtt, pcode); } else { hmet = Math.HydrometInstant(cbtt, pcode); } hmet.Read(s.MinDateTime, s.MaxDateTime); s.Units = hmet.Units; s.Name = cbtt + "_" + pcode; db.AddSeries(s); db.AddSeries(hmet); }