Exemplo n.º 1
0
 public DBConnection()
 {
     MyTweetForCategoryTableAdapter = new DataSet1TableAdapters.TweetForCategoryTableAdapter();
     MyCategoryTableAdapter = new DataSet1TableAdapters.CategoryTableAdapter();
     MyErrorsTableAdapter = new DataSet1TableAdapters.ErrorsTableAdapter();
     MyUsersTableAdapter = new DataSet1TableAdapters.UsersTableAdapter();
 }
Exemplo n.º 2
0
 private void metroButton1_Click(object sender, EventArgs e)
 {
     if (TxtPass1.Text != TxtPass2.Text)
     {
         MessageBox.Show("Password not matched");
         return;
     }
     DataSet1TableAdapters.UsersTableAdapter ada = new DataSet1TableAdapters.UsersTableAdapter();
     ada.InsertQuery(TxtUser.Text, TxtPass1.Text);
     MessageBox.Show("Registeration Successfull");
     Close();
 }
Exemplo n.º 3
0
 private void metroButton1_Click(object sender, EventArgs e)
 {
     if (metroTextBox2.Text != metroTextBox3.Text)
     {
         MessageBox.Show("Passwords don't match!");
         return;
     }
     DataSet1TableAdapters.UsersTableAdapter ada = new DataSet1TableAdapters.UsersTableAdapter();
     ada.InsertQuery(metroTextBox1.Text, metroTextBox2.Text);
     MessageBox.Show("Registration Successfull!");
     Close();
 }
Exemplo n.º 4
0
        private void metroButtonAccept_Click(object sender, EventArgs e)
        {
            if (metroTextBoxPassword.Text != metroTextBoxConfirmPassword.Text)
            {
                MessageBox.Show("Passwords Do Not Match!");
                return;
            }

            DataSet1TableAdapters.UsersTableAdapter ada = new DataSet1TableAdapters.UsersTableAdapter();
            ada.InsertQuery(metroTextBoxUserName.Text, metroTextBoxPassword.Text);
            MessageBox.Show("Registration Successful.");
            Close();
        }
Exemplo n.º 5
0
        private void metroBtnLogin_Click(object sender, EventArgs e)
        {
            DataSet1TableAdapters.UsersTableAdapter usersTableAdapter = new DataSet1TableAdapters.UsersTableAdapter();
            DataTable dt = usersTableAdapter.GetDataByUserNameAndPswd(metroTbUser.Text.Trim(), metroTbPassword.Text.Trim());

            if (dt.Rows.Count > 0)
            {   // valid user
                MessageBox.Show("Login Succesifull");
                UserID    = int.Parse(dt.Rows[0]["UserID"].ToString());
                LoginFlag = true;
            }
            else
            {   // user (not exist or user/password) invalid
                MessageBox.Show("Access Denied");
                LoginFlag = false;
            }
            Close();
        }
        /*  public string encryption(String password)
         * {
         *    MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
         *    byte[] encrypt;
         *    UTF8Encoding encode = new UTF8Encoding();
         *    //encrypt the given password string into Encrypted data
         *    encrypt = md5.ComputeHash(encode.GetBytes(password));
         *    StringBuilder encryptdata = new StringBuilder();
         *    //Create a new string by using the encrypted data
         *    for (int i = 0; i < encrypt.Length; i++)
         *    {
         *        encryptdata.Append(encrypt[i].ToString());
         *    }
         *    return encryptdata.ToString();
         * }
         */

        private void metroButton1_Click(object sender, EventArgs e)
        {
            if (metroTextBoxRegpassword.Text != metroTextBoxcpassword.Text)
            {
                MessageBox.Show("Passwords Dont match!");
                return;
            }
            else
            {
                DataSet1TableAdapters.UsersTableAdapter ada = new DataSet1TableAdapters.UsersTableAdapter();


                Crypt new2 = new Crypt();
                temppass = new2.encryption(metroTextBoxRegpassword.Text);

                ada.InsertQuery(metroTextBoxRegusername.Text, temppass);
                MessageBox.Show("Registeration completed");
                Close();
            }
        }
Exemplo n.º 7
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            DataSet1TableAdapters.UsersTableAdapter userAda = new DataSet1TableAdapters.UsersTableAdapter();
            DataTable dt = userAda.GetDataByUserAndPass(metroTextBox1.Text, metroTextBox2.Text);

            if (dt.Rows.Count > 0)
            {
                //valid login
                MessageBox.Show("Logged In");
                UserID    = int.Parse(dt.Rows[0]["UserID"].ToString());
                LoginFlag = true;
            }
            else
            {
                //invlaid login
                MessageBox.Show("incorrect credentials");
                LoginFlag = false;
            }
            Close();
        }
Exemplo n.º 8
0
        private void MetroButtonLogin_Click(object sender, EventArgs e)
        {
            DataSet1TableAdapters.UsersTableAdapter userAda = new DataSet1TableAdapters.UsersTableAdapter();
            DataTable dt = userAda.GetDataByUserAndPass(metroTextBoxUser.Text, metroTextBoxPassword.Text);

            if (dt.Rows.Count > 0)
            {
                //Valid
                MessageBox.Show("Loged in!");
                UserId    = int.Parse(dt.Rows[0]["UserID"].ToString());
                loginFlaf = true;
            }
            else
            {
                //not valid
                MessageBox.Show("Try again");
                loginFlaf = false;
            }
            Close();
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            DataSet1TableAdapters.UsersTableAdapter userAda = new DataSet1TableAdapters.UsersTableAdapter();
            DataTable dt = userAda.GetDataByUserAndPass(metroTextBoxUser.Text, metroTextBoxPassword.Text);

            if (dt.Rows.Count > 0)
            {
                //valid
                MessageBox.Show("Login Successful.");
                UserID    = int.Parse(dt.Rows[0]["UserID"].ToString());
                loginFlag = true;
                Close();
            }
            else
            {
                // not valid
                MessageBox.Show("Access Denied.");
                loginFlag = false;
            }
        }
Exemplo n.º 10
0
        private void metroButtonLogin_Click(object sender, EventArgs e)
        {
            DataSet1TableAdapters.UsersTableAdapter userAda = new DataSet1TableAdapters.UsersTableAdapter();
            DataTable dt = userAda.GetDataByUserIDAndPassword(metroTextBoxUser.Text, metroTextBoxPassword.Text);

            if (dt.Rows.Count > 0)
            {
                //login is valid
                loginFlag = true;
                UserID    = int.Parse(dt.Rows[0]["UserID"].ToString());
                MessageBox.Show("Login Successful!");
            }
            else
            {
                //login is invalid
                MessageBox.Show("Invalid Credentials!");
                loginFlag = false;
                return;
            }
            Close();
        }
Exemplo n.º 11
0
        //Not needed? Can GEt rid of after testing

        /*
         * private void metroLabel1_Click(object sender, EventArgs e)
         * {
         *
         * }
         */

        //Login Button Dunction
        private void metroButton1_Click(object sender, EventArgs e)
        {
            //LOGIN
            DataSet1TableAdapters.UsersTableAdapter userAdap = new DataSet1TableAdapters.UsersTableAdapter();

            DataTable dt = userAdap.GetDataByUsersAndPass(metroTextBoxUserName.Text, metroTextBoxPassword.Text);

            if (dt.Rows.Count > 0)
            {
                //if Valid log in
                MessageBox.Show("Login Successful");
                UserID    = int.Parse(dt.Rows[0]["UserID"].ToString());
                loginFlag = true;
            }
            else
            {
                // if invalid log in
                MessageBox.Show("ACCESS DENIED");
                loginFlag = false;
            }

            Close();
        }
        /*   public string encryption(String password)
         * {
         *     MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
         *     byte[] encrypt;
         *     UTF8Encoding encode = new UTF8Encoding();
         *     //encrypt the given password string into Encrypted data
         *     encrypt = md5.ComputeHash(encode.GetBytes(password));
         *     StringBuilder encryptdata = new StringBuilder();
         *     //Create a new string by using the encrypted data
         *     for (int i = 0; i < encrypt.Length; i++)
         *     {
         *         encryptdata.Append(encrypt[i].ToString());
         *     }
         *     return encryptdata.ToString();
         * }
         */


        private void metroButtonLogin_Click(object sender, EventArgs e)


        {
            DataSet1TableAdapters.UsersTableAdapter userAda = new DataSet1TableAdapters.UsersTableAdapter();


            Crypt new1 = new Crypt();

            passwordTemfordec = new1.encryption(metroTextBoxpassword.Text);

            //passwordTemfordec = encryption(metroTextBoxpassword.Text);

            DataTable dt = userAda.GetDataByUserAndPass(metroTextBoxusername.Text, passwordTemfordec);


            //  MessageBox.Show(metroTextBoxusername.Text+"  test   " + passwordTemfordec); // test
            //   int UserIdtest = int.Parse(dt.Rows[0]["UserID"].ToString());
            //   MessageBox.Show"UserIdtest");

            if (dt.Rows.Count > 0)
            {
                //valid
                // MessageBox.Show("Login successful");
                UserID    = int.Parse(dt.Rows[0]["UserID"].ToString());
                loginFlag = true;
            }
            else
            {
                // not valid
                MessageBox.Show("Login Error");
                loginFlag = false;
            }

            Close(); //here i changed the plan guys
        }
Exemplo n.º 13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ///// store user's info from Session
     twt = (TwitterUser)Session["objTwt"];
     MyUsersTableAdapter = new DataSet1TableAdapters.UsersTableAdapter();
 }