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))); } } } }
//} internal void SaveStatusUpdate(String statusContent, int range) { if (!_userSession.LoggedIn) { _view.Message("Chưa đăng nhập"); return; } int accountID; int senderID; senderID = _userSession.CurrentUser.AccountID; accountID = _webContext.AccountID; bool IsAccount = true; if (accountID != senderID) { IsAccount = false; } if (accountID <= 0) { accountID = senderID; } StatusUpdate status; status = new StatusUpdate(); status.AccountID = accountID; status.SenderID = senderID; status.Status = statusContent; status.VisibilityLevelID = range; IStatusUpdateService _statusUpdateService; _statusUpdateService = new StatusUpdateService(); _statusUpdateService.SaveStatusUpdate(status); _view.LoadAlert(_alertService.GetAlerts(senderID, accountID), _statusUpdateService.GetStatusUpdateByID(_userSession.CurrentUser, _accountService.GetAccountByAccountID(accountID), IsAccount)); }
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))); } } } }