예제 #1
0
        private void Sales_Log_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            ADMIN_MENU AdminMenu = new ADMIN_MENU();

            AdminMenu.Show();
        }
예제 #2
0
        private void ManageDatabase_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            ADMIN_MENU AdminMenu = new ADMIN_MENU();

            AdminMenu.Show();
        }
예제 #3
0
        void Authenticate(string username, string password)
        {
            MySqlConnection cn = new MySqlConnection(conObject.connString);

            if (cn.State != ConnectionState.Open)
            {
                cn.Open();
            }

            cmd.CommandText = "SELECT * FROM users WHERE username = '******' AND password = '******'";
            cmd.Connection  = cn;
            MySqlDataReader reader;

            reader = cmd.ExecuteReader();

            if (reader.HasRows)
            {
                reader.Close();

                cmd.CommandText = "SELECT * FROM users WHERE userName = '******' AND password = '******'";
                cmd.Connection  = cn;
                MySqlDataReader reader2;
                reader2 = cmd.ExecuteReader();
                while (reader2.Read())
                {
                    string accountType = reader2[2].ToString();

                    //Select Account Type and Log Current User
                    switch (accountType)
                    {
                    case "SALES": SALES salesForm = new SALES();

                        //Log the user who has sucessfullky logged in
                        LogUser(username);

                        this.Hide();
                        salesForm.Show();
                        break;

                    case "STOCK": STOCK_MENU stock_Menu_Form = new STOCK_MENU();

                        //Log the user who has sucessfullky logged in
                        LogUser(username);

                        this.Hide();
                        stock_Menu_Form.Show();
                        break;

                    case "ADMINISTRATOR":     //XtraMessageBox.Show("Welcome to Admin!!\t UNDER DEVELOPMENT");
                        ADMIN_MENU AdminMenu = new ADMIN_MENU();
                        this.Hide();
                        AdminMenu.Show();

                        //Log the user who has sucessfullky logged in
                        LogUser(username);

                        break;

                    default: return;
                    }
                }
            }
            else
            {
                XtraMessageBox.Show("Invalid username and/or password provided", "iBInventory v1.0", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        private void Adminstrator_FormClosing(object sender, FormClosingEventArgs e)
        {
            ADMIN_MENU AdminMenu = new ADMIN_MENU();

            AdminMenu.Show();
        }