Example #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string userName = textBoxName.Text;
            string password = Cryptology.MD5Sifrele(textBoxPassword.Text);


            connection.Open();
            SqlCommand    command = new SqlCommand("SELECT * FROM TblLoginCustomer", connection);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                if (userName == reader["UserName"].ToString() && password == reader["Password"].ToString())
                {
                    isThere = true;
                    break;
                }
                else
                {
                    isThere = false;
                }
            }

            connection.Close();
            if (isThere)
            {
                MessageBox.Show("Başarılı giriş yaptınız!", "Program");
            }
            else
            {
                MessageBox.Show("Hatalı kullanıcı adı veya şifre!");
            }
        }
Example #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string userName = textBoxName.Text;
            string password = Cryptology.MD5Sifrele(textBoxPassword.Text);


            connection.Open();
            SqlCommand command = new SqlCommand("SELECT * FROM TblLoginCustomer WHERE UserName='******'", connection);

            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                if (userName == reader["UserName"].ToString() && password == reader["Password"].ToString() && reader["Counter"].ToString() != "3")
                {
                    isThere     = true;
                    label1.Text = reader["id"].ToString();
                    break;
                }
                else
                {
                    isThere = false;
                }
            }

            connection.Close();

            CustomerForm cf = new CustomerForm();

            if (isThere)
            {
                cf.etc = label1.Text;


                this.Hide();
                cf.ShowDialog();
                this.Close();
            }
            else
            {
                connection.Open();
                SqlCommand    komut = new SqlCommand("SELECT * FROM TblLoginCustomer WHERE UserName='******'", connection);
                SqlDataReader read  = komut.ExecuteReader();

                if (read.Read())
                {
                    if (read["Counter"].ToString() == "3")
                    {
                        MessageBox.Show("Hesabınız bloke olmuştur. Lütfen sistem yöneticimizle [email protected] adresi üzerinden iletişime geçiniz..");
                    }
                    else
                    {
                        connection.Close();
                        connection.Open();
                        SqlCommand commandd = new SqlCommand("UPDATE TblLoginCustomer SET Counter = Counter +1 WHERE UserName='******'", connection);
                        commandd.ExecuteNonQuery();
                        MessageBox.Show("Hatalı kullanıcı adı veya şifre!");
                    }
                }

                connection.Close();
            }
        }
Example #3
0
        private void btnLoginSignUp_Click(object sender, EventArgs e)
        {
            connection.Open();
            SqlCommand command = new SqlCommand("INSERT INTO TblLoginCustomer (UserName,Password,Answer) values ('" + textBoxNameSignUp.Text + "','" + Cryptology.MD5Sifrele(textBoxPasswordSignUp.Text) + "','" + txtBxAnswer.Text + "')", connection);

            command.ExecuteNonQuery();
            connection.Close();
            MessageBox.Show("Başarılı", "Program");
        }
        private void btnLoginSignUp_Click(object sender, EventArgs e)
        {
            int Counter = 0;

            connection.Open();
            if (cbForgetQuestion.SelectedItem == null && txtBxAnswer.Text == null)
            {
                MessageBox.Show("Parola Kurtarma Sorusu Boş Bırakılamaz...", "Program");
            }
            SqlCommand command = new SqlCommand("INSERT INTO TblLoginCustomer (UserName,Password,Question,Answer,Counter) values ('" + textBoxNameSignUp.Text + "','" + Cryptology.MD5Sifrele(textBoxPasswordSignUp.Text) + "','" + cbForgetQuestion.SelectedItem.ToString() + "','" + txtBxAnswer.Text + "','" + 0 + "')", connection);

            command.ExecuteNonQuery();
            connection.Close();
            MessageBox.Show("Başarılı", "Program");
        }