public ProfilePresenter() { _redirector = ObjectFactory.GetInstance<IRedirector>(); _userSession = ObjectFactory.GetInstance<IUserSession>(); if (!_userSession.LoggedIn || _userSession.CurrentUser == null) _redirector.GoToAccountLoginPage(); _alertService = ObjectFactory.GetInstance<IAlertService>(); _webContext = ObjectFactory.GetInstance<IWebContext>(); _accountService = ObjectFactory.GetInstance<IAccountService>(); _privacyService = ObjectFactory.GetInstance<IPrivacyService>(); _account = _userSession.CurrentUser; if (_webContext.AccountID > 0 && _webContext.AccountID != _userSession.CurrentUser.AccountID) { _accountBeingViewed = _accountService.GetAccountByID(_webContext.AccountID); _accountBeingViewed.Profile = Profile.GetProfileByAccountID(_webContext.AccountID); } else { _accountBeingViewed = _userSession.CurrentUser; _accountBeingViewed.Profile = Profile.GetProfileByAccountID(_userSession.CurrentUser.AccountID); } if (_accountBeingViewed == null) _redirector.GoToAccountLoginPage(); if (_accountBeingViewed.Profile != null && _accountBeingViewed.Profile.ProfileID > 0) _privacyFlags = PrivacyFlag.GetPrivacyFlagsByProfileID(_accountBeingViewed.Profile.ProfileID); else _redirector.GoToHomePage(); }
public void Init(ILogin view) { _view = view; _userSession = ObjectFactory.GetInstance<IUserSession>(); _redirector = ObjectFactory.GetInstance<IRedirector>(); _webContext = ObjectFactory.GetInstance<IWebContext>(); if (_userSession.LoggedIn == true && _userSession.CurrentUser != null) _redirector.GoToHomePage(); _accountService = ObjectFactory.GetInstance<IAccountService>(); if (!string.IsNullOrEmpty(_webContext.FriendshipRequest)) _view.DisplayMessage("Đăng nhập để kết bạn!"); }
protected void lb_info_Click(object sender, EventArgs e) { _redirector.GoToHomePage(); }