Hi, I've got a User class which holds details of the user and is populated by
a query. I create this User object when the user successfully logs in and
then I set this object to a session variable (its for a ASP.Net site) so that
I can access any of the user's details from this session object.
The problem is when I'm trying to access a Property of the object, the
intellisence does not display the Property name. So when I type in:
Session["user"]. I only get the standard object methods.
This is how my class looks:
public class User
{
private string username;
private string firstname;
private string lastname;
private string password;
private string email;
private string roleID;
protected string userType;
public User(string _username, string _password)
{
Username = _username;
Password = _password;
GetUserDetails(Username, Password);
}
#region "Properties"
public string Username
{
get { return username; }
set { username = value.Trim();}
}
public string Password
{
get { return password; }
set { password = value.Trim(); }
}
public string Firstname
{
get { return firstname; }
set { firstname = value.Trim();}
}
public string Lastname
{
get { return lastname; }
set { lastname = value.Trim(); }
}
public string Email
{
get { return email; }
set { email = value; }
}
public string RoleID
{
get { return roleID; }
set { roleID = value; }
}
public string UserType
{
get { return userType; }
set
{
if (value == "1")
{
userType = "Expert";
}
if (value == "2")
{
userType = "Basic";
}
}
}
#endregion
protected void GetUserDetails(string _username, string _password)
{
DataSet ds = UserDAO.GetUserDetails(_username, _password);
foreach (DataRow dr in ds.Tables["User"].Rows)
{
Firstname = dr["firstname"].ToString();
Lastname = dr["lastname"].ToString();
RoleID = dr["RoleID"].ToString();
UserType = dr["RoleID"].ToString().TrimEnd();
}
}
}
What gives??