Exemplo n.º 1
0
        public AlertInfoModel GetAlertInfo()
        {
            const string logMethodName = ".GetAlertInfo() - ";

            _log.Debug(logMethodName + "Begin Method");

            AlertInfoModel aInfo    = null;
            int            memberId = new AsaMemberAdapter().GetMemberIdFromContext();

            try
            {
                if (memberId > 0)
                {
                    if (_alertAdapter == null)
                    {
                        _log.Error(logMethodName + "ASA.Web.Services.AlertService.GetAlertInfo(): " + AlertAdapterExceptionMessage);
                        throw new AlertBadDataException("Null adapter in ASA.Web.Services.AlertService.GetAlertInfo()");
                    }

                    else
                    {
                        aInfo = _alertAdapter.GetAlertInfo(memberId);
                    }
                }
                else
                {
                    _log.Warn(logMethodName + "A user who is anonymous is trying to access GetAlertInfo");
                    aInfo = new AlertInfoModel();
                    var error = new ErrorModel("A user who is anonymous is trying to access GetAlertInfo", "Web Alert Service");
                    aInfo.ErrorList.Add(error);
                }
            }
            catch (Exception ex)
            {
                //Alerts is non-critical functionality so if there is some kind of problem getting alerts we simply log it and move on my returning a null set.
                _log.Error(logMethodName + "ASA.Web.Services.AlertService.GetAlertInfo(): Exception => " + ex.ToString());
                //throw new AlertOperationException("Web Alert Service - Exception in ASA.Web.Services.AlertService.GetAlertInfo()", ex);
            }

            _log.Debug(logMethodName + "End Method");

            return(aInfo ?? (aInfo = new AlertInfoModel()));
        }
Exemplo n.º 2
0
        public DataContracts.AlertInfoModel GetAlertInfo(int memberId)
        {
            String logMethodName = ".GetAlertInfo(string individualId) - ";

            _log.Debug(logMethodName + "Begin Method");

            var aInfo = new AlertInfoModel();

            aInfo.AlertCount = 0;

            try
            {
                aInfo.AlertCount = SaltServiceAgent.GetUserAlerts(memberId).ToDomainObject().Count;
            }
            catch (Exception ex)
            {
                _log.Error(logMethodName + "ASA.Web.Services.AlertService.AlertAdapter.GetAlertInfo(): Exception =>" + ex.ToString());
                throw new AlertOperationException("Web Alert Service - ASA.Web.Services.AlertService.AlertAdapter.GetAlertInfo()", ex);
            }

            _log.Debug(logMethodName + "End Method");
            return(aInfo);
        }