Exemplo n.º 1
0
        public async Task <ActionResult <Tag> > GetTag(int id)
        {
            var tag = await _ITag.FindAsync(id);

            if (tag == null)
            {
                return(NotFound());
            }

            return(tag);
        }
Exemplo n.º 2
0
        public async ValueTask <KSociety.Com.App.Dto.Res.Remove.S7.S7Tag> ExecuteAsync(S7Tag request, CancellationToken cancellationToken = default)
        {
            var s7Tag = await _tagRepository.FindAsync(cancellationToken, request.Id).ConfigureAwait(false); //.GetAllS7Tag().SingleOrDefault(g => g.Id == request.Id);

            _tagRepository.Delete(s7Tag);
            return(new KSociety.Com.App.Dto.Res.Remove.S7.S7Tag(await _unitOfWork.CommitAsync(cancellationToken).ConfigureAwait(false) > 0));
        }
Exemplo n.º 3
0
        public async ValueTask <KSociety.Com.App.Dto.Res.ModifyField.Logix.LogixTag> ExecuteAsync(LogixTag request, CancellationToken cancellationToken = default)
        {
            var logixTag = await _tagRepository.FindAsync(cancellationToken, request.Id).ConfigureAwait(false);  //.GetAllLogixTag().SingleOrDefault(g => g.Id == request.Id);

            logixTag?.ModifyField(request.FieldName, request.Value);
            var result = await _unitOfWork.CommitAsync(cancellationToken).ConfigureAwait(false);

            return(new KSociety.Com.App.Dto.Res.ModifyField.Logix.LogixTag(result > 0));
        }
Exemplo n.º 4
0
        public async ValueTask <Srv.Dto.Common.Tag> GetTagByIdAsync(IdObject idObject, CallContext context = default)
        {
            Domain.Entity.Common.Tag tag = null;
            _logger.LogTrace("Query Behavior: " + GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name);
            try
            {
                tag = await _commonTagRepository.FindAsync(context.CancellationToken, idObject.Id);
            }
            catch (Exception ex)
            {
                _logger.LogError("Query Behavior: " + GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name + " " + ex.Message + " - " + ex.StackTrace);
            }

            return(new Tag(tag.Id, tag.AutomationTypeId, tag.Name, tag.ConnectionId, tag.Enable, tag.InputOutput, tag.AnalogDigitalSignal, tag.MemoryAddress, tag.Invoke, tag.TagGroupId));
        }