Ejemplo n.º 1
0
        /// <summary>
        /// Apply List Filter - Applies the Filters from the Request to the Query
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <param name="request">Request Type</param>
        /// <param name="query">Query</param>
        /// <returns>Updated Query</returns>
        public override IQueryable <T> ApplyListFilter <T>(BaseServiceListRequest request, IQueryable <T> query)
        {
            var filterRequest = (AppAnnouncementMaintenanceListRequest)request;
            var filterQuery   = (IQueryable <AppAnnouncement>)query;

            // apply filters to the IQueryable
            if (!String.IsNullOrEmpty(filterRequest.Subject))
            {
                filterQuery = filterQuery.Where(p => p.Subject.Contains(filterRequest.Subject));
            }
            if (!String.IsNullOrEmpty(filterRequest.AnnouncementText))
            {
                filterQuery = filterQuery.Where(p => p.AnnouncementText.Contains(filterRequest.AnnouncementText));
            }
            if (filterRequest.EffectiveDateStart != null)
            {
                filterQuery = filterQuery.Where(p => p.EffectiveDate >= filterRequest.EffectiveDateStart);
            }
            if (filterRequest.EffectiveDateEnd != null)
            {
                //Add 1 day to the end date and subtract a millisecond so we get all users who logged in on the end date
                var endDate = filterRequest.EffectiveDateEnd.Value.EndDateTime();
                filterQuery = filterQuery.Where(p => p.EffectiveDate <= endDate);
            }

            return((IQueryable <T>)filterQuery);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// On Validate List Request / Used for Custom Validation or Tweaking of Parameters
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <typeparam name="R">Request Type</typeparam>
        /// <param name="request">Request</param>
        /// <returns>Response</returns>
        public override R OnValidateListRequest <T, R>(BaseServiceListRequest request)
        {
            var listRequest = request as AppCodeDetailMaintenanceListRequest;

            if (string.IsNullOrEmpty(listRequest.OrderBy) == true)
            {
                listRequest.OrderBy = "CodeGroup ASC, Sort ASC, CodeValue ASC";
            }

            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// On Validate List Request / Used for Custom Validation or Tweaking of Parameters
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <typeparam name="R">Request Type</typeparam>
        /// <param name="request">Request</param>
        /// <returns>Response</returns>
        public override R OnValidateListRequest <T, R>(BaseServiceListRequest request)
        {
            var listRequest = request as AppAnnouncementMaintenanceListRequest;

            if (string.IsNullOrEmpty(listRequest.OrderBy) == true)
            {
                listRequest.OrderBy = "ForceToTopOfList DESC, EffectiveDate ASC, Sort ASC";
            }

            return(null);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// On Validate List Request / Used for Custom Validation or Tweaking of Parameters
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <typeparam name="R">Request Type</typeparam>
        /// <param name="request">Request</param>
        /// <returns>Response</returns>
        public override R OnValidateListRequest <T, R>(BaseServiceListRequest request)
        {
            var listRequest = request as SecurityRoleMaintenanceListRequest;

            if (string.IsNullOrEmpty(listRequest.OrderBy) == true)
            {
                listRequest.OrderBy = "Name ASC, Description ASC, ADGroupName ASC";
            }

            return(null);
        }
        /// <summary>
        /// On Validate List Request / Used for Custom Validation or Tweaking of Parameters
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <typeparam name="R">Request Type</typeparam>
        /// <param name="request">Request</param>
        /// <returns>Response</returns>
        public override R OnValidateListRequest<T, R>(BaseServiceListRequest request)
        {
            var listRequest = request as AppMenuItemMaintenanceListRequest;

            if (string.IsNullOrEmpty(listRequest.OrderBy) == true)
            {
                listRequest.OrderBy = "Name ASC";
            }

            return null;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// On Validate List Request / Used for Custom Validation or Tweaking of Parameters
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <typeparam name="R">Request Type</typeparam>
        /// <param name="request">Request</param>
        /// <returns>Response</returns>
        public override R OnValidateListRequest <T, R>(BaseServiceListRequest request)
        {
            var listRequest = request as AppVariableMaintenanceListRequest;

            if (string.IsNullOrEmpty(listRequest.OrderBy) == true)
            {
                listRequest.OrderBy = "VariableGroup ASC, VariableName ASC, VariableValue ASC";
            }

            return(null);
        }
        /// <summary>
        /// On Validate List Request / Used for Custom Validation or Tweaking of Parameters
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <typeparam name="R">Request Type</typeparam>
        /// <param name="request">Request</param>
        /// <returns>Response</returns>
        public override R OnValidateListRequest <T, R>(BaseServiceListRequest request)
        {
            var listRequest = request as SecurityActionMaintenanceListRequest;

            if (string.IsNullOrEmpty(listRequest.OrderBy) == true)
            {
                listRequest.OrderBy = "SecurityActionId ASC";
            }

            return(null);
        }
        /// <summary>
        /// On Validate List Request / Used for Custom Validation or Tweaking of Parameters
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <typeparam name="R">Request Type</typeparam>
        /// <param name="request">Request</param>
        /// <returns>Response</returns>
        public override R OnValidateListRequest <T, R>(BaseServiceListRequest request)
        {
            SecurityUserMaintenanceListRequest listRequest = request as SecurityUserMaintenanceListRequest;

            if (string.IsNullOrEmpty(listRequest.OrderBy) == true)
            {
                listRequest.OrderBy = "UserName";
            }

            return(null);
        }
        /// <summary>
        /// On Validate List Request / Used for Custom Validation or Tweaking of Parameters
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <typeparam name="R">Request Type</typeparam>
        /// <param name="request">Request</param>
        /// <returns>Response</returns>
        public override R OnValidateListRequest <T, R>(BaseServiceListRequest request)
        {
            var listRequest = request as AppEmailTemplateMaintenanceListRequest;

            if (string.IsNullOrEmpty(listRequest.OrderBy) == true)
            {
                listRequest.OrderBy = "TemplateCode ASC";
            }

            return(null);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Apply List Filter - Applies the Filters from the Request to the Query
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <param name="request">Request Type</param>
        /// <param name="query">Query</param>
        /// <returns>Updated Query</returns>
        public override IQueryable <T> ApplyListFilter <T>(BaseServiceListRequest request, IQueryable <T> query)
        {
            var filterRequest = (SecurityQuestionMaintenanceListRequest)request;
            var filterQuery   = (IQueryable <SecurityQuestion>)query;

            // apply filters to the IQueryable
            if (!String.IsNullOrEmpty(filterRequest.Question))
            {
                filterQuery = filterQuery.Where(p => p.Question.Contains(filterRequest.Question));
            }

            return((IQueryable <T>)filterQuery);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Apply List Filter - Applies the Filters from the Request to the Query
        /// </summary>
        /// <typeparam name="TEntity">Entity Type</typeparam>
        /// <param name="request">Request Type</param>
        /// <param name="query">Query</param>
        /// <returns>Updated Query</returns>
        public override IQueryable <TEntity> ApplyListFilter <TEntity>(BaseServiceListRequest request, IQueryable <TEntity> query)
        {
            var filterRequest = (WebsiteDataEntityPagedListRequest)request;
            var filterQuery   = (IQueryable <CStore.Domain.Entities.WebsiteData>)query;

            // apply filters to the IQueryable
            if (!String.IsNullOrEmpty(filterRequest.SearchText))
            {
                filterQuery = filterQuery.Where(p => p.Title.Contains(filterRequest.SearchText) || p.ImgLink.Contains(filterRequest.SearchText) || p.Description.Contains(filterRequest.SearchText));
            }

            return((IQueryable <TEntity>)filterQuery);
        }
        /// <summary>
        /// Apply List Filter - Applies the Filters from the Request to the Query
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <param name="request">Request Type</param>
        /// <param name="query">Query</param>
        /// <returns>Updated Query</returns>
        public override IQueryable <T> ApplyListFilter <T>(BaseServiceListRequest request, IQueryable <T> query)
        {
            SecurityUserMaintenanceListRequest listRequest = request as SecurityUserMaintenanceListRequest;
            var listQuery = (IQueryable <VWSecurityUser>)query;

            // apply filters to the IQueryable
            if (!String.IsNullOrEmpty(listRequest.UserName))
            {
                listQuery = listQuery.Where(p => p.UserName.Contains(listRequest.UserName));
            }
            if (!String.IsNullOrEmpty(listRequest.LastName))
            {
                listQuery = listQuery.Where(p => p.LastName.Contains(listRequest.LastName));
            }
            if (!String.IsNullOrEmpty(listRequest.FirstName))
            {
                listQuery = listQuery.Where(p => p.FirstName.Contains(listRequest.FirstName));
            }
            if (listRequest.SecurityRoleIds != null && listRequest.SecurityRoleIds.Any())
            {
                listQuery = listQuery.Where(p => p.RoleMemberships.Any(s => listRequest.SecurityRoleIds.Contains(s.SecurityRoleId)));
            }
            if (listRequest.SystemAdmin != null && listRequest.SystemAdmin.Value)
            {
                listQuery = listQuery.Where(p => p.SystemAdmin == true);
            }
            if (listRequest.Active != null && listRequest.Active.Value)
            {
                listQuery = listQuery.Where(p => p.Active == true);
            }
            if (listRequest.LastLoginDateStart != null)
            {
                listQuery = listQuery.Where(p => p.LastLoginDate >= listRequest.LastLoginDateStart);
            }
            if (listRequest.LastLoginDateEnd != null)
            {
                //Add 1 day to the end date and subtract a millisecond so we get all users who logged in on the end date
                var endDate = listRequest.LastLoginDateEnd.Value.AddDays(1).AddMilliseconds(-1);
                listQuery = listQuery.Where(p => p.LastLoginDate <= endDate);
            }

            return((IQueryable <T>)listQuery);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Apply List Filter - Applies the Filters from the Request to the Query
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <param name="request">Request Type</param>
        /// <param name="query">Query</param>
        /// <returns>Updated Query</returns>
        public override IQueryable <T> ApplyListFilter <T>(BaseServiceListRequest request, IQueryable <T> query)
        {
            var filterRequest = (AppVariableMaintenanceListRequest)request;
            var filterQuery   = (IQueryable <AppVariable>)query;

            // apply filters to the IQueryable
            if (!String.IsNullOrEmpty(filterRequest.VariableGroup))
            {
                filterQuery = filterQuery.Where(p => p.VariableGroup.Contains(filterRequest.VariableGroup));
            }
            if (!String.IsNullOrEmpty(filterRequest.VariableName))
            {
                filterQuery = filterQuery.Where(p => p.VariableName.Contains(filterRequest.VariableName));
            }
            if (!String.IsNullOrEmpty(filterRequest.VariableValue))
            {
                filterQuery = filterQuery.Where(p => p.VariableValue.Contains(filterRequest.VariableValue));
            }

            return((IQueryable <T>)filterQuery);
        }
        /// <summary>
        /// Apply List Filter - Applies the Filters from the Request to the Query
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <param name="request">Request Type</param>
        /// <param name="query">Query</param>
        /// <returns>Updated Query</returns>
        public override IQueryable <T> ApplyListFilter <T>(BaseServiceListRequest request, IQueryable <T> query)
        {
            var filterRequest = (AppMenuMaintenanceListRequest)request;
            var filterQuery   = (IQueryable <AppMenu>)query;

            // apply filters to the IQueryable
            if (!String.IsNullOrEmpty(filterRequest.MenuCode))
            {
                filterQuery = filterQuery.Where(p => p.MenuCode.Contains(filterRequest.MenuCode));
            }
            if (!String.IsNullOrEmpty(filterRequest.Name))
            {
                filterQuery = filterQuery.Where(p => p.Name.Contains(filterRequest.Name));
            }
            if (!String.IsNullOrEmpty(filterRequest.Description))
            {
                filterQuery = filterQuery.Where(p => p.Description.Contains(filterRequest.Description));
            }

            return((IQueryable <T>)filterQuery);
        }
        /// <summary>
        /// Apply List Filter - Applies the Filters from the Request to the Query
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <param name="request">Request Type</param>
        /// <param name="query">Query</param>
        /// <returns>Updated Query</returns>
        public override IQueryable<T> ApplyListFilter<T>(BaseServiceListRequest request, IQueryable<T> query)
        {
            var filterRequest = (AppMenuItemMaintenanceListRequest)request;
            var filterQuery = (IQueryable<AppMenuItem>)query;

            // apply filters to the IQueryable

            if (!String.IsNullOrEmpty(filterRequest.ParentAppMenuItemId))
            {
                filterQuery = filterQuery.Where(p => p.AppMenuItemId.ToString() == filterRequest.ParentAppMenuItemId);
            }
            if (!String.IsNullOrEmpty(filterRequest.AppMenuId))
            {
                filterQuery = filterQuery.Where(p => p.AppMenuId.ToString().Contains(filterRequest.AppMenuId));
            }
            if (!String.IsNullOrEmpty(filterRequest.Name))
            {
                filterQuery = filterQuery.Where(p => p.Name.Contains(filterRequest.Name));
            }
            if (!String.IsNullOrEmpty(filterRequest.Handler))
            {
                filterQuery = filterQuery.Where(p => p.Handler.Contains(filterRequest.Handler));
            }
            if (!String.IsNullOrEmpty(filterRequest.Text))
            {
                filterQuery = filterQuery.Where(p => p.Text.Contains(filterRequest.Text));
            }
            if (!String.IsNullOrEmpty(filterRequest.Style))
            {
                filterQuery = filterQuery.Where(p => p.Style.Contains(filterRequest.Style));
            }
            if (!String.IsNullOrEmpty(filterRequest.ToolTip))
            {
                filterQuery = filterQuery.Where(p => p.ToolTip.Contains(filterRequest.ToolTip));
            }

            return (IQueryable<T>)filterQuery;
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Apply List Filter - Applies the Filters from the Request to the Query
        /// </summary>
        /// <typeparam name="T">Entity Type</typeparam>
        /// <param name="request">Request Type</param>
        /// <param name="query">Query</param>
        /// <returns>Updated Query</returns>
        public override IQueryable <T> ApplyListFilter <T>(BaseServiceListRequest request, IQueryable <T> query)
        {
            var filterRequest = (AppCodeDetailMaintenanceListRequest)request;
            var filterQuery   = (IQueryable <AppCodeDetail>)query;

            // apply filters to the IQueryable
            if (!String.IsNullOrEmpty(filterRequest.CodeGroup))
            {
                filterQuery = filterQuery.Where(p => p.CodeGroup.Contains(filterRequest.CodeGroup));
            }
            if (!String.IsNullOrEmpty(filterRequest.CodeValue))
            {
                filterQuery = filterQuery.Where(p => p.CodeValue.Contains(filterRequest.CodeValue));
            }
            if (!String.IsNullOrEmpty(filterRequest.Description))
            {
                filterQuery = filterQuery.Where(p => p.Description.Contains(filterRequest.Description));
            }
            if (filterRequest.Active)
            {
                filterQuery = filterQuery.Where(p => p.Active == true);
            }
            return((IQueryable <T>)filterQuery);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Method To Allow Additional Custom Updates to the response of the List method.
        /// </summary>
        /// <param name="request">Request</param>
        /// <param name="response">Response</param>
        /// <returns>Response</returns>
        public override TResponse OnListResponse <TEntity, TResponse>(BaseServiceListRequest request, TResponse response)
        {
            var listRequest = request as WebsiteDataEntityPagedListRequest;

            return(response);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// On Validate List Request / Used for Custom Validation or Tweaking of Parameters
        /// </summary>
        /// <typeparam name="TEntity">Entity Type</typeparam>
        /// <typeparam name="TResponse">Request Type</typeparam>
        /// <param name="request">Request</param>
        /// <returns>Response</returns>
        public override TResponse OnValidateListRequest <TEntity, TResponse>(BaseServiceListRequest request)
        {
            var listRequest = request as WebsiteDataEntityPagedListRequest;

            return(null);
        }
 /// <summary>
 /// Create the IQueryable object for the list so we can include additional navigation properties.
 /// </summary>
 /// <param name="request"></param>
 public override IQueryable<TEntity> CreateListIQueryable<TEntity>(BaseServiceListRequest request, IRepository repository)
 {
     return _repository.GetAll<AppMenuItem>(p => p.AppMenu) as IQueryable<TEntity>;
 }
 /// <summary>
 /// Create the IQueryable object for the list so we can include additional navigation properties.
 /// </summary>
 /// <param name="request"></param>
 public override IQueryable <TEntity> CreateListIQueryable <TEntity>(BaseServiceListRequest request, IRepository repository)
 {
     return(_repository.GetAll <SecuritySecurable>(p => p.ParentSecuritySecurable) as IQueryable <TEntity>);
 }