Beispiel #1
0
        private void toolSession_Click(object sender, EventArgs e)
        {
            classQuery        classQuery = new classQuery();
            classDBConnection classDB    = new classDBConnection();

            //Load Config
            classQuery.LoadConfigDetails();
            //Change directory to RM
            Directory.SetCurrentDirectory(classQuery.rmPath);
            //Execute sessopen.exe
            var process = Process.Start(classQuery.rmPath + "\\sessopen.exe");

            process.WaitForExit();
            //get last current session
            classDB.rmPath = classQuery.rmPath;
            classDB.rmConnect();
            classDB.RMQueries("SELECT TOP 1 session_no, date_start, date_end FROM rep" + DateTime.Today.ToString("yy") + " ORDER BY session_no DESC");
            //MessageBox.Show(classDB.rdr["date_end"].ToString());
            if (!DBNull.Value.Equals(classDB.rdr["date_end"]))
            {
                frmReprocess frmReprocess = new frmReprocess();
                frmReprocess.Show();
            }
            classDB.rmDisconnect();
        }
        //login
        private void button1_Click(object sender, EventArgs e)
        {
            classQuery loginConnect = new classQuery();

            loginConnect.GetLoginDetails();
            if (txtPassword.Text != "")
            {
                if (txtPassword.Text == loginConnect.userPass)
                {
                    mdiMain mdiMain = new mdiMain();
                    mdiMain.WindowState      = FormWindowState.Maximized;
                    mdiMain.isConfigUnlocked = false;
                    mdiMain.Show();
                    this.Hide();
                }
                else if (txtPassword.Text == loginConnect.adminPass)
                {
                    mdiMain mdiMain = new mdiMain();
                    mdiMain.WindowState      = FormWindowState.Maximized;
                    mdiMain.isConfigUnlocked = true;
                    mdiMain.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Access Denied!");
                    txtPassword.Text = "";
                    txtPassword.Focus();
                }
            }
            else
            {
                MessageBox.Show("Enter password!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPassword.Text = "";
                txtPassword.Focus();
            }
        }