コード例 #1
0
ファイル: Bookmark.aspx.cs プロジェクト: huwred/SnitzDotNet
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     if (HttpContext.Current.Items["user"] != null)
     {
         _userProfile = HttpContext.Current.Items["user"].ToString();
     }
     else
         _userProfile = !String.IsNullOrEmpty(Request.Params["user"]) ? Request.Params["user"] : Member.Username;
     _profile = ProfileCommon.GetUserProfile(_userProfile);
 }
コード例 #2
0
ファイル: Profile.aspx.cs プロジェクト: huwred/SnitzDotNet
        private void SaveMemberProfile()
        {
            _profile = ProfileCommon.GetUserProfile(_profileUser);
            _profile.Gravatar = cbxGravatar.Checked;
            _profile.HideAge = cbxHideAge.Checked;
            _profile.Skype = tbxSkype.Text;
            _profile.PublicGallery = cbxPublic.Checked && Config.ShowGallery;
            _profile.LinkTarget = ddlTarget.SelectedValue;
            _profile.PMEmail = _profile.PMEmail;
            _profile.PMReceive = _profile.PMReceive;
            _profile.Save();

            string folderPath = "/gallery/";
            folderPath += _profileUser + "/public.txt";
            string path = Server.MapPath("~" + folderPath);
            if (_profile.PublicGallery && Config.ShowGallery)
            {
                if (!File.Exists(path))
                {
                    File.Create(path);
                }
            }
            else
            {
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
            }

            if (tbxRealName.Text.Trim() != "")
            {
                int i = tbxRealName.Text.IndexOf(" ");
                _user.Firstname = i > 0 ? tbxRealName.Text.Substring(0, tbxRealName.Text.IndexOf(" ")).Trim() : tbxRealName.Text.Trim();

                _user.Lastname = tbxRealName.Text.Replace(_user.Firstname, "").Trim();
            }
            _user.Age = Common.GetAgeFromDOB(DobPicker.DOBStr);
            _user.DateOfBirth = DobPicker.DOBStr;
            if(ddlMarStatus.SelectedIndex >= 0)
                _user.MaritalStatus = ddlMarStatus.SelectedValue;
            if (ddlGender.SelectedIndex >= 0)
                _user.Gender = ddlGender.SelectedValue;

            _user.State = tbxState.Text;
            _user.City = tbxCity.Text;
            _user.Country = tbxCountry.Text;
            _user.Occupation = tbxOccupation.Text;
            _user.Title = tbxForumTitle.Text.Trim();
            if (ddlTimeZone.SelectedIndex >= 0)
            {
                TimeZoneInfo tzone = TimeZoneInfo.FindSystemTimeZoneById(ddlTimeZone.SelectedValue);
                _user.TimeZone = ddlTimeZone.SelectedValue;
                _user.TimeOffset = tzone.BaseUtcOffset.TotalHours;
            }
            _user.UseDaylightSaving = cbxDaylightSaving.Checked;
            //email
            _user.ReceiveEmails = cbxReceiveEmail.Checked;
            _user.HideEmail = cbxHideEmail.Checked;
            _user.Yahoo = tbxYAHOO.Text;
            _user.AIM = tbxAIM.Text;
            _user.Skype = tbxSkype.Text;
            _user.ICQ = tbxICQ.Text;

            TextBox favQ = phQuote.FindControl("tbxQuote") as TextBox;
            if (favQ != null) _user.FavouriteQuote = favQ.Text;
            TextBox sig = phSig.FindControl("tbxSig") as TextBox;
            if (sig != null) _user.Signature = sig.Text;
            TextBox bio = phBiog.FindControl("tbxSig") as TextBox;
            if (bio != null) _user.Biography = bio.Text;
            _user.UseSignature = cbxUseSig.Checked;
            _user.ViewSignatures = cbxViewSig.Checked;
            TextBox news = phNews.FindControl("tbxNews") as TextBox;
            if (news != null) _user.LatestNews = news.Text;
            TextBox hobby = phHobby.FindControl("tbxHobby") as TextBox;
            if (hobby != null) _user.Hobbies = hobby.Text;
            TextBox home = phHomePage.FindControl("tbxHomePage") as TextBox;
            if (home != null) _user.HomePage = home.Text;
            _user.Theme = ddTheme.Text;
            if (IsMyProfile)
                Config.UserTheme = _user.Theme;
            //fav links

            Members.SaveMember(_user);
            SetupTabs();
            //SetupDynamicControls();
        }
コード例 #3
0
ファイル: Profile.aspx.cs プロジェクト: huwred/SnitzDotNet
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if(!IsAuthenticated)
            {
                throw new SecurityException("You must be a logged in member to view users profiles");
            }
            editorCSS.Attributes.Add("href", "/css/" + Page.Theme + "/editor.css");
            if (webResources.TextDirection == "rtl")
                pageCSS.Attributes.Add("href", "/css/" + Page.Theme + "/profilepagertl.css");
            else
                pageCSS.Attributes.Add("href", "/css/" + Page.Theme + "/profilepage.css");

            TabContainer1.ActiveTabIndex = 0;
            if (HttpContext.Current.Items["user"] != null)
            {
                _profileUser = HttpContext.Current.Items["user"].ToString();
            }
            else
                _profileUser = !String.IsNullOrEmpty(Request.Params["user"]) ? Request.Params["user"] : Member.Username;
            if (Session["CurrentProfile"] == null)
                Session.Add("CurrentProfile", _profileUser);
            else
                _profileUser = Session["CurrentProfile"].ToString();
            _user = Members.GetMember(_profileUser);

            _profile = ProfileCommon.GetUserProfile(_profileUser);
            Page.Title = String.Format(webResources.lblProfile, _profileUser);
            IsMyProfile = _profileUser == Member.Username;
            ddTheme.AutoPostBack = IsMyProfile;
            if (!IsPostBack)
            {
                _weblinks = _profile.FavLinks;
                Session.Add("WEBLINK", _weblinks);
            }else
            {
                _weblinks = (List<SnitzLink>)Session["WEBLINK"];
                SetupDynamicControls();
            }
        }