public void Init(IHome View, bool IsPostBack) { _view = View; List <VisibilityLevel> _listVisibilityLevel = new List <VisibilityLevel>(); _listVisibilityLevel = _privacyService.GetListVisibilityLevel(); if (_userSession.LoggedIn == true) { IProfileRepository _profileRepository = new ProfileRepository(); Profile profile = _profileRepository.GetProfileByAccountID(_userSession.CurrentUser.AccountID); if (profile == null) { _redirector.Redirect("~/Profiles/ManageProfile.aspx"); } else { _view.LoadStatusControl(_listVisibilityLevel, true); account = _userSession.CurrentUser; if (!IsPostBack) { _view.LoadStatus(GetStatusToShow(account)); } } } else { account = null; _redirector.GoToAccountLoginPage(); } _view.DisplayCurrentAccount(account); }
public void Init(IUserProfile view, bool IsPostBack) { _view = view; int accountID = _webContext.AccountID; bool IsUser = false; List <Alert> listAlert = new List <Alert>(); List <VisibilityLevel> _listVisibilityLevel = new List <VisibilityLevel>(); _listVisibilityLevel = _privacyService.GetListVisibilityLevel(); if (!IsPostBack) { int viewerID = -1; if (_userSession.LoggedIn) { viewerID = _userSession.CurrentUser.AccountID; if (accountID == viewerID) { _view.DisplayAccountInfo(viewerID, accountID); IsUser = true; } } if (accountID > 0) { if (_userSession.LoggedIn) { _view.LoadStatusControl(_listVisibilityLevel, IsUser); _view.DisplayAccountInfo(viewerID, accountID); listAlert = _alertService.GetAlerts(_userSession.CurrentUser.AccountID, accountID); _view.LoadAlert(listAlert, GetStatusToShow(_userSession.CurrentUser, _accountService.GetAccountByAccountID(accountID))); } else { _view.LoadAlert(_alertService.GetAlertsByAccountID(accountID)); } } if (accountID == 0) { if (viewerID != -1) { _view.DisplayAccountInfo(viewerID, viewerID); IsUser = true; _view.LoadStatusControl(_listVisibilityLevel, IsUser); _view.LoadAlert(_alertService.GetAlerts(viewerID, viewerID), GetStatusToShow(_userSession.CurrentUser, _accountService.GetAccountByAccountID(viewerID))); } } } }