コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            AdminDashboard ds = new AdminDashboard();

            ds.Show();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
            AdminDashboard ad = new AdminDashboard();

            ad.Show();
        }
コード例 #3
0
ファイル: Admin.cs プロジェクト: sohail0992/quiz_contestor
        private void button1_Click(object sender, EventArgs e)
        {
            string name = admin_name.Text;
            string pass = admin_pass.Text;

            if (name != "" && pass != "")
            {
                db = new Database();
                int        status = 0;
                SqlCommand cmd    = db.conn.CreateCommand();
                cmd.CommandText = "admin_login";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@admin_name", name);
                cmd.Parameters.AddWithValue("@admin_pass", pass);
                try
                {
                    status = Convert.ToInt16(cmd.ExecuteScalar());
                }
                catch (NotFiniteNumberException)
                {
                    status = 0;
                }
                if (status == 1)
                {
                    db.Close();
                    this.Close();
                    AdminDashboard ad = new AdminDashboard();
                    ad.Show();
                }
                else
                {
                    MessageBox.Show("Invalid Username or password");
                    admin_name.Text = "";
                    admin_pass.Text = "";
                }
            }
            else
            {
                MessageBox.Show("Fields should not be empty");
            }
        }