?? profile.ascx.cs
字號:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.Profile;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BugNET.BusinessLogicLayer;
using BugNET.UserInterfaceLayer;
namespace BugNET.Administration.Users.UserControls
{
public partial class Profile : System.Web.UI.UserControl
{
/// <summary>
/// Handles the Load event of the Page control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// Binds a data source to the invoked server control and all its child controls.
/// </summary>
public override void DataBind()
{
//get this user and bind the data
MembershipUser user = ITUser.GetUser(UserId);
if (user != null)
{
lblUserName.Text = user.UserName;
WebProfile Profile = new WebProfile().GetProfile(user.UserName);
FirstName.Text = Profile.FirstName;
LastName.Text = Profile.LastName;
DisplayName.Text = Profile.DisplayName;
//Fax.Text = Profile.ContactInfo.Fax;
//Mobile.Text = Profile.ContactInfo.Mobile;
//Telephone.Text = Profile.ContactInfo.Telephone;
}
}
/// <summary>
/// Gets the user id.
/// </summary>
/// <value>The user id.</value>
public Guid UserId
{
get
{
if (Request.QueryString["user"] != null || Request.QueryString["user"].Length != 0)
try
{
return new Guid(Request.QueryString["user"].ToString());
}
catch
{
throw new Exception("The user querystring parameter is not properly formed");
}
else
return Guid.Empty;
}
}
/// <summary>
/// Handles the Click event of the cmdUpdate control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void cmdUpdate_Click(object sender, EventArgs e)
{
try
{
MembershipUser user = ITUser.GetUser(UserId);
if (user != null)
{
WebProfile Profile = new WebProfile().GetProfile(user.UserName);
Profile.DisplayName = DisplayName.Text;
Profile.FirstName = FirstName.Text;
Profile.LastName = LastName.Text;
//Profile.ContactInfo.Fax = Fax.Text;
//Profile.ContactInfo.Mobile = Mobile.Text;
//Profile.ContactInfo.Telephone = Telephone.Text;
Profile.Save();
}
}
catch
{
lblError.Text = "There was an error updating the profile";
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -