Exemplo n.º 1
0
 public void delete(object sender, EventArgs e)
 {
     try
     {
         if (!checkView())
         {
             throw new Exception();
         }
         DbInterface.open();
         lblStatus.Text = "Begin Query";
         string tab   = tab_table[tabControl1.SelectedTab];
         string query = DELETE.query[tab];
         Dictionary <string, string> args = getArgs(UPDATE, tab);
         lblStatus.Text = "Querying";
         DbInterface.Query(query, args);
         lblStatus.Text = "Query Successful";
         DbInterface.close();
         int row = view.dataGridView1.CurrentCell.RowIndex;
         read(tabControl1.SelectedTab, null);
         view.dataGridView1.CurrentCell = view.dataGridView1.Rows[row].Cells[0];
         if (row != 0)
         {
             view.dataGridView1[0, 0].Selected = false;
         }
         view.dataGridView1_CellClick(null, new DataGridViewCellEventArgs(0, row));
     }
     catch (Exception ex)
     {
         DbInterface.close();
         lblStatus.Text = "Query failed";
     }
 }
Exemplo n.º 2
0
 public void create(object sender, EventArgs e)
 {
     try
     {
         if (!checkView())
         {
             throw new Exception();
         }
         DbInterface.open();
         lblStatus.Text = "Begin Query";
         string tab   = tab_table[tabControl1.SelectedTab];
         string query = CREATE.query[tab];
         Dictionary <string, string> args = getArgs(UPDATE, tab);
         lblStatus.Text = "Querying";
         DbInterface.Query(query, args);
         lblStatus.Text = "Query Successful";
         DbInterface.close();
         read(tabControl1.SelectedTab, null);
     }
     catch (Exception ex)
     {
         DbInterface.close();
         lblStatus.Text = "Query failed";
     }
 }