Example #1
0
        public static string autocomplete()
        {
            //do some admin stuff
            string ret = "";
            authen x   = new authen();

            SqlConnection myConnection = new SqlConnection(x.getConnectionString());

            try {
                myConnection.Open();
                try {
                    SqlDataReader myReader = null;
                    string        strSql   = "SELECT DISTINCT businessName AS aText, businessID AS aID, 1 AS aType FROM [business] " +
                                             "UNION " +
                                             "SELECT DISTINCT businessTypeName, bt.businessTypeID, 2 " +
                                             "FROM [business] as b, [businessType] as bt,[business_businessType] as bbt " +
                                             "WHERE bt.businessTypeID = bbt.businessTypeID " +
                                             "AND b.businessID = bbt.businessID " +
                                             "UNION " +
                                             "SELECT DISTINCT tubeName, t.tubeID, 3 " +
                                             "FROM [tube] as t " +
                                             "WHERE convert(varbinary(50), UPPER(tubeName)) != convert(varbinary(50), tubeName) " +
                                             "UNION " +
                                             "SELECT DISTINCT countyName, c.countyID, 4 " +
                                             "FROM [county] as c " +
                                             "WHERE convert(varbinary(50), UPPER(countyName)) != convert(varbinary(50), countyName) " +
                                             "ORDER BY aText";



                    SqlCommand myCommand = new SqlCommand(strSql, myConnection);
                    myReader = myCommand.ExecuteReader();
                    while (myReader.Read())
                    {
                        ret += (ret.Length > 0) ? "|" : "";
                        ret += myReader["aText"].ToString() + ";" + myReader["aID"].ToString() + ";" + myReader["aType"].ToString();
                    }
                    myReader.Close();
                    myConnection.Close();
                } catch (Exception ex1) {}
            } catch (Exception ex2) {}
            return(ret);
        }
Example #2
0
        // end of 3rd copy
        public static bool getuserpass(int userid, out string email, out string pass)
        {
            bool ret = false;

            email = "";
            pass  = "";

            authen x = new authen();

            if (x.validUser())
            {
                SqlConnection myConnection = new SqlConnection(x.getConnectionString());
                try {
                    myConnection.Open();
                    try {
                        string        strSql    = @"SELECT [email], [password] FROM [user]
											WHERE userID = '"                                             + userid + "'";
                        SqlCommand    myCommand = new SqlCommand(strSql, myConnection);
                        SqlDataReader myReader  = null;
                        myReader = myCommand.ExecuteReader();
                        if (myReader.Read())
                        {
                            email = myReader["email"].ToString();
                            pass  = myReader["password"].ToString();
                            ret   = true;
                        }
                        myReader.Close();
                        myConnection.Close();
                    } catch (Exception ex1) {
                    }
                } catch (Exception ex2) {
                }
            }

            return(ret);
        }
Example #3
0
        public static string getConn()
        {
            authen x = new authen();

            return(x.getConnectionString());
        }