CreateValuesElement(DataRow[] rows) { /* logic, look into datatable to get * - variableUnitsAbbreviation * if all the same, create values * - values * Then get qualifiers * * Future * if no MethodID and SourceID exists, but MethodDescript, and SourceDescrition exists * - create MethodID, and SourceID, and */ TsValuesSingleVariableType valuesElement = new TsValuesSingleVariableType(); List <ValueSingleVariable> valuesList = new List <ValueSingleVariable>(); foreach (DataRow row in rows) { ValueSingleVariable value = row2Value(row); if (value != null) { valuesList.Add(value); } } valuesElement.value = valuesList.ToArray(); valuesElement.count = valuesList.Count.ToString(); return(valuesElement); }
private TsValuesSingleVariableType CreateGWTimeSeriesObject(VariableParam vp, string aURL) { // download the iformation String resultFile = USGSCommon.GetHTTPFile(aURL, 10); TsValuesSingleVariableType values = new TsValuesSingleVariableType(); //result.TimeSeries.Values.valueUnits = units; // this needs to be done earlier DataTable aTable = NWISDelimitedTextParser.ParseFileIntoDT(resultFile); // dwv add code to get the code, and use that to find the correct columns int time = 2; // present location of time column String code = vp.Code; String stat = null; int aValue; int qualifier; //if (result.timeSeries.variable.options != null) //{ // stat = result.timeSeries.variable.options[0].Value; //} try { aValue = USGSCommon.getVarColumn(aTable, "lev_va", null); // uses eEndWith... so this should work qualifier = USGSCommon.getVarQualifiersColumn(aTable, "lev_status_cd", null); } catch (WaterOneFlowException we) { // need to insert the URL in the exception if (string.IsNullOrEmpty(stat)) { throw new WaterOneFlowException("URL: '" + aURL, we); //+"' variable '"+code+"' not found at site."); } else { throw new WaterOneFlowException("URL: '" + aURL, we); //+ "' variable '"+code+"' statistic '"+stat +"' not found at site. Try not using the statistic", we); } } List <ValueSingleVariable> tsTypeList = new List <ValueSingleVariable>(); //TimeSeriesFromRDB(aTable, time, aValue, qualifier, tsTypeList); USGSCommon.TimeSeriesFromRDB(aTable, time, aValue, qualifier, tsTypeList, false); values.count = tsTypeList.Count; values.value = tsTypeList.ToArray(); return(values); }
static void Main(string[] args) { XmlSchemaSet xmlSchemaSet = new XmlSchemaSet(); xmlSchemaSet.XmlResolver = new XmlUrlResolver(); //XmlSchema xmlSchema = WaterOneFlow.Schema.GetSchema.SchemaV1_0(); ; String xsd = WaterOneFlow.Schema.GetSchema.SchemaXmlV1_0(); XmlSchema xmlSchema = XmlSchema.Read(new StringReader(xsd), new ValidationEventHandler(ValidationCallBack)); xmlSchemaSet.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack); xmlSchemaSet.Add(xmlSchema); XmlSerializer serializer = new XmlSerializer(typeof(ValueSingleVariable)); XmlRootAttribute root = new XmlRootAttribute("value"); XmlSerializer serializerRoot = new XmlSerializer(typeof(ValueSingleVariable), root); ValueSingleVariable value = new ValueSingleVariable(); value.dateTime = DateTime.Now; value.Value = 1; value.qualifiers = "AD:CD ab:ab"; System.Console.WriteLine("NoRoot\n-----------------"); serializer.Serialize(System.Console.Out, value); System.Console.WriteLine("\nWithRoot\n-----------------"); serializerRoot.Serialize(System.Console.Out, value); serializer = new XmlSerializer(typeof(TsValuesSingleVariableType)); TsValuesSingleVariableType ts = new TsValuesSingleVariableType(); ts.value = new ValueSingleVariable[1]; ts.value[0] = value; ts.method = new MethodType[1]; ts.method[0] = new MethodType(); ts.method[0].MethodDescription = "method"; ts.count = ts.value.Length.ToString(); System.Console.WriteLine("\nTimeSeries\n-----------------"); serializer.Serialize(System.Console.Out, ts); System.Console.WriteLine("\nHit AnyKey to continue"); System.Console.ReadKey(); }
/// <summary> /// gather and save Original Agency data from webservice to database /// </summary> /// <param name="variable">object from the database that contains all the details of the series we are trying to gather data for</param> /// <param name="start">date at the beginning of the interval</param> /// <param name="end">date at end of interval</param>1 public void AgencyDataFill(L1HarvestList variable, string start, string end, int count) { DBLogging.WriteLog(Properties.Settings.Default.projectName, "Log", "Level1Data1_0" + "." + (new StackTrace(true)).GetFrame(0).GetMethod().Name + "()", String.Format("{0} {1} {2}-{3} {4}\t{5}-{6} {7}/{8}", "Level1", variable.SiteName, start.Replace('-', '/'), end.Replace('-', '/'), variable.SiteCode, variable.VariableCode, "Level1", count, db.SummaryDB.Count)); TimeSeriesType dataVals = this.GetData(variable, start, end); if (dataVals != null) { if (Convert.ToInt32(dataVals.values.count) >= 1) { int siteID = this.SiteData(variable); if (variable.SiteID == 0) { this.db.SummaryDB.UpdateHarvestSite(variable, siteID); } this.noDataValue = Convert.ToDouble(dataVals.variable.NoDataValue); TsValuesSingleVariableType vals = dataVals.values; DateTime startDate = (from n in vals.value select Convert.ToDateTime(n.dateTime)).Min(); DateTime endDate = (from n in vals.value select Convert.ToDateTime(n.dateTime)).Max(); var data = from n in vals.value select n; foreach (ValueSingleVariable member in data) { TimeSpan utcoffset = member.dateTime - member.dateTime.ToUniversalTime(); // site, Method, variable, Source this.values.Rows.Add(SqlInt32.Null, Convert.ToDouble(member.Value), (member.accuracyStdDev == 0 ? SqlDouble.Null : member.accuracyStdDev), member.dateTime, utcoffset.Hours /*utcoffset*/, member.dateTime.ToUniversalTime(), siteID, variable.VariableID, (member.offsetValue == 0 ? SqlDouble.Null : member.offsetValue), (Convert.ToInt32(member.offsetTypeID) == 0 ? SqlInt32.Null : Convert.ToInt32(member.offsetTypeID)), this.CensorCodeToString(member), SqlInt32.Null, variable.MethodID, variable.SourceID, (Convert.ToInt32(member.sampleID) == 0 ? SqlInt32.Null : Convert.ToInt32(member.sampleID)), SqlInt32.Null, variable.QualityControlLevelID); } this.db.TooDB.InsertBulk(this.values); DBLogging.WriteLog(Properties.Settings.Default.projectName, "Log", "Level1Data1_0" + "." + (new StackTrace(true)).GetFrame(0).GetMethod().Name + "()", values.Rows.Count + " Rows Saved. " + "Level1" + " " + variable.SiteName + " " + variable.SiteCode + "\t" + variable.VariableCode + "-" + "Level1"); this.db.TooDB.SaveSeries(siteID, variable); } else { //DBLogging.WriteLog(Properties.Settings.Default.projectName, "Log", "Level1Data1_0" + "." + (new StackTrace(true)).GetFrame(0).GetMethod().Name + "()", "No Values Found. " + variable.DataTimePeriod + " " + variable.SiteName + " " + variable.SiteCode + "\t" + variable.VariableCode + "-" + variable.DataTimePeriod); } } else { DBLogging.WriteLog(Properties.Settings.Default.projectName, "Log", "Level1Data1_0" + "." + (new StackTrace(true)).GetFrame(0).GetMethod().Name + "()", 0 + " Rows Saved. " + "Level1" + " " + variable.SiteName + " " + variable.SiteCode + "\t" + variable.VariableCode + "-" + "Level1"); } }
private static ValueSingleVariable CreateNoDataValue(DateTime time, TsValuesSingleVariableType s, int variableId) { ValueSingleVariable v = new ValueSingleVariable(); v.censorCode = "nc"; v.dateTime = Convert.ToDateTime(time); v.dateTimeUTC = v.dateTime.AddHours(-1); v.dateTimeUTCSpecified = true; v.methodCode = s.method[0].methodCode; v.methodID = v.methodCode; v.offsetValueSpecified = false; v.qualityControlLevelCode = "1"; v.sourceCode = "1"; v.sourceID = "1"; v.timeOffset = "01:00"; switch (variableId) { case 1: //for precipitation, set 'no data' to zero v.Value = 0.0M; break; case 4: v.Value = -9999.0M; break; case 5: v.Value = -9999.0M; break; case 8: v.Value = 0.0M; break; case 16: v.Value = -9999.0M; break; default: v.Value = -9999.0M; break; } return v; }
/// <summary> /// Get the values, from the Db /// </summary> /// <param name="siteId">site id (local database id)</param> /// <param name="variableId">variable id (local database id)</param> /// <param name="startDateTime"></param> /// <param name="endDateTime"></param> /// <returns></returns> internal static TsValuesSingleVariableType GetValuesFromDb(string siteId, string variableCode, DateTime startDateTime, DateTime endDateTime) { //numeric variable id int varId = VariableCodeToID(variableCode); //to get values, from the db TsValuesSingleVariableType s = new TsValuesSingleVariableType(); s.censorCode = new CensorCodeType[1]; s.censorCode[0] = new CensorCodeType(); s.censorCode[0].censorCode = "nc"; s.censorCode[0].censorCodeDescription = "not censored"; s.censorCode[0].censorCodeID = 1; s.censorCode[0].censorCodeIDSpecified = true; //method s.method = new MethodType[1]; s.method[0] = GetMethodForVariable(varId); string timeStep = "hour"; //time units s.units = new UnitsType(); s.units.unitAbbreviation = "hr"; s.units.unitCode = "103"; s.units.unitID = 104; s.units.unitName = "hour"; s.units.unitType = "Time"; timeStep = "hour"; //method s.method[0] = GetMethodForVariable(varId); //qc level s.qualityControlLevel = new QualityControlLevelType[1]; s.qualityControlLevel[0] = new QualityControlLevelType(); s.qualityControlLevel[0].definition = "raw data"; s.qualityControlLevel[0].explanation = "raw data"; s.qualityControlLevel[0].qualityControlLevelCode = "1"; s.qualityControlLevel[0].qualityControlLevelID = 1; s.qualityControlLevel[0].qualityControlLevelIDSpecified = true; //source //TODO: read the correct source s.source = new SourceType[1]; s.source[0] = GetSourceForSite(Convert.ToInt32(siteId)); s.source[0].citation = "CHMI"; s.source[0].organization = "CHMI"; s.source[0].sourceCode = "1"; s.source[0].sourceDescription = " measured by CHMI professional stations"; s.source[0].sourceID = 1; s.source[0].sourceIDSpecified = true; //values: get from database... string connStr = GetConnectionString(); List<ValueSingleVariable> valuesList = new List<ValueSingleVariable>(); using (SqlConnection cnn = new SqlConnection(connStr)) { using (SqlCommand cmd = new SqlCommand("plaveninycz.new_query_observations", cnn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@st_id", SqlDbType.SmallInt)); cmd.Parameters.Add(new SqlParameter("@var_id", SqlDbType.SmallInt)); cmd.Parameters.Add(new SqlParameter("@start_time", SqlDbType.SmallDateTime)); cmd.Parameters.Add(new SqlParameter("@end_time", SqlDbType.SmallDateTime)); cmd.Parameters.Add(new SqlParameter("@time_step", SqlDbType.VarChar)); cmd.Parameters.Add(new SqlParameter("@group_function", SqlDbType.VarChar)); cmd.Parameters["@st_id"].Value = Convert.ToInt32(siteId); cmd.Parameters["@var_id"].Value = varId; cmd.Parameters["@start_time"].Value = startDateTime; cmd.Parameters["@end_time"].Value = endDateTime; cmd.Parameters["@time_step"].Value = timeStep; cmd.Parameters["@group_function"].Value = "sum"; cnn.Open(); SqlDataReader r = cmd.ExecuteReader(); int obsTimeIndex = r.GetOrdinal("obs_time"); int obsValueIndex = r.GetOrdinal("obs_value"); while (r.Read()) { ValueSingleVariable v = new ValueSingleVariable(); v.censorCode = "nc"; v.dateTime = Convert.ToDateTime(r["obs_time"]); v.dateTimeUTC = v.dateTime.AddHours(-1); v.dateTimeUTCSpecified = true; v.methodCode = s.method[0].methodCode; v.methodID = v.methodCode; v.offsetValueSpecified = false; v.qualityControlLevelCode = "1"; v.sourceCode = "1"; v.sourceID = "1"; v.timeOffset = "01:00"; v.Value = convertValue(r["obs_value"], varId); valuesList.Add(v); } } } s.value = valuesList.ToArray(); ////convert list to array for temperature //if (varId == 16) //{ // s.value = valuesList.ToArray(); //} //else //{ // //convert list to array - for precip, snow, discharge, stage // DateTime beginDate = valuesList[0].dateTime; // DateTime endDate = valuesList[valuesList.Count - 1].dateTime; // int numHours = endDate.Subtract(beginDate).Hours; // ValueSingleVariable[] valuesArray = new ValueSingleVariable[numHours]; // int valueIndex = 0; // // DateTime curDate = beginDate; // foreach (ValueSingleVariable val in valuesList) // { // if (valueIndex >= valuesArray.Length) break; // // while (curDate < val.dateTime) // { // valuesArray[valueIndex] = CreateNoDataValue(curDate,s, varId); // curDate = curDate.AddHours(1); // valueIndex++; // } // // if (valueIndex >= valuesArray.Length) break; // valuesArray[valueIndex] = val; // curDate = val.dateTime.AddHours(1); // valueIndex++; // } // s.value = valuesArray; //} return s; }
public static TsValuesSingleVariableType CreateTimeSeriesValuesElement( //TimeSeriesResponseType result, VariableParam vp, string aURL, Boolean provisional) { // add the URL to be requested to the result //result.queryInfo.queryURL = aURL; // download the iformation String resultFile = GetHTTPFile(aURL, 10); //result.timeSeries.values = new TsValuesSingleVariableType(); //result.TimeSeries.Values.valueUnits = units; // this needs to be done earlier TsValuesSingleVariableType values = new TsValuesSingleVariableType(); DataTable aTable = NWISDelimitedTextParser.ParseFileIntoDT(resultFile); // dwv add code to get the code, and use that to find the correct columns int time = 2; // present location of time column // String code = result.timeSeries.variable.variableCode[0].Value; String code = vp.Code; String stat = null; try { stat = option2UsgsStatCode(vp); } catch (Exception ex) { log.Debug("option2UsgsStatCode() failed :" + ex.ToString()); stat = null; } int aValue; int qualifier; //if (result.timeSeries.variable.options != null) //{ // stat = result.timeSeries.variable.options[0].Value; //} try { aValue = getVarColumn(aTable, code, stat); qualifier = getVarQualifiersColumn(aTable, code, stat); } catch (WaterOneFlowException we) { /* even I'm confused here... * parsing column names gives an error * * This is post data rereiveal, so * if we do not find the correct column, then throw an error * */ string mess = "BAD COLUMN HEADER FROM USGS URL: " + aURL; // need to insert the URL in the exception if (string.IsNullOrEmpty(stat)) { log.Error("Bad Column varCode:" + code + " stat_cd:NULL " + mess, we); throw new WaterOneFlowSourceException("Improper COLUMN HEADER FROM USGS URL: " + aURL, we); //+"' variable '"+code+"' not found at site."); } else { log.Error("Bad Column varCode:" + code + " Stat_cd: " + stat + " " + mess, we); throw new WaterOneFlowSourceException("Improper COLUMN HEADER FROM USGS URL: " + aURL, we); //+ "' variable '"+code+"' statistic '"+stat +"' not found at site. Try not using the statistic", we); } } List <ValueSingleVariable> tsTypeList = new List <ValueSingleVariable>(); TimeSeriesFromRDB(aTable, time, aValue, qualifier, tsTypeList, provisional); values.count = tsTypeList.Count.ToString(); values.value = tsTypeList.ToArray(); if (provisional) { List <qualifier> quals = new List <qualifier>(); if (values.qualifier != null) { quals = new List <qualifier>(values.qualifier); } // this code is take from the daily values remark code // unit values just says provisional data in the header qualifier qual = new qualifier(); qual.qualifierCode = "P"; qual.network = "USGS"; qual.vocabulary = "dv_rmk_cd"; qual.Value = "Provisional data subject to revision."; quals.Add(qual); values.qualifier = quals.ToArray(); } return(values); }
public static TsValuesSingleVariableType[] getValues(ValuesDataSet ValuesDs, VariableParam variableParam, int?variableId) { // TimeSeriesResponseType response = CuahsiBuilder.CreateTimeSeriesObjectSingleValue(1); TsValuesSingleVariableType[] valuesList = new TsValuesSingleVariableType[1]; TsValuesSingleVariableType values = new TsValuesSingleVariableType(); valuesList[0] = values; // get siteInfo // get variable Info // get Values string valuesWhereClause = OdValuesCommon.CreateValuesWhereClause(variableParam, variableId); // reformats values dataset into a TimeSeriesResponseType IEnumerable <ValueSingleVariable> valueE = ODValues.dataset2ValuesList(ValuesDs, variableParam, variableId, variableDs); // do this by keeping a list of ID's then generating in after the values list is done values.value = new List <ValueSingleVariable>(valueE).ToArray(); //values.count = values.value.Length; if (values.value.Length > 0) { // add qualifiers List <QualifierType> qualifers = ODValues.datasetQualifiers(ValuesDs, valuesWhereClause); if (qualifers != null && qualifers.Count > 0) { values.qualifier = qualifers.ToArray(); } // add methods List <MethodType> methods = ODValues.datasetMethods(ValuesDs, valuesWhereClause); if (methods != null && methods.Count > 0) { values.method = methods.ToArray(); } List <SourceType> sources = ODValues.datasetSources(ValuesDs, valuesWhereClause); if (sources != null && sources.Count > 0) { values.source = sources.ToArray(); } List <OffsetType> offsets = ODValues.datasetOffsetTypes(ValuesDs, valuesWhereClause); if (offsets != null && offsets.Count > 0) { values.offset = offsets.ToArray(); } List <QualityControlLevelType> qcLevels = ODValues.DatasetQCLevels(ValuesDs, valuesWhereClause); if (qcLevels != null && qcLevels.Count > 0) { values.qualityControlLevel = qcLevels.ToArray(); } List <SampleType> samples = ODValues.datasetSamples(ValuesDs, valuesWhereClause); if (samples != null && samples.Count > 0) { values.sample = samples.ToArray(); } IEnumerable <CensorCodeType> codeTypes = ODValues.datasetCensorCodes(ValuesDs, valuesWhereClause); values.censorCode = new List <CensorCodeType>(codeTypes).ToArray(); } return(valuesList); }
private TsValuesSingleVariableType CreateWQTimeSeriesObject(VariableParam vp, string aURL) { // download the iformation String resultFile = USGSCommon.GetHTTPFile(aURL, 10); TsValuesSingleVariableType values = new TsValuesSingleVariableType(); //result.TimeSeries.Values.valueUnits = units; // this needs to be done earlier DataTable aTable = NWISDelimitedTextParser.ParseFileIntoDT(resultFile); // dwv add code to get the code, and use that to find the correct columns // time and date are separate int date = 2; // present location of time column int time = 3; String code = vp.Code; int codeCol; int aValue; int qualifier; // there are many qa columns. what do we want to do about them /* 20070909 * add # meth_cd - Method code # dqi_cd - Data-quality indicator code # rpt_lev_va - Reporting level # rpt_lev_cd - Reporting level type # lab_std_va - Lab standard deviation # anl_ent_cd - Analyzing entity code */ int method; try { /* 20070909 - USGS column name changes * parameter_cd to param_cd * APPSETTING: ConfigurationManager.AppSettings["parameterColumn"]; * qualifiers now in val_qual_tx * also: # meth_cd - Method code # dqi_cd - Data-quality indicator code # rpt_lev_va - Reporting level # rpt_lev_cd - Reporting level type # lab_std_va - Lab standard deviation # anl_ent_cd - Analyzing entity code */ //codeCol = getVarQualifiersColumn(aTable, "parameter_cd", null); string parmameterColName = (string)Properties.Settings.Default["parameterColumn"]; codeCol = USGSCommon.getVarQualifiersColumn(aTable, parmameterColName, null); aValue = USGSCommon.getVarColumn(aTable, "result_va", null); qualifier = USGSCommon.getVarQualifiersColumn(aTable, "remark_cd", null); // there are many qa columns. what do we want to do about them // qualifier = getVarColumn(aTable, "val_qual_tx", null); //Do Not use at present } catch (WaterOneFlowException we) { throw new WaterOneFlowException("URL: '" + aURL, we); } List <ValueSingleVariable> tsTypeList = new List <ValueSingleVariable>(); foreach (DataRow aRow in aTable.Rows) { if (aRow[codeCol].Equals(code)) { // only do this if this is the correct value ValueSingleVariable tsTypeValue = new ValueSingleVariable(); //tsTypeValue.time= Convert.ToDateTime(aRow[time]); tsTypeValue.dateTime = Convert.ToDateTime( aRow[date].ToString() + " " + aRow[time].ToString() ); // tsTypeValue.dateTimeSpecified = true; //tsTypeValue.censored = string.Empty; if (string.IsNullOrEmpty(aRow[aValue].ToString())) { continue; } else { tsTypeValue.Value = Convert.ToDecimal(aRow[aValue]); } USGSCommon.parseQualifiersForCensorCode(tsTypeValue, aRow[qualifier].ToString()); // this will add censored, if appropariate // added for hydrodesktop tsTypeValue.qualityControlLevel = QualityControlLevelEnum.Unknown; tsTypeValue.qualityControlLevelSpecified = true; tsTypeValue.methodID = 0; tsTypeValue.methodIDSpecified = true; tsTypeValue.sourceID = 1; tsTypeValue.sourceIDSpecified = true; tsTypeList.Add(tsTypeValue); } } values.count = tsTypeList.Count.ToString(); values.value = tsTypeList.ToArray(); // add added qualifiers values.source = new SourceType[1]; values.source[0] = new SourceType(); values.source[0].sourceID = 1; values.source[0].sourceIDSpecified = true; values.source[0].Organization = "USGS"; values.source[0].SourceDescription = "US Geological Survey National Water Information System"; values.source[0].SourceLink = "http://waterdata.usgs.gov/"; values.qualityControlLevel = new qualityControlLevel[1]; values.qualityControlLevel[0] = new qualityControlLevel(); values.qualityControlLevel[0].qualityControlLevelID = "0"; values.qualityControlLevel[0].qualityControlLevelCode = "Unknown"; values.method = new MethodType[1]; values.method[0] = new MethodType(); values.method[0].methodID = 0; values.method[0].methodIDSpecified = true; values.method[0].MethodDescription = "Unknown"; return(values); }
public static TsValuesSingleVariableType[] getValues(ValuesDataSet ValuesDs, VariableParam variableParam, int? variableId) { // TimeSeriesResponseType response = CuahsiBuilder.CreateTimeSeriesObjectSingleValue(1); TsValuesSingleVariableType[] valuesList = new TsValuesSingleVariableType[1]; TsValuesSingleVariableType values = new TsValuesSingleVariableType(); valuesList[0] = values; // get siteInfo // get variable Info // get Values string valuesWhereClause = OdValuesCommon.CreateValuesWhereClause(variableParam, variableId); // reformats values dataset into a TimeSeriesResponseType IEnumerable<ValueSingleVariable> valueE = ODValues.dataset2ValuesList(ValuesDs, variableParam, variableId, variableDs); // do this by keeping a list of ID's then generating in after the values list is done values.value = new List<ValueSingleVariable>(valueE).ToArray(); //values.count = values.value.Length; if (values.value.Length > 0) { // add qualifiers List<QualifierType> qualifers = ODValues.datasetQualifiers(ValuesDs, valuesWhereClause); if (qualifers != null && qualifers.Count > 0) { values.qualifier = qualifers.ToArray(); } // add methods List<MethodType> methods = ODValues.datasetMethods(ValuesDs, valuesWhereClause); if (methods != null && methods.Count > 0) { values.method = methods.ToArray(); } List<SourceType> sources = ODValues.datasetSources(ValuesDs, valuesWhereClause); if (sources != null && sources.Count > 0) { values.source = sources.ToArray(); } List<OffsetType> offsets = ODValues.datasetOffsetTypes(ValuesDs, valuesWhereClause); if (offsets != null && offsets.Count > 0) { values.offset = offsets.ToArray(); } List<QualityControlLevelType> qcLevels = ODValues.DatasetQCLevels(ValuesDs, valuesWhereClause); if (qcLevels != null && qcLevels.Count > 0) { values.qualityControlLevel = qcLevels.ToArray(); } List<SampleType> samples = ODValues.datasetSamples(ValuesDs, valuesWhereClause); if (samples != null && samples.Count > 0) { values.sample = samples.ToArray(); } IEnumerable<CensorCodeType> codeTypes = ODValues.datasetCensorCodes(ValuesDs, valuesWhereClause); values.censorCode = new List<CensorCodeType>(codeTypes).ToArray(); } return valuesList; }