Ejemplo n.º 1
0
        public bool checkPassword()
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["parkDB"].ConnectionString);

            conn.Open();
            string     checkUser = "******";
            SqlCommand comd      = new SqlCommand(checkUser, conn);

            comd.Parameters.AddWithValue("@userName", userName);
            SqlDataReader dr = comd.ExecuteReader();

            dr.Read();
            if (dr.HasRows)
            {
                if (dr["Password"].ToString().Equals(EncryptPassword.encryptString(password)))
                {
                    dr.Close();
                    conn.Close();
                    return(true);
                }
            }
            dr.Close();
            conn.Close();
            return(false);
        }
Ejemplo n.º 2
0
        public void resetPassword(string newpwd)
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["parkDB"].ConnectionString);

            conn.Open();
            string     checkUser = "******";
            SqlCommand comd      = new SqlCommand(checkUser, conn);

            comd.Parameters.AddWithValue("@userName", userName);
            comd.Parameters.AddWithValue("@password", EncryptPassword.encryptString(newpwd));
            comd.ExecuteNonQuery();
            conn.Close();
        }
Ejemplo n.º 3
0
        public void insertData()
        {
            System.Data.SqlClient.SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["parkDB"].ConnectionString);
            conn.Open();
            string     insertString = "INSERT INTO ParkCustomer (UserName, FName, LName, Email, Password, Age, Gender) values (@UserName, @FName, @LName, @Email, @Password, @Age, @Gender)";
            SqlCommand comd         = new SqlCommand(insertString, conn);

            comd.Parameters.AddWithValue("@UserName", userName);
            comd.Parameters.AddWithValue("@FName", fName);
            comd.Parameters.AddWithValue("@LName", lName);
            comd.Parameters.AddWithValue("@Email", email);
            comd.Parameters.AddWithValue("@Password", EncryptPassword.encryptString(password));
            comd.Parameters.AddWithValue("@Age", Convert.ToInt32(age));
            comd.Parameters.AddWithValue("@Gender", gender);
            comd.ExecuteNonQuery();
            conn.Close();
        }