Exemplo n.º 1
0
        public async ValueTask <Dto.S7.List.GridView.S7Connection> S7ConnectionAsync(CallContext context = default)
        {
            _logger.LogTrace("Query: " + GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name);

            var repository = await _s7ConnectionRepository.GetAllS7ConnectionAsync();

            var connectionItems = repository.ToList().Select(
                connection => _mapper.Map <Srv.Dto.S7.S7Connection>(connection)
                ).ToList();

            var connectionTypeDns = await _queryS7ListKeyValue.ConnectionTypeIdAsync(context);

            var cpuTypeDns = await _queryS7ListKeyValue.CpuTypeIdAsync(context);

            var output = new Srv.Dto.S7.List.GridView.S7Connection(connectionItems, connectionTypeDns.List, cpuTypeDns.List);

            return(output);
        }
Exemplo n.º 2
0
        public async ValueTask <Srv.Dto.S7.Model.S7Connection> GetS7ConnectionModelByIdAsync(IdObject idObject, CallContext context = default)
        {
            _logger.LogTrace("Query Behavior: " + GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name);
            Srv.Dto.S7.S7Connection connection;

            if (idObject.Id.Equals(Guid.Empty))
            {
                connection = new S7Connection();
            }
            else
            {
                connection = await _query.GetS7ConnectionByIdAsync(idObject, context);
            }

            var automationTypeId = await _queryKeyValue.AutomationTypeIdAsync(context);

            var connectionTypeId = await _queryS7KeyValue.ConnectionTypeIdAsync(context);

            var cpuTypeId = await _queryS7KeyValue.CpuTypeIdAsync(context);

            return(new Srv.Dto.S7.Model.S7Connection(connection, automationTypeId.List, connectionTypeId.List, cpuTypeId.List));
        }