/* * newTable * creates the Data Table required by rest of program to create the XML form */ private ValuesDataSet newTable(string variable, int SID, string Data) { SeriesCatalogTableAdapter scAdapater = new SeriesCatalogTableAdapter(); scAdapater.Connection.ConnectionString = odws.Config.ODDB(); ValuesDataSet ds = basicValuesDataSet(); DataTable variableTable = ds.Tables[0]; int ValueID = 0; foreach (string entry in Data.Split('\n')) { string[] row = entry.Split(','); if (row[0] != "" && row[0] != null) { ValueID++; seriesCatalogDataSet scTable = new seriesCatalogDataSet(); scAdapater.FillBySeriesID(scTable.SeriesCatalog, SID); seriesCatalogDataSet.SeriesCatalogRow sc = scTable.SeriesCatalog[0]; TimeSpan utcOffset = sc.BeginDateTime.Subtract(sc.BeginDateTimeUTC); variableTable.Rows.Add(ValueID, sc.SiteID, sc.VariableID, 0, 0, "nc", 0, sc.MethodID, sc.SourceID, 0, 0, sc.QualityControlLevelID, (row[0] == string.Empty) || row[1] == string.Empty ? -999999 : Convert.ToDouble(row[1]), 0, Convert.ToDateTime(row[0]), Convert.ToDateTime(row[0]).ToUniversalTime(), utcOffset.Hours); /*"ValueID","SiteID","VariableID",offsetvalue, offset type id, "CensorCode","QualifierID","MethodID","SourceID","SampleID","DerivedFromID","QualityControlLevelID", "Value", "AccuracyStdDev", "DateTime","DateTimeUTC", "UTCOffset"*/ } } return(ds); }
private static DateTime selectStartDate(DateTime start, int sID) { seriesCatalogDataSet sc = new seriesCatalogDataSet(); scAdapater.FillBySeriesID(sc.SeriesCatalog, sID); DateTime dbStart = sc.SeriesCatalog[0].BeginDateTime; if (start > dbStart) { return(start); } else { return(dbStart); } }
private DateTime selectEndDate(DateTime end, int seriesID) { SeriesCatalogTableAdapter scAdapater = new SeriesCatalogTableAdapter(); scAdapater.Connection.ConnectionString = odws.Config.ODDB(); seriesCatalogDataSet sc = new seriesCatalogDataSet(); scAdapater.FillBySeriesID(sc.SeriesCatalog, seriesID); DateTime dbEnd = sc.SeriesCatalog[0].EndDateTime; if (end < dbEnd) { return(end); } else { return(dbEnd); } }
private DateTime selectStartDate(DateTime start, int sID) { SeriesCatalogTableAdapter scAdapater = new SeriesCatalogTableAdapter(); scAdapater.Connection.ConnectionString = odws.Config.ODDB(); seriesCatalogDataSet sc = new seriesCatalogDataSet(); scAdapater.FillBySeriesID(sc.SeriesCatalog, sID); DateTime dbStart = sc.SeriesCatalog[0].BeginDateTime; if (start > dbStart) { return(start); } else { return(dbStart); } }