Beispiel #1
0
        public async Task <List <SearchedProcess> > Handle(GetProcess request, CancellationToken cancellationToken)
        {
            List <SearchedProcess> result = new List <SearchedProcess>();

            if (request.ScreenId != null)
            {
                result = await(from P in _context.Process
                               join S in _context.Screens on P.ScreenId equals S.Id into Screens
                               from ScreenResults in Screens.DefaultIfEmpty()
                               join M in _context.Module on ScreenResults.ModuleId equals M.Id into Modules
                               from ModuleResult in Modules.DefaultIfEmpty()
                               where P.ScreenId == request.ScreenId
                               select new SearchedProcess
                {
                    Id          = P.Id,
                    Name        = P.Name,
                    Description = P.Description,
                    ScreenId    = P.ScreenId,
                    ModuleId    = ModuleResult.Id,
                }).ToListAsync(cancellationToken);
            }
            return(result);
        }
Beispiel #2
0
        public async Task <List <SearchedProcessConnection> > Handle(GetProcessConnection request, CancellationToken cancellationToken)
        {
            List <SearchedProcessConnection> result = new List <SearchedProcessConnection>();

            result = await(from PC in _context.ProcessConnection
                           join P in _context.Process on PC.ProcessId equals P.Id into Processes
                           from ProcessesResults in Processes.DefaultIfEmpty()
                           join C in _context.Process on PC.ConnectionId equals C.Id into Connections
                           from ConnectionResults in Connections.DefaultIfEmpty()
                           join S in _context.Screens on ProcessesResults.ScreenId equals S.Id into Screens
                           from ScreenResults in Screens.DefaultIfEmpty()

                           select new SearchedProcessConnection
            {
                Id             = PC.Id,
                ProcessId      = PC.ProcessId,
                ConnectionId   = PC.ConnectionId,
                ProcessText    = ProcessesResults.Name,
                ConnectionText = ConnectionResults.Name,
                ScreenId       = ProcessesResults.ScreenId,
                ModuleId       = (Int16)ScreenResults.ModuleId
            }).ToListAsync(cancellationToken);
            return(result);
        }