Ejemplo n.º 1
0
        private void sessionConfigurationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SessionConfig sConfig = new SessionConfig();

            sConfig.cancellable = true;
            sConfig.ShowDialog();
        }
Ejemplo n.º 2
0
 private void sessionConfigurationToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SessionConfig sConfig = new SessionConfig();
     sConfig.cancellable = true;
     sConfig.ShowDialog();
 }
Ejemplo n.º 3
0
 void checkSessionInfo()
 {
     int count =0;
     using (SqlConnection connection = new SqlConnection(GlobalVariables.dbConnectString))
     {
         try
         {
             connection.Open();
             String query = "Select count(*) from " + Table.session_info.tableName;
             using (SqlCommand command = new SqlCommand(query, connection))
             {
                 count = (int)command.ExecuteScalar();
             }
         }
         catch (Exception)
         {
             DialogResult dr = MessageBox.Show("Some Error Occurred", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             if (dr == System.Windows.Forms.DialogResult.OK)
             {
                 Close();
             }
         }
         finally
         {
             connection.Close();
         }
     }
     if (count != 0)
     {
         using (SqlConnection connection = new SqlConnection(GlobalVariables.dbConnectString))
         {
             try
             {
                 connection.Open();
                 String query = "Select " + Table.session_info.session + " from " + Table.session_info.tableName + " where "
                         + Table.session_info.active_session + " = 1";
                 using (SqlCommand command = new SqlCommand(query, connection))
                 {
                     SqlDataReader dr = command.ExecuteReader();
                     if(dr.Read())
                     {
                         GlobalVariables.currentSession = Convert.ToInt32(dr[Table.session_info.session]);
                     }
                     dr.Close();
                 }
             }
             catch (Exception)
             {
                 DialogResult dr = MessageBox.Show("Some Error Occurred", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 if (dr == System.Windows.Forms.DialogResult.OK)
                 {
                     Close();
                 }
             }
             finally
             {
                 connection.Close();
             }
         }
         return;
     }
     else
     {
         SessionConfig sConfig = new SessionConfig();
         sConfig.cancellable = false;
         sConfig.ShowDialog();
         if (sConfig.killParent) Close();
     }
 }
Ejemplo n.º 4
0
        void checkSessionInfo()
        {
            int count = 0;

            using (SqlConnection connection = new SqlConnection(GlobalVariables.dbConnectString))
            {
                try
                {
                    connection.Open();
                    String query = "Select count(*) from " + Table.session_info.tableName;
                    using (SqlCommand command = new SqlCommand(query, connection))
                    {
                        count = (int)command.ExecuteScalar();
                    }
                }
                catch (Exception)
                {
                    DialogResult dr = MessageBox.Show("Some Error Occurred", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    if (dr == System.Windows.Forms.DialogResult.OK)
                    {
                        Close();
                    }
                }
                finally
                {
                    connection.Close();
                }
            }
            if (count == 1)
            {
                using (SqlConnection connection = new SqlConnection(GlobalVariables.dbConnectString))
                {
                    try
                    {
                        connection.Open();
                        String query = "Select " + Table.session_info.session + " from " + Table.session_info.tableName;
                        using (SqlCommand command = new SqlCommand(query, connection))
                        {
                            SqlDataReader dr = command.ExecuteReader();
                            if (dr.Read())
                            {
                                GlobalVariables.currentSession = Convert.ToInt32(dr[Table.session_info.session]);
                            }
                            dr.Close();
                        }
                    }
                    catch (Exception)
                    {
                        DialogResult dr = MessageBox.Show("Some Error Occurred", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        if (dr == System.Windows.Forms.DialogResult.OK)
                        {
                            Close();
                        }
                    }
                    finally
                    {
                        connection.Close();
                    }
                }
                return;
            }
            else
            {
                SessionConfig sConfig = new SessionConfig();
                sConfig.cancellable = false;
                sConfig.ShowDialog();
                if (sConfig.killParent)
                {
                    Close();
                }
            }
        }