private void btn_Login_Click(object sender, EventArgs e)
        {
            formAdminHome fAdminHome = new formAdminHome();

            fAdminHome.refLogin = this;
            fAdminHome.Show();
            this.Hide();
        }
Example #2
0
        // - - Goes back to admin home screen - -
        private void btn_Back_Click(object sender, EventArgs e)
        {
            formAdminHome refBack = new formAdminHome();

            refBack.refInventory = this;
            refBack.Show();
            this.Close();
        }
        // - - Back Button - -
        private void btn_Back_Click(object sender, EventArgs e)
        {
            formAdminHome fHome = new formAdminHome();

            fHome.refSupplier = this;
            fHome.Show();
            this.Hide();
        }
Example #4
0
        // Back Button
        private void btn_Back_Click(object sender, EventArgs e)
        {
            formAdminHome fAdminHome = new formAdminHome();

            fAdminHome.refEmployee = this;
            fAdminHome.Show();
            this.Hide();
        }
Example #5
0
        private void btn_Back_Click(object sender, EventArgs e)
        {
            formAdminHome fHome = new formAdminHome();

            fHome.refCustomer = this;
            fHome.Show();
            this.Close();
        }
Example #6
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            try
            {
                // User did not enter either his username/password
                if (tbox_Username.Text == "" || tbox_Password.Text == "")
                {
                    MessageBox.Show("Please enter your username/password.", "Error!", MessageBoxButtons.OK);
                }
                else
                {
                    // Connection to Database
                    conn.Open(); // Connection opened

                    // Get data from DB
                    MySqlCommand comm = new MySqlCommand("SELECT * FROM employee WHERE emp_username = '******' AND emp_password = '******'", conn);
                    MySqlDataAdapter adp = new MySqlDataAdapter(comm);
                    DataTable        dt  = new DataTable();
                    adp.Fill(dt);
                    conn.Close();

                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("User do not exist.", "System Message", MessageBoxButtons.OK);
                    }
                    else if (dt.Rows.Count == 1) // DB returned 1 row
                    {
                        // gets data from DB >> pass the values to its corresponding variables
                        username = dt.Rows[0]["emp_username"].ToString();
                        password = dt.Rows[0]["emp_password"].ToString();
                        stat     = int.Parse(dt.Rows[0]["emp_status"].ToString());
                        empID    = int.Parse(dt.Rows[0]["emp_id"].ToString());


                        if (tbox_Username.Text == username && tbox_Password.Text == password)
                        {
                            if (stat == 1) // 1 means active account
                            {
                                // Opens Menu
                                formAdminHome fAdminHome = new formAdminHome();
                                fAdminHome.refLogin  = this;
                                fAdminHome.ref_empID = empID;
                                fAdminHome.Show();
                                this.Hide();
                            }
                            else
                            {
                                MessageBox.Show("This account is inactive. Please contact your admin! ", "", MessageBoxButtons.OK);
                            }
                        }
                    }
                    else if (tbox_Username.Text != username || tbox_Password.Text != password)
                    {
                        MessageBox.Show("The user credentials are incorrect.", "Error!", MessageBoxButtons.OK);
                    }
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                conn.Close();
            }
        }