示例#1
0
        private void btnMainMenu_Click(object sender, EventArgs e)
        {
            this.Hide();
            mainMenu mMenu = new mainMenu();

            mMenu.Show();
        }
        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Hide();
            mainMenu main = new mainMenu();

            main.Show();
        }
        private void loginbtn_Click(object sender, EventArgs e)
        {
            String atype = null;

            atype = atypelogin.Text.ToString();

            if (atypelogin.Text == "Admin")
            {
                String username = "******";
                String password = "******";

                if (usernametxt.Text == username && loginpasswordtxt.Text == password)
                {
                    this.Hide();
                    //   Form1 sf = new Form1();
                    //  sf.Show();
                    //   var form2 = Form1.StaffFrom2;
                    // this.Closed += (s, args) => this.Close();
                    //  form2.Show();

                    SchoolManagementSystem.mainMenu nm = new SchoolManagementSystem.mainMenu();
                    nm.Show();
                    //   var form3 = SchoolManagementSystem.mainMenu.maintt;
                    //   form3.Show();
                }
                else
                {
                    ErrorDialogBox.ShowDialog("UserName and Password Does not Match, Pleace Re Enter!!!", "Invaild UserName Or Password");
                    con.Close();
                    return;
                }
            }
            else if (atype == "Staff")
            {
                con.Open();
                SqlCommand     cmd     = new SqlCommand("select * from Staff_Mang_Table where NIC = '" + usernametxt.Text + "' AND password = '******'", con);
                SqlDataAdapter checkDa = new SqlDataAdapter(cmd);

                SqlDataReader reader = cmd.ExecuteReader();
                DataSet       ds     = new DataSet();

                int i = 0;
                while (reader.Read())
                {
                    i++;
                }


                if (i > 0)
                {
                    this.Hide();
                    staff_profile f = new staff_profile();
                    f.Show();
                    var form1 = staffprofile.StaffManagmentInstance_4;
                    //  this.Closed += (s, args) => this.Close();
                    form1.Show();
                }
                else
                {
                    ErrorDialogBox.ShowDialog("UserName and Password Does not Match, Pleace Re Enter!!!", "Invaild UserName Or Password");
                    con.Close();
                    return;
                }
            }
            else if (atypelogin.Text == "Student")
            {
            }
            else if (atypelogin.Text == "")
            {
                ErrorDialogBox.ShowDialog("Please Select UserType!!!", "Invaild User");

                con.Close();
                return;
            }


            setpassword = loginpasswordtxt.Text;
            setNIC      = usernametxt.Text;
        }