public string GetCompanyFromRole(string role, bool dummy)
        {
            string ret = "";

            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.AuthConn();
            SqlCommand         cmdI   = new SqlCommand("SELECT * FROM Company WHERE RoleLink ='" + role + "'", con);

            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ret = drI["RoleLink"].ToString();
                }
            }
            drI.Close();
            con.Close();
            drI.Dispose();
            con.Dispose();

            return(ret);
        }
Exemplo n.º 2
0
        public void GetClientId(string UserName)
        {
            string ClientId = "";

            MembershipUser user = Membership.GetUser(UserName);
            Guid guid = (Guid)user.ProviderUserKey;

            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.AuthConn();
            SqlCommand cmdI = new SqlCommand("SELECT ClientId FROM Users WHERE UserId='" + guid + "'", con);
            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ClientId = drI["ClientId"].ToString();
                }
            }
            drI.Close();
            con.Close();
            drI.Dispose();
            con.Dispose();

            HttpContext.Current.Session["ClientId"] = ClientId;
        }
        public int GetCompanyFromRole(string role)
        {
            int ret = 0;

            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.AuthConn();
            SqlCommand         cmdI   = new SqlCommand("SELECT * FROM Company WHERE RoleLink ='" + role + "'", con);

            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();

            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ret = Convert.ToInt32(drI["CompanyID"]);
                }
            }
            drI.Close();
            con.Close();
            drI.Dispose();
            con.Dispose();

            return(ret);
        }
Exemplo n.º 4
0
        public string GetUsername(int id)
        {
            string ret = "";

            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.AuthConn();
            SqlCommand cmdI = new SqlCommand("SELECT aU.UserName FROM Users U INNER JOIN aspnet_Users aU ON U.UserId = aU.UserId WHERE U.UsersId = " + id, con);
            cmdI.Connection.Open();
            SqlDataReader drI = cmdI.ExecuteReader();
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ret = drI["UserName"].ToString();
                }
            }
            drI.Close();
            con.Close();
            drI.Dispose();
            con.Dispose();

            return ret;
        }
Exemplo n.º 5
0
        public string InsertUserSchool(Guid UserId, int ClientId)
        {
            string strReturn = "";
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.AuthConn();

            SqlCommand cmdI = new SqlCommand("INSERT INTO Users VALUES ('" + UserId + "'," + ClientId + ")", con);
            cmdI.Connection.Open();
            cmdI.ExecuteNonQuery();

            con.Close();
            con.Dispose();
            return strReturn;
        }