private void btnExit_Click(object sender, EventArgs e)
        {
            var myForm = new frm_Login();

            myForm.Show();
            this.Hide();
        }
        private void frm_vforgotPassword_s1_FormClosing(object sender, FormClosingEventArgs e)
        {
            var myForm = new frm_Login();

            myForm.Show();
            this.Hide();
        }
        private void frm_SecurityQuestion_FormClosing(object sender, FormClosingEventArgs e)
        {
            var myForm = new frm_Login();

            myForm.Show();
            this.Hide();
        }
Esempio n. 4
0
        private void btnTransactionRecord_Click(object sender, EventArgs e)
        {
            if (frm_Login.stockman == "Stockman")
            {
                DialogResult confirm = MessageBox.Show("Are you sure, you want to logout?", "Fabula's Merchandise System", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (confirm == DialogResult.Yes)
                {
                    Cursor.Current = Cursors.WaitCursor;
                    frm_Login.time = DateTime.Now.ToShortTimeString();
                    try
                    {
                        MySqlConnection Conn = ConString.Connection;
                        MySqlCommand    cmd  = new MySqlCommand("update tbl_loginhistory set time_out = '" + frm_Login.time + "', status = 'Offline' where login_id = '" + frm_Login.loginID + "'", Conn);

                        MySqlDataReader myReader;

                        myReader = cmd.ExecuteReader();

                        while (myReader.Read())
                        {
                        }
                        Conn.Close();

                        Cursor.Current = Cursors.AppStarting;
                        var myForm = new frm_Login();
                        myForm.Show();
                        this.Hide();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                else if (confirm == DialogResult.No)
                {
                }
            }
            else
            {
                var pleaseWait = new frm_PleaseWait();
                pleaseWait.Show();
                Application.DoEvents();
                Cursor.Current = Cursors.WaitCursor;
                var myForm = new frm_TransactionRecord();
                myForm.Show();
                pleaseWait.Hide();

                this.Hide();
            }
        }
        private void btnLogout_Click_1(object sender, EventArgs e)
        {
            DialogResult confirm = MessageBox.Show("Are you sure, you want to logout?", "Ordering System", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (confirm == DialogResult.Yes)
            {
                Cursor.Current = Cursors.WaitCursor;
                frm_Login.time = DateTime.Now.ToShortTimeString();
                try
                {
                    string          Connection = "datasource=localhost;port=3306;username=root;password=1234";
                    MySqlConnection Conn       = new MySqlConnection(Connection);
                    Conn.Open();
                    MySqlCommand cmd = new MySqlCommand("update wzfbmehbvk.tbl_loginhistory set time_out = '" + frm_Login.time + "' where login_id = '" + frm_Login.loginID + "'", Conn);

                    MySqlDataReader myReader;

                    myReader = cmd.ExecuteReader();

                    while (myReader.Read())
                    {
                    }

                    Conn.Close();
                    Cursor.Current = Cursors.AppStarting;
                    var myForm = new frm_Login();
                    myForm.Show();
                    this.Hide();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else if (confirm == DialogResult.No)
            {
            }
        }
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            MySqlConnection Conn = ConString.Connection;


            if (txtConfirmPassword.Text == "" || txtNewPassword.Text == "")
            {
                string s = String.Empty;

                MessageBox.Show("Please input the require fields.", "Fabula's Merchandise System", MessageBoxButtons.OK, MessageBoxIcon.None);

                return;
            }
            else
            {
            }

            if (txtNewPassword.Text == txtConfirmPassword.Text)
            {
            }

            else
            {
                MessageBox.Show("Password doesn't match.", "Fabula's Merchandise System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }



            if (txtConfirmPassword.Text.Length < 6)
            {
                MessageBox.Show("The length of password should be 6 or 25 characters.", "Fabula's Merchandise System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
            }


            string password00 = txtConfirmPassword.Text;
            string password11 = txtNewPassword.Text;



            if (password00.Contains(@"\") || password11.Contains(@"\"))

            {
                MessageBox.Show("Your password is invalid for using " + @"'\'", "Fabula's Merchandise System", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            if (txtConfirmPassword.Text == oldpass)
            {
                MessageBox.Show("New and old password must not be equal.", "Fabula's Merchandise System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            MySqlCommand cmd = cmd = new MySqlCommand("update tbl_login set password = '******' where login_id = '" + frm_vforgotPassword_s1.getSubgeneralID + "'", Conn);

            cmd.CommandTimeout = 50000;
            MySqlDataReader myReader;

            try
            {
                myReader = cmd.ExecuteReader();

                while (myReader.Read())
                {
                }
                MessageBox.Show("Your password has been verified successfully.", "Fabula's Merchandise System", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);


                Conn.Close();
            }

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



            this.Hide();

            var pleaseWait = new frm_PleaseWait();

            pleaseWait.Show();
            Application.DoEvents();
            Cursor.Current = Cursors.WaitCursor;
            var myForm = new frm_Login();

            myForm.Show();
            pleaseWait.Hide();
        }