Basically, I've used SQL triggers to compare usernames. It's similar to using asp.net roles.
Now I have another question. In my calendar, I want to do the following things:
1) Select a due date then redirect user to edit form while it populates data from new_project form.
2) Allow user to update fields then add an audit field which displays time, day it got updated and user who updated it.
>I need start-up code to begin since I am learning.
What language are you using?
Click "Mark as Answer" on the post that helped you.
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
If the user is on the same local network, then use
/// <summary>
/// Gets logged-in user name
/// </summary>
/// <returns>logged-in user name</returns>
public static string GetUserName
{
get { return Environment.UserName; }
}
Click "Mark as Answer" on the post that helped you.
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
chetan.sarod...
All-Star
65729 Points
11138 Posts
Re: Display user name in the header when logged in
Oct 05, 2009 03:11 AM|LINK
Thats nice
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
chetan.sarod...
All-Star
65729 Points
11138 Posts
Re: Display user name in the header when logged in
Oct 08, 2009 03:05 AM|LINK
Can ypu please tell how you resolved it
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
Cadeey
Member
102 Points
55 Posts
Re: Display user name in the header when logged in
Oct 14, 2009 08:02 PM|LINK
Hi Chetan-
Basically, I've used SQL triggers to compare usernames. It's similar to using asp.net roles.
Now I have another question. In my calendar, I want to do the following things:
1) Select a due date then redirect user to edit form while it populates data from new_project form.
2) Allow user to update fields then add an audit field which displays time, day it got updated and user who updated it.
Cadeey
Member
102 Points
55 Posts
Re: Display user name in the header when logged in
Oct 15, 2009 08:29 PM|LINK
Here's my code:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = "Welcome, " + Session["UserName"].ToString();
BindData();
}
protected void BindData()
{
if (!IsPostBack)
{
if (Session["UserName"].ToString() != null)
{
string SessionName = Session["UserName"].ToString();
//Response.Write(Session["UserName"].ToString());
// Declare the query string.
OracleConnection myConnection = new OracleConnection(ConfigurationManager.AppSettings["DSN"]);
OracleCommand myCommand = new OracleCommand("SELECT a.PROJECT_DUE FROM NEW_PROJECTS a WHERE upper(a.REPORTS_TO_ID) = '" + Session["UserName"].ToString() + "'or lower(a.REPORTS_TO_ID) = '" + Session["UserName"].ToString() + "' or upper(a.ASSIGNED_TO_ID) = '" + Session["UserName"].ToString() + "'or lower(a.ASSIGNED_TO_ID) = '" + Session["UserName"].ToString()+ "'and a.proj_status = 'Active'", myConnection);
myCommand.CommandType = CommandType.Text;
myConnection.Open();
OracleDataReader dr = myCommand.ExecuteReader();
while (dr.Read() == true)
{
//assign the calendar control dates already contained in the database
Calendar1.SelectedDates.Add((DateTime)dr.GetOracleDateTime(0));
}
dr.Close();
myConnection.Close();
}
}
}
protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
{
FormsAuthentication.SignOut();
Response.Redirect("Login.aspx");
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
I NEED CODE THAT WILL ALLOW ME TO SELECT THE DUE DATES AND POPULATE DATA FROM NEW_PROJECT PAGE TO EDIT PAGE
}
chetan.sarod...
All-Star
65729 Points
11138 Posts
Re: Display user name in the header when logged in
Oct 16, 2009 03:19 AM|LINK
You can query to DB and compaire the project dates so that you can get due date and populate data
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
Cadeey
Member
102 Points
55 Posts
Re: Display user name in the header when logged in
Oct 16, 2009 02:51 PM|LINK
I need start-up code to begin since I am learning.
TATWORTH
All-Star
72415 Points
14017 Posts
MVP
Re: Display user name in the header when logged in
Oct 16, 2009 04:21 PM|LINK
>I need start-up code to begin since I am learning.
What language are you using?
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
Cadeey
Member
102 Points
55 Posts
Re: Display user name in the header when logged in
Oct 18, 2009 03:59 PM|LINK
Asp.net....C#
TATWORTH
All-Star
72415 Points
14017 Posts
MVP
Re: Display user name in the header when logged in
Oct 18, 2009 06:30 PM|LINK
If the user is on the same local network, then use
/// <summary>
/// Gets logged-in user name
/// </summary>
/// <returns>logged-in user name</returns>
public static string GetUserName
{
get { return Environment.UserName; }
}
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
Cadeey
Member
102 Points
55 Posts
Re: Display user name in the header when logged in
Oct 19, 2009 02:57 PM|LINK
This wont work in my case, because I am storing Username in a session state (From DB).
Here's my code:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = "Welcome, " + Session["UserName"].ToString();
BindData();
}
protected void BindData()
{
if (!IsPostBack)
{
if (Session["UserName"].ToString() != null)
{
string SessionName = Session["UserName"].ToString();
//Response.Write(Session["UserName"].ToString());
// Declare the query string.
OracleConnection myConnection = new OracleConnection(ConfigurationManager.AppSettings["DSN"]);
OracleCommand myCommand = new OracleCommand("SELECT a.PROJECT_DUE FROM NEW_PROJECTS a WHERE upper(a.REPORTS_TO_ID) = '" + Session["UserName"].ToString() + "'or lower(a.REPORTS_TO_ID) = '" + Session["UserName"].ToString() + "' or upper(a.ASSIGNED_TO_ID) = '" + Session["UserName"].ToString() + "'or lower(a.ASSIGNED_TO_ID) = '" + Session["UserName"].ToString()+ "'and a.proj_status = 'Active'", myConnection);
myCommand.CommandType = CommandType.Text;
myConnection.Open();
OracleDataReader dr = myCommand.ExecuteReader();
while (dr.Read() == true)
{
//assign the calendar control dates already contained in the database
Calendar1.SelectedDates.Add((DateTime)dr.GetOracleDateTime(0));
}
dr.Close();
myConnection.Close();
}
}
}
protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
{
FormsAuthentication.SignOut();
Response.Redirect("Login.aspx");
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
I NEED CODE THAT WILL ALLOW ME TO SELECT THE DUE DATES AND POPULATE DATA FROM NEW_PROJECT PAGE TO EDIT PAGE
}