コード例 #1
0
        private void NHomeBtn_Click(object sender, EventArgs e)
        {
            this.Hide();
            HomePage1 hm = new HomePage1();

            hm.ShowDialog();
        }
コード例 #2
0
        private void NHomeBtn_Click(object sender, EventArgs e)
        {
            HomePage1 newHome = new HomePage1();

            this.Hide();
            newHome.ShowDialog();
        }
コード例 #3
0
        private void NHomeBtn_Click(object sender, EventArgs e)
        {
            HomePage1 openForm = new HomePage1();

            this.Hide();
            openForm.ShowDialog();
        }
コード例 #4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            HomePage1 home = new HomePage1();

            this.Hide();
            home.ShowDialog();
        }
コード例 #5
0
        private void BtnAddMarksTH_Click(object sender, EventArgs e)
        {
            HomePage1 hp1 = new HomePage1();

            this.Hide();
            hp1.ShowDialog();
        }
コード例 #6
0
        private void getUserData()
        {
            string name;
            string accessLevel;
            int    staffid;
            int    stuid;

            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT name,accessLevel,staffID FROM STAFF WHERE NIC = '" + unTxtBox.Text + "' AND password = '******'";
            cmd.ExecuteNonQuery();
            con.Close();
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);

            con.Open();
            SqlCommand cmd2 = con.CreateCommand();

            cmd2.CommandType = CommandType.Text;
            cmd2.CommandText = "SELECT SID,SNAME FROM Student WHERE [SEMAIL] = '" + unTxtBox.Text + "' AND [SPASSWORD] = '" + pwdTxtBox.Text + "'";
            cmd2.ExecuteNonQuery();
            con.Close();
            DataTable      dt2 = new DataTable();
            SqlDataAdapter da2 = new SqlDataAdapter(cmd2);

            da2.Fill(dt2);
            if (dt.Rows.Count == 1)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    name                    = dr["name"].ToString();
                    accessLevel             = dr["accessLevel"].ToString();
                    staffid                 = Int32.Parse(dr["staffID"].ToString());
                    GetSetInfo.userName     = name;
                    GetSetInfo.getsetsysLvl = accessLevel;
                    GetSetInfo.getsetusrId  = staffid;

                    if (accessLevel.Equals("Admin"))
                    {
                        HomePage1 loadHome1 = new HomePage1();
                        this.Hide();
                        loadHome1.ShowDialog();
                    }
                    else if (accessLevel.Equals("User"))
                    {
                        HomePage2 loadHome2 = new HomePage2();
                        this.Hide();
                        loadHome2.ShowDialog();
                    }
                }
            }
            else if (dt2.Rows.Count == 1)
            {
                foreach (DataRow dr2 in dt2.Rows)
                {
                    name  = dr2["SNAME"].ToString();
                    stuid = Int32.Parse(dr2["SID"].ToString());
                    GetSetInfo.userName     = name;
                    GetSetInfo.getsetusrId  = stuid;
                    GetSetInfo.getsetsysLvl = "Student";

                    HomePage3 loadHome3 = new HomePage3();
                    this.Hide();
                    loadHome3.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("Incorrect Username or Password!", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                pwdTxtBox.Clear();
            }
        }