private void button2_Click(object sender, EventArgs e)
        {
            mainpage2 qw = new mainpage2();

            qw.Show();
            this.Hide();
        }
Exemple #2
0
        private void b1_Click(object sender, EventArgs e)
        {
            pt = t1.Text;
            string          Password        = "";
            bool            IsExist         = false;
            string          connetionString = null;
            OleDbConnection oledbCnn;
            OleDbCommand    oledbCmd;
            string          sql = null;

            connetionString = "Provider=OraOLEDB.Oracle;Data Source=orcl;User Id=system;Password=7*******6;";
            sql             = "select * from sign where email_id='" + t1.Text + "'";
            oledbCnn        = new OleDbConnection(connetionString);
            oledbCnn.Open();
            oledbCmd = new OleDbCommand(sql, oledbCnn);
            OleDbDataReader sdr = oledbCmd.ExecuteReader();

            if (sdr.Read())
            {
                Password = sdr.GetString(2);  //get the user password
                IsExist  = true;
            }
            oledbCnn.Close();
            if (IsExist)  //if record exis in database
            {
                if (Cryptography.Decrypt(Password).Equals(t2.Text))
                {
                    MessageBox.Show("Login Success", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    mainpage2 m2 = new mainpage2();
                    m2.ShowDialog();
                    ClearControls();
                }
                else
                {
                    MessageBox.Show("Password is wrong!...", "error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else  //showing the error message if user credential is wrong
            {
                MessageBox.Show("Please enter the valid credentials", "error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            oledbCmd.Dispose();
            oledbCnn.Close();
        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            mainpage2 m2 = new mainpage2();

            m2.ShowDialog();
        }