public static DataSet GetFilters_DataSet(int?intAppID, LoggingFilterRequestContext objAppContext = null, bool blnActiveOnly = true) { SqlCommand cmd; cmd = new SqlCommand("[dbo].[pr_LoggingFilter_SelectAll]"); cmd.CommandType = CommandType.StoredProcedure; if (intAppID.HasValue) { cmd.Parameters.AddWithValue("@AppID", intAppID.Value); } cmd.Parameters.AddWithValue("@ActiveOnly", blnActiveOnly); return(SqlHelper.ExecuteDataset(cmd, null, ConnectionStringName)); }
public static List <ILoggingFilter> GetFilters(int?intAppID, LoggingFilterRequestContext objAppContext = null, bool blnActiveOnly = true) { DataTable objTable = GetFilters_DataSet(intAppID, objAppContext, blnActiveOnly).Tables[0]; List <ILoggingFilter> lstModels = new List <ILoggingFilter>(); foreach (DataRow objRow in objTable.Rows) { lstModels.Add(GetFilterModel(objRow)); } if (objAppContext != null) { return(QueryFiltersByAppContext(lstModels, objAppContext, LoggingFilterViewType.Full)); } return(lstModels); }
public static List <LoggingFilterRemoteServerView> QueryFiltersByAppContext(List <LoggingFilterRemoteServerView> lstModels, LoggingFilterRequestContext objAppContext, LoggingFilterViewType viewType) { IEnumerable <LoggingFilterRemoteServerView> data = lstModels; data = data.Where(row => row.EnvironmentFilter.WildcardAll || (objAppContext.Environment.HasValue && row.EnvironmentFilter.EnvironmentList.Contains(objAppContext.Environment.Value))); return(data.ToList()); }
public static List <ILoggingFilter> QueryFiltersByAppContext(List <ILoggingFilter> lstModels, LoggingFilterRequestContext objAppContext, LoggingFilterViewType viewType) { IEnumerable <ILoggingFilter> data = lstModels; data = data.Where(row => row.EnvironmentFilter.WildcardAll || (objAppContext.Environment.HasValue && row.EnvironmentFilter.EnvironmentList.Contains(objAppContext.Environment.Value))); if (viewType != LoggingFilterViewType.RemoteServer) { data = data.Where(row => row.ClientFilter.WildcardAll || row.ClientFilter.ClientIDList.Contains <string>(objAppContext.ClientID, new CaseInsensitiveComparer())); data = data.Where(row => row.UserFilter.WildcardAll || row.UserFilter.UserIDList.Contains <string>(objAppContext.UserID, new CaseInsensitiveComparer())); } return(data.ToList()); }
public static List <LoggingFilterRemoteServerView> GetFiltersForRemoteServer(int?intAppID, LoggingFilterRequestContext objAppContext = null, bool blnActiveOnly = true) { DataTable objTable = GetFilters_DataSet(intAppID, objAppContext, blnActiveOnly).Tables[0]; List <LoggingFilterRemoteServerView> lstModels = new List <Model.LoggingFilterRemoteServerView>(); foreach (DataRow objRow in objTable.Rows) { lstModels.Add((LoggingFilterRemoteServerView)GetFilterModel(objRow, viewType: LoggingFilterViewType.RemoteServer)); } if (objAppContext != null) { return(QueryFiltersByAppContext(lstModels, objAppContext, viewType: LoggingFilterViewType.RemoteServer)); } return(lstModels); }