protected void Page_Load(object sender, EventArgs e) { _redirector = new Redirector(); _usersession = new UserSession(); _webcontext=new WebContext(); _fi=new FriendInvitationRepository(); _ac = new AccountRepository(); _mr = new MessageRecipientRepository(); _f = new FriendService(); Account acid; if (_usersession.CurrentUser != null) { if (_webcontext.AccountID != _usersession.CurrentUser.AccountID && _webcontext.AccountID != 0) { acid = _ac.GetAccountByID(_webcontext.AccountID); lblProfileName.Text = acid.UserName; lb_ban.Text = " ( " + _f.SearchFriend(acid).Count.ToString() + " )"; testImage.Src = "~/Image/ProfileAvatar.aspx?AccountID=" + acid.AccountID; AccordionPane1.Visible = false; AccordionPane3.Visible = false; id = acid.AccountID; lbtnChangeAvatar.Visible = false; } else { lblProfileName.Text = _usersession.CurrentUser.UserName; lb_ban.Text = " ( " + _f.SearchFriend(_usersession.CurrentUser).Count.ToString() + " )"; testImage.Src = "~/Image/ProfileAvatar.aspx?AccountID=" + _usersession.CurrentUser.AccountID; AccordionPane1.Visible = true; AccordionPane3.Visible = true; lb_invite.Text = " ( " + _fi.FriendInv(_usersession.CurrentUser).Count.ToString() + " )"; id = _usersession.CurrentUser.AccountID; lb_message.Text = " ( 0 ) "; lbtnChangeAvatar.Visible = true; //lb_message.Text = " ( " + _mr.getMessageRecipientByAccountID(_usersession.CurrentUser.AccountID).Count.ToString() + " ) "; } } else { if (_webcontext.AccountID > 0) { acid = _ac.GetAccountByID(_webcontext.AccountID); lblProfileName.Text = acid.UserName; testImage.Src = "~/Image/ProfileAvatar.aspx?AccountID=" + acid.AccountID; AccordionPane1.Visible = false; AccordionPane3.Visible = false; id = acid.AccountID; lbtnChangeAvatar.Visible = false; } else _redirector.GoToAccountLoginPage(); } }
protected void Page_Load(object sender, EventArgs e) { _redirector = new Redirector(); _usersession = new UserSession(); _webcontext = new WebContext(); _fi = new FriendInvitationRepository(); _ac = new AccountRepository(); _f = new FriendService(); if (_usersession != null) { if (_webcontext.AccountID != _usersession.CurrentUser.AccountID && _webcontext.AccountID != 0) { bt_add0.Visible = true; bt_add.Visible = false; } else { bt_add0.Visible = false; bt_add.Visible = true; } } }