private void dataGrid_Selection(object sender, EventArgs e) { if (executedFirstTime) { executedFirstTime = false; return; } try { int selectedIndex = dataGridViewSessions.SelectedRows[0].Index; if (selectedIndex != -1) { if (dataGridViewSessions.SelectedRows[0].Cells[0].Value != null) { int id = int.Parse(dataGridViewSessions.SelectedRows[0].Cells[0].Value.ToString()); selectedNonoverlap = new Nonoverlap(); selectedNonoverlap = nonoverlapService.GetNonoverlap(id); Console.WriteLine(id); #region Set data to Fields #endregion btnDelete.Enabled = true; } } } catch (ArgumentOutOfRangeException es) { Console.WriteLine(es.Message); } }
public List <Nonoverlap> getAllNonoverlaps() { string connectionString = @"Server=us-cdbr-east-03.cleardb.com;Database=heroku_e9719c4a59b4c8f;Uid=b9ff0a805dbcc5;Pwd=25d16e4a;"; MySqlConnection conn = new MySqlConnection(connectionString); List <Nonoverlap> arrayNonoverlaps = null; try { string query = "SELECT * FROM nonoverlaps"; conn.Open(); MySqlCommand cmd = new MySqlCommand(query, conn); MySqlDataReader rdr = cmd.ExecuteReader(); arrayNonoverlaps = new List <Nonoverlap>(); while (rdr.Read()) { Nonoverlap nonoverlap = new Nonoverlap(); nonoverlap.Id = rdr.GetInt32(0); nonoverlap.Non1_id = rdr.GetInt32(1); try { nonoverlap.Non2_id = rdr.GetInt32(2); nonoverlap.Non3_id = rdr.GetInt32(3); nonoverlap.Non4_id = rdr.GetInt32(4); } catch (Exception er) { if (er.Message == "") { } } arrayNonoverlaps.Add(nonoverlap); } } catch (Exception e) { Console.WriteLine(e.Message); } finally { conn.Close(); } return(arrayNonoverlaps); }
public List <Nonoverlap> getAllNonoverlaps() { SQLiteConnection conn = new SQLiteConnection("Data Source=database.db;Version=3;"); List <Nonoverlap> arrayNonoverlaps = null; try { string query = "SELECT * FROM nonoverlaps"; conn.Open(); SQLiteCommand cmd = new SQLiteCommand(query, conn); SQLiteDataReader rdr = cmd.ExecuteReader(); arrayNonoverlaps = new List <Nonoverlap>(); while (rdr.Read()) { Nonoverlap nonoverlap = new Nonoverlap(); nonoverlap.Id = rdr.GetInt32(0); nonoverlap.Non1_id = rdr.GetInt32(1); try { nonoverlap.Non2_id = rdr.GetInt32(2); nonoverlap.Non3_id = rdr.GetInt32(3); nonoverlap.Non4_id = rdr.GetInt32(4); } catch (Exception er) { if (er.Message == "") { } } arrayNonoverlaps.Add(nonoverlap); } } catch (Exception e) { Console.WriteLine(e.Message); } finally { conn.Close(); } return(arrayNonoverlaps); }
public Nonoverlap GetNonoverlap(int id) { string connectionString = @"Server=us-cdbr-east-03.cleardb.com;Database=heroku_e9719c4a59b4c8f;Uid=b9ff0a805dbcc5;Pwd=25d16e4a;"; MySqlConnection conn = new MySqlConnection(connectionString); Nonoverlap nonoverlap = new Nonoverlap(); try { string query = "SELECT * FROM nonoverlaps WHERE id = @id"; conn.Open(); MySqlCommand cmd = new MySqlCommand(query, conn); cmd.Parameters.AddWithValue("@id", id); MySqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { nonoverlap.Id = rdr.GetInt32(0); nonoverlap.Non1_id = rdr.GetInt32(1); try { nonoverlap.Non2_id = rdr.GetInt32(2); nonoverlap.Non3_id = rdr.GetInt32(3); nonoverlap.Non4_id = rdr.GetInt32(4); } catch (Exception er) { if (er.Message == "") { } } } } catch (Exception e) { Console.WriteLine(e.Message); } finally { conn.Close(); } return(nonoverlap); }
public Nonoverlap GetNonoverlap(int id) { SQLiteConnection conn = new SQLiteConnection("Data Source=database.db;Version=3;"); Nonoverlap nonoverlap = new Nonoverlap(); try { string query = "SELECT * FROM nonoverlaps WHERE id = @id"; conn.Open(); SQLiteCommand cmd = new SQLiteCommand(query, conn); cmd.Parameters.AddWithValue("@id", id); SQLiteDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { nonoverlap.Id = rdr.GetInt32(0); nonoverlap.Non1_id = rdr.GetInt32(1); try { nonoverlap.Non2_id = rdr.GetInt32(2); nonoverlap.Non3_id = rdr.GetInt32(3); nonoverlap.Non4_id = rdr.GetInt32(4); } catch (Exception er) { if (er.Message == "") { } } } } catch (Exception e) { Console.WriteLine(e.Message); } finally { conn.Close(); } return(nonoverlap); }
public List <Nonoverlap> searchNonoverlap(string key, string type) { string connectionString = @"Server=us-cdbr-east-03.cleardb.com;Database=heroku_e9719c4a59b4c8f;Uid=b9ff0a805dbcc5;Pwd=25d16e4a;"; MySqlConnection conn = new MySqlConnection(connectionString); List <Nonoverlap> arrayNonoverlaps = null; try { string query = "SELECT * FROM nonoverlaps WHERE " + type + " LIKE '%" + key + "%'"; conn.Open(); MySqlCommand cmd = new MySqlCommand(query, conn); cmd.Parameters.AddWithValue("@type", type); MySqlDataReader rdr = cmd.ExecuteReader(); arrayNonoverlaps = new List <Nonoverlap>(); while (rdr.Read()) { Nonoverlap nonoverlap = new Nonoverlap(); nonoverlap.Id = rdr.GetInt32(0); nonoverlap.Non1_id = rdr.GetInt32(1); nonoverlap.Non2_id = rdr.GetInt32(2); nonoverlap.Non3_id = rdr.GetInt32(3); nonoverlap.Non4_id = rdr.GetInt32(4); arrayNonoverlaps.Add(nonoverlap); } } catch (Exception e) { Console.WriteLine(e.Message); } finally { conn.Close(); } return(arrayNonoverlaps); }
public List <Nonoverlap> searchNonoverlap(string key, string type) { SQLiteConnection conn = new SQLiteConnection("Data Source=database.db;Version=3;"); List <Nonoverlap> arrayNonoverlaps = null; try { string query = "SELECT * FROM nonoverlaps WHERE " + type + " LIKE '%" + key + "%'"; conn.Open(); SQLiteCommand cmd = new SQLiteCommand(query, conn); cmd.Parameters.AddWithValue("@type", type); SQLiteDataReader rdr = cmd.ExecuteReader(); arrayNonoverlaps = new List <Nonoverlap>(); while (rdr.Read()) { Nonoverlap nonoverlap = new Nonoverlap(); nonoverlap.Id = rdr.GetInt32(0); nonoverlap.Non1_id = rdr.GetInt32(1); nonoverlap.Non2_id = rdr.GetInt32(2); nonoverlap.Non3_id = rdr.GetInt32(3); nonoverlap.Non4_id = rdr.GetInt32(4); arrayNonoverlaps.Add(nonoverlap); } } catch (Exception e) { Console.WriteLine(e.Message); } finally { conn.Close(); } return(arrayNonoverlaps); }
private void btnRefresh_Click(object sender, EventArgs e) { populateData(); selectedNonoverlap = new Nonoverlap(); btnDelete.Enabled = false; }
public bool updateNonoverlap(int id, Nonoverlap nonoverlap) { throw new NotImplementedException(); }