Example #1
0
    /// <summary>
    /// This method writes a new <see cref="List{RawData}"/> information
    /// to the trials data table of the dataset.
    /// </summary>
    /// <remarks>This change has to be afterwards written to the database file
    /// with a call to 
    /// <code>Queries.CreateRawDataTableInDB(subjectName);
    /// Queries.WriteRawDataWithBulkStatement(subjectName);</code></remarks>
    /// <param name="subjectName">A <see cref="string"/> with the subject name.</param>
    /// <param name="lstRawData">A <see cref="List{RawData}"/> with the 
    /// new raw data.</param>
    /// <returns><strong>True</strong>, if successful otherwise, <strong>false</strong>.</returns>
    public static bool WriteRawDataListToDataSet(string subjectName, List<RawData> lstRawData)
    {
      // Create Subjects rawdata table
      var subjectRawDataTable = new SQLiteOgamaDataSet.RawdataDataTable();

      // Give it correct name
      subjectRawDataTable.TableName = subjectName + "Rawdata";
      try
      {
        SaveDataToTable(lstRawData.ToArray(), subjectRawDataTable);

        // Add the raw data table to the DataTableCollection.
        Document.ActiveDocument.DocDataSet.Tables.Add(subjectRawDataTable);
      }
      catch (Exception ex)
      {
        ExceptionMethods.HandleException(ex);

        return false;
      }
      finally
      {
        subjectRawDataTable.Dispose();
      }

      return true;
    }