コード例 #1
0
ファイル: Profile.aspx.cs プロジェクト: ryyap/CSCClient
        protected void Page_Load(object sender, EventArgs e)
        {
            passwordText.Attributes["type"] = "password";
            if (!IsPostBack)
            {
                string id ="";
                id= (string)(Session["ID"]);

                int userID = Int32.Parse(id);
                profileservice.UserProfileWebService svc = new profileservice.UserProfileWebService();
                DataSet workDS = new DataSet();
                workDS = svc.getUserProfile(userID);

                usernameText.Text = workDS.Tables[0].Rows[0]["Username"].ToString();
                dobText.Text = workDS.Tables[0].Rows[0]["DateOfBirth"].ToString();
                emailText.Text = workDS.Tables[0].Rows[0]["Email"].ToString();
            }

            bool val1 = (System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated;
            if (val1 == true)
            {
                lblUser.Visible = true;
                lblUser.Text = Context.User.Identity.Name;
                lblLogin.Visible = false;
                lblGallery.Visible = true;
                lblLogout.Visible = true;
                lblChangePassword.Visible = true;
                lblProfile.Visible = true;

            }
            else
            {
                lblUser.Text = "";
                lblUser.Visible = false;
                lblLogin.Visible = true;
                lblLogout.Visible = false;
                lblGallery.Visible = false;
                lblChangePassword.Visible = false;
                lblProfile.Visible = false;
            }
        }