Example #1
0
 public void loadAppropriateWindow()
 {
     try
     {
         SqlConnection con = Database.GetConnectionObj();
         if (con == null) throw new Exception("Can't create and open a connection");
         SqlCommand cmd = new SqlCommand("", con);
         cmd.CommandText = string.Format(
             "SELECT file_name FROM dbo.file_list WHERE solver_name = '{0}' AND solve_status = 'solving'",
             username);
         SqlDataReader reader = cmd.ExecuteReader();
         if (reader.Read())
         {
             string filename = reader[0].ToString();
             //SolveWindow slw = new SolveWindow(filename, username, getSub(filename), this, false);
             //this.Hide();
             //slw.Show();
             E_solve slw = new E_solve(filename, username, getSub(filename), this, false);
             this.Hide();
             slw.Show();
             //this.Close();
         }
         else
         {
             File_List file_list_form = new File_List(username,this);
             file_list_form.Show();
             this.Hide();
         }
         reader.Dispose();
         con.Close();
         con.Dispose();
     }
     catch (Exception ee)
     {
         MessageBox.Show("Database error.\n" + ee.StackTrace.ToString());
         Application.Exit();
     }
 }
Example #2
0
 private void file_selected(object sender, EventArgs e)
 {
     int index = this.file_list_box.SelectedIndex;
     string filename= this.file_list_box.Items[index].ToString();
     //MessageBox.Show(filename);
     if (getAccess(filename))
     {
         //SolveWindow slw = new SolveWindow(filename, username, getSub(filename), this,true);
         E_solve slw = new E_solve(filename, username, getSub(filename), caller, true);
         this.Hide();
         slw.Show();
         //this.Close();
     }
     else
         MessageBox.Show("File Access failure. Try diffrent file.");
     this.file_list_box.Items.Remove(this.file_list_box.Items[index].ToString());
 }