Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            S_Dasboard a = new S_Dasboard();

            a.Show();
            this.Hide();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            c.Open();
            if (this.radioButton2.Checked)
            {
                try
                {
                    SqlCommand    q  = new SqlCommand("Select UserName,Password,TeacherID from Teacher where UserName= '******' and Password='******' ", c);
                    SqlDataReader dr = q.ExecuteReader();
                    if (dr.Read())
                    {
                        if (dr["UserName"].ToString() == this.textBox1.Text && dr["Password"].ToString() == this.textBox2.Text)
                        {
                            T_ID = dr["TeacherID"].ToString();
                            Form2 a = new Form2();
                            a.Show();
                            this.Hide();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Wrong User Name and Password.", "Important Note", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2);
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show("Something Wrong Here Plz Contact Your Developer. " + err, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2);
                }
            }
            else if (this.radioButton1.Checked)
            {
                try
                {
                    SqlCommand    q  = new SqlCommand("Select UserName,Password,StudentID from Students where UserName= '******' and Password='******' ", c);
                    SqlDataReader dr = q.ExecuteReader();
                    if (dr.Read())
                    {
                        if (dr["UserName"].ToString() == this.textBox1.Text && dr["Password"].ToString() == this.textBox2.Text)
                        {
                            S_ID = dr["StudentID"].ToString();
                            S_Dasboard a = new S_Dasboard();
                            a.Show();
                            this.Hide();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Wrong User Name and Password.", "Important Note", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2);
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show("SomethingWron Here Plz Contact Your Developer" + err, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2);
                }
            }

            else
            {
            }
            c.Close();
        }