using LifePayment.Application.Contracts; using LifePayment.Domain; using LifePayment.Domain.Models; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Channels; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories; using Z.EntityFramework.Plus; using ZeroD.Util; namespace LifePayment.Domain.Common { public class ChannelFilter : AbstractChannelFilter { public override IQueryable GetChannelLifePayOrderFilter(IQueryable query) { if (CurrentUser.ClientId == Constant.ClientType.Back && !CurrentUser.IsSystem) { var queryUser = UserChannleRepository.Where(r => r.UserId == CurrentUser.Id).Select(s => s.ChannleId).ToList(); if (queryUser.Count() > 0) { var queryResult = query.Where(s => (!string.IsNullOrEmpty(s.ChannelId) && queryUser.Contains(s.ChannelId))); return queryResult; } } return query; } public override IQueryable GetChannelLifePayUserFilter(IQueryable query) { if (CurrentUser.ClientId == Constant.ClientType.Back && !CurrentUser.IsSystem) { var queryUser = UserChannleRepository.Where(r => r.UserId == CurrentUser.Id).Select(s => s.ChannleId).ToList(); if (queryUser.Count() > 0) { var queryResult = query.Where(s => (!string.IsNullOrEmpty(s.CreationChannleNum) && queryUser.Contains(s.CreationChannleNum))); return queryResult; } } return query; } } public class ChannelsBase : Entity { public Guid ChannleId { get; set; } } }