⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 profile.ascx.cs

📁 BugNET is an issue tracking and project issue management solution built using the ASP.NET web applic
💻 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 + -