private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            Headmaster_Form d = new Headmaster_Form();

            d.Show();
        }
Exemple #2
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            Headmaster_Form HMF = new Headmaster_Form();
            Teacher_Form    TF  = new Teacher_Form();
            Accountant_Form AF  = new Accountant_Form();

            try
            {
                queryClass.login_func(txt_userid.Text, this.dataGridViewLogin);


                string userid   = dataGridViewLogin.CurrentRow.Cells[1].Value.ToString();
                string userPas  = dataGridViewLogin.CurrentRow.Cells[2].Value.ToString();
                string userType = dataGridViewLogin.CurrentRow.Cells[3].Value.ToString();



                string tpyeHeadmaster = "Headmaster";

                if (txt_userid.Text == userid && txt_pass.Text == userPas)
                {
                    if (userType == tpyeHeadmaster)
                    {
                        HMF.passType = tpyeHeadmaster;
                        HMF.Show();
                    }
                    else if (userType == "Teacher")
                    {
                        queryClass.loginTeacher(txt_userid.Text, dataGridViewLogin);
                        string userSubject = dataGridView_t_login.CurrentRow.Cells[5].Value.ToString();
                        TF.passTeacherType = userType;
                        TF.passTeacherSub  = userSubject;

                        TF.ShowDialog();
                    }

                    else if (userType == "Accountant")
                    {
                        queryClass.loginAccountant(txt_userid.Text, this.dataGridViewLogin);
                        AF.passAccountantType = userType;
                        AF.ShowDialog();
                    }
                }
                else
                {
                    MessageBox.Show("Invalid userid or pass");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Invalid userid or pass");
            }
        }