public List <int> GetMissingLines(int datasetId, DatasetsTables table, int totalLines) { string tableName = "EdgarDataset" + Enum.GetName(typeof(DatasetsTables), table); SqlParameter paramid = new SqlParameter("@datasetid", datasetId); SqlParameter paramtable = new SqlParameter("@table", tableName); SqlParameter paramTotal = new SqlParameter("@totallines", totalLines); //return Context.Database.SqlQuery<int>("exec GET_MISSING_LINE_NUMBERS @datasetid,@table,@totalLines", paramid, paramtable, paramTotal).ToList(); var conn = Context.Database.GetDbConnection(); var command = conn.CreateCommand(); command.CommandText = "exec GET_MISSING_LINE_NUMBERS @datasetid,@table,@totalLines"; command.Parameters.Add(paramid); command.Parameters.Add(paramtable); command.Parameters.Add(paramTotal); conn.Open(); var reader = command.ExecuteReader(); List <int> lines = new List <int>(); while (reader.Read()) { int line = reader.GetInt32(0); lines.Add(line); } conn.Close(); return(lines); }
public List <int> GetMissingLines(int datasetId, DatasetsTables table, int totalLines) { string tableName = "EdgarDataset" + Enum.GetName(typeof(DatasetsTables), table); SqlParameter paramid = new SqlParameter("@datasetid", datasetId); SqlParameter paramtable = new SqlParameter("@table", tableName); SqlParameter paramTotal = new SqlParameter("@totallines", totalLines); return(Context.Database.SqlQuery <int>("exec GET_MISSING_LINE_NUMBERS @datasetid,@table,@totalLines", paramid, paramtable, paramTotal).ToList()); }
private void UpdateDatasetStatus(int id, DatasetsTables table, SqlConnection conn) { SqlCommand comm = new SqlCommand(); comm.CommandText = "update EdgarDatasets set Processed" + Enum.GetName(typeof(DatasetsTables), table) + " = 0 where Id = " + id; comm.CommandType = CommandType.Text; comm.Connection = conn; comm.ExecuteNonQuery(); }
private void DeleteAllRows(int id, DatasetsTables table, SqlConnection conn) { SqlCommand comm = new SqlCommand(); comm.CommandTimeout = BulkTimeout; comm.CommandText = "delete from EdgarDataset" + Enum.GetName(typeof(DatasetsTables), table) + " where DatasetId = " + id; comm.CommandType = CommandType.Text; comm.Connection = conn; comm.ExecuteNonQuery(); }
public void DeleteAllRows(int id, DatasetsTables table) { using (SqlConnection conn = CreateBulkConnection()) { try { conn.Open(); DeleteAllRows(id, table, conn); UpdateDatasetStatus(id, table, conn); } finally { conn.Close(); } } }
public void BulkCopyTable(DatasetsTables table, DataTable dt) { BulkCopy("EdgarDataset" + Enum.GetName(typeof(DatasetsTables), table), dt); }
public DataTable GetEmptyDataTable(DatasetsTables table) { return(GetEmptyDataTable("EdgarDataset" + Enum.GetName(typeof(DatasetsTables), table))); }