// // // // // // //             End Yes Button Action             // // // // // // //



        // // // // // // //             Begining No Button Action             // // // // // // //


        private void No_MouseClick(object sender, MouseEventArgs e)
        {
            if (usertype == 1)
            {
                this.Close();
                AdminHome soh = new AdminHome();
                soh.Show();
            }



            else if (usertype == 2)
            {
                this.Close();
                UniversityOfficerHome soh = new UniversityOfficerHome();
                soh.Show();
            }



            else if (usertype == 3)
            {
                this.Close();
                SecurityOfficerHome soh = new SecurityOfficerHome();
                soh.Show();
            }
        }
Exemplo n.º 2
0
        private void btnBack_MouseClick_1(object sender, MouseEventArgs e)
        {
            this.Close();
            SecurityOfficerHome soh = new SecurityOfficerHome();

            soh.Show();
        }
Exemplo n.º 3
0
        private void btnHBack_MouseClick(object sender, MouseEventArgs e)
        {
            if (selectForm == 0)
            {
                this.Close();
                SecurityOfficerHome soh = new SecurityOfficerHome();
                soh.Show();

                this.selectForm = 0;
            }
            else if (selectForm == 1)
            {
                this.Close();
                UniversityOfficerHome uoh = new UniversityOfficerHome();
                uoh.Show();

                this.selectForm = 0;
            }
        }
Exemplo n.º 4
0
        // // // // // // //             End Admin Login             // // // // // // //



        // // // // // // //             Begining Security Officer Login             // // // // // // //



        private void btnSOLogin_MouseClick(object sender, MouseEventArgs e)
        {
            String soUsername = txtSOUser.Text;
            String soPassword = txtSOPass.Text;
            String soGate     = txtSOGate.Text;


            if (soGate == "Gate Number 01 - FAS")
            {
                Login.gid = 1;
            }
            else if (soGate == "Gate Number 02 - FBSF")
            {
                Login.gid = 2;
            }



            try
            {
                connect.Open();


                if (txtSOUser.Text == "" || txtSOPass.Text == "" || txtSOGate.Text == "")
                {
                    MessageBox.Show("Fill All The Columns Username, Password and Gate...!");
                }
                else
                {
                    //Select from USER table
                    String          selectQuery1 = "SELECT USER_TYPE_ID, PASSWORD, U_ID, S_STATE FROM USER WHERE USERNAME='******'";
                    MySqlCommand    command1     = new MySqlCommand(selectQuery1, connect);
                    MySqlDataReader myReader1    = command1.ExecuteReader();

                    while (myReader1.Read())
                    {
                        this.usertype = myReader1[0].ToString();
                        this.password = myReader1[1].ToString();
                        this.uid      = myReader1[2].ToString();
                        this.state    = myReader1[3].ToString();
                    }

                    intUsertype  = int.Parse(usertype);
                    Login.intUid = int.Parse(uid);
                    intState     = int.Parse(state);
                    myReader1.Close();

                    if (intUsertype == 3 && password == soPassword && intState == 1)
                    {
                        txtSOUser.Text = "";
                        txtSOPass.Text = "";


                        // Insert Login Time
                        String          insertQuery2 = "INSERT INTO WORKS_AT (U_ID, G_ID, START_TIME_DATE) VALUES (" + Login.intUid + ", " + Login.gid + ", CURTIME())";
                        MySqlCommand    command2     = new MySqlCommand(insertQuery2, connect);
                        MySqlDataReader myReader2    = command2.ExecuteReader();
                        myReader2.Close();

                        // Select Login ID
                        String          selectQuery3 = "SELECT ID FROM WORKS_AT WHERE START_TIME_DATE=CURTIME()";
                        MySqlCommand    command3     = new MySqlCommand(selectQuery3, connect);
                        MySqlDataReader myReader3    = command3.ExecuteReader();

                        while (myReader3.Read())
                        {
                            this.worksAt = myReader3[0].ToString();
                        }

                        Login.worksAtId = int.Parse(worksAt);

                        myReader3.Close();



                        // Display Security Officer Home
                        this.Hide();
                        SecurityOfficerHome soh = new SecurityOfficerHome();
                        soh.Show();
                    }
                    else
                    {
                        MessageBox.Show("Login Failed.....!!");

                        txtSOUser.Text = "";
                        txtSOPass.Text = "";


                        this.usertype    = null;
                        this.intUsertype = 0;
                        this.password    = null;
                        this.uid         = null;
                        Login.intUid     = 0;
                        this.state       = null;
                        this.intState    = 0;
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            finally
            {
                connect.Close();
            }
        }