Пример #1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            this.Hide();
            SelectionPage selectionPage = new SelectionPage();

            selectionPage.Show();
        }
Пример #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string sql = "select * from LoginTable where id = '" + this.txtId.Text + "' and password = '******';";
            DatabaseConfiguration dc = new DatabaseConfiguration();
            DataSet ds = dc.ExecuteQuery(sql);

            if (ds.Tables[0].Rows.Count == 1 && this.txtId.Text.Contains("AM"))
            {
                MessageBox.Show("Login Approved For " + ds.Tables[0].Rows[0][3].ToString());
                MessageBox.Show("Welcome " + ds.Tables[0].Rows[0][1].ToString());

                this.Hide();
                SupervisorPage supervisorPage = new SupervisorPage();
                supervisorPage.Show();
            }

            else if (ds.Tables[0].Rows.Count == 1 && this.txtId.Text.Contains("SV"))
            {
                MessageBox.Show("Login Approved For " + ds.Tables[0].Rows[0][3].ToString());
                MessageBox.Show("Welcome " + ds.Tables[0].Rows[0][1].ToString());
                this.Hide();
                SelectionPage selectionPage = new SelectionPage();
                selectionPage.Show();
            }
            else if (ds.Tables[0].Rows.Count == 1 && this.txtId.Text.Contains("G"))
            {
                MessageBox.Show("Login Approved For " + ds.Tables[0].Rows[0][3].ToString());
                MessageBox.Show("Welcome " + ds.Tables[0].Rows[0][1].ToString());
                this.Hide();
                GuardToPrisonerPage guardToPrisonerPage = new GuardToPrisonerPage();
                guardToPrisonerPage.Show();
            }
            else
            {
                MessageBox.Show("Login Invalid");
            }
        }