Example #1
0
 public Entity.SearchResult <List <Entity.AlertResponse> > GetAlertList(Entity.AlertRequest request)
 {
     Entity.SearchResult <List <Entity.AlertResponse> > result = new Entity.SearchResult <List <Entity.AlertResponse> >();
     try
     {
         logger.InfoLog(Constants.ACTION_ENTRY, MethodBase.GetCurrentMethod().Name);
         using (var sqlDataAccess = new SqlDataAccess(ConnectionString))
         {
             List <System.Data.Common.DbParameter> parameters = sqlDataAccess.CreateParams(component.helper.SolutionConfiguration.CurrentUserId, "v1");
             parameters.Add(sqlDataAccess.CreateParameter("companyGuid", component.helper.SolutionConfiguration.CompanyId, DbType.Guid, ParameterDirection.Input));
             if (!string.IsNullOrEmpty(request.EntityGuid))
             {
                 parameters.Add(sqlDataAccess.CreateParameter("entityGuid", Guid.Parse(request.EntityGuid), DbType.Guid, ParameterDirection.Input));
             }
             if (!string.IsNullOrEmpty(request.DeviceGuid))
             {
                 parameters.Add(sqlDataAccess.CreateParameter("deviceGuid", Guid.Parse(request.DeviceGuid), DbType.Guid, ParameterDirection.Input));
             }
             parameters.Add(sqlDataAccess.CreateParameter("pagesize", request.PageSize, DbType.Int32, ParameterDirection.Input));
             parameters.Add(sqlDataAccess.CreateParameter("pagenumber", request.PageNumber, DbType.Int32, ParameterDirection.Input));
             parameters.Add(sqlDataAccess.CreateParameter("orderby", request.OrderBy, DbType.String, ParameterDirection.Input));
             parameters.Add(sqlDataAccess.CreateParameter("count", DbType.Int32, ParameterDirection.Output, 16));
             System.Data.Common.DbDataReader dbDataReader = sqlDataAccess.ExecuteReader(sqlDataAccess.CreateCommand("[Alert_List]", CommandType.StoredProcedure, null), parameters.ToArray());
             result.Items = DataUtils.DataReaderToList <Entity.AlertResponse>(dbDataReader, null);
             result.Count = int.Parse(parameters.Where(p => p.ParameterName.Equals("count")).FirstOrDefault().Value.ToString());
         }
         logger.InfoLog(Constants.ACTION_EXIT, MethodBase.GetCurrentMethod().Name);
     }
     catch (Exception ex)
     {
         logger.ErrorLog(Constants.ACTION_EXCEPTION, ex);
     }
     return(result);
 }
Example #2
0
 public Entity.SearchResult <List <Entity.AlertResponse> > AlertList(Entity.AlertRequest request)
 {
     Entity.SearchResult <List <Entity.AlertResponse> > result = new Entity.SearchResult <List <Entity.AlertResponse> >();
     try
     {
         result = _notificationsRepository.GetAlertList(request);
     }
     catch (Exception ex)
     {
         _logger.ErrorLog(ex, this.GetType().Name, MethodBase.GetCurrentMethod().Name);
         return(result);
     }
     return(result);
 }