private void processGenericData(DataTable data, int configuredDatasourceId) { RawDataValue[] dataValues; dataValues = RawDataValue.GetRawDataForBulkInsert(data, ddlTimestampColumn.SelectedItem.Text, ddlValueColumn.SelectedItem.Text, configuredDatasourceId, null); _db.BulkInsertRawData(dataValues); }
public void InsertRawData(RawDataValue dataValue, string context) { SqlCommand cmd; cmd = _dbConn.GetStoredProcedureCommand("RawData_InsertRawDataValue"); cmd.Parameters.AddWithValue("@ConfiguredDatasourceId", dataValue.ConfiguredDatasourceId); cmd.Parameters.AddWithValue("@DatasourceSubTypeId", dataValue.DatasourceSubTypeId); cmd.Parameters.AddWithValue("@Timestamp", dataValue.Timestamp); cmd.Parameters.AddWithValue("@FloatValue", dataValue.FloatValue); cmd.Parameters.AddWithValue("@Success", dataValue.Success); cmd.Parameters.AddWithValue("@Fuzzy", dataValue.Fuzzy); cmd.Parameters.AddWithValue("@SourceData", context); _dbConn.ExecuteNonQuery(cmd); }
private void processDigitalPointBacklinks(DataTable data, int configuredDatasourceId) { List <RawDataValue> dataValues; //Remove rows that are not for the selected site for (int i = data.Rows.Count - 1; i > 0; i--) { if (!data.Rows[i]["URL"].Equals(ddlDPBacklinksSite.SelectedItem.Text)) { data.Rows.Remove(data.Rows[i]); } } dataValues = new List <RawDataValue>(); dataValues.AddRange(RawDataValue.GetRawDataForBulkInsert(data, "Date", "Back Links", configuredDatasourceId, null)); _db.BulkInsertRawData(dataValues.ToArray()); }
/// <summary> /// Processes the data that is parsed from the standard /// adsense CSV format. /// </summary> /// <param name="adsenseData"> /// A data table that represents the adsense data. This is usually /// created from the CSV export format. /// </param> /// <param name="channelName"> /// If specified, the name of the channel to filter the data by. /// </param> /// <returns> /// An array of <see cref="RawDataValue" /> objects that are ready /// to be inserted into the database. NOTE: The datasource and the /// sub type object are NOT available in the raw data values. Only /// the ID of the sub type is set. /// </returns> public static RawDataValue[] ProcessAdsenseData(DataTable adsenseData, string channelName) { List <RawDataValue> dataValues; //Only get data for the correct channel, if specified if (!string.IsNullOrEmpty(channelName) && adsenseData.Columns.Contains("Channel")) { for (int i = adsenseData.Rows.Count - 1; i > 0; i--) { if (!adsenseData.Rows[i]["Channel"].Equals(channelName)) { adsenseData.Rows.Remove(adsenseData.Rows[i]); } } } dataValues = new List <RawDataValue>(); dataValues.AddRange(RawDataValue.GetRawDataForBulkInsert(adsenseData, "Date", "Earnings", 0, 1)); dataValues.AddRange(RawDataValue.GetRawDataForBulkInsert(adsenseData, "Date", "Page impressions", 0, 2)); dataValues.AddRange(RawDataValue.GetRawDataForBulkInsert(adsenseData, "Date", "Clicks", 0, 4)); return(dataValues.ToArray()); }