Ejemplo n.º 1
0
        public async Task <Terminal> CreateNewTerminal(Guid tenantId, Guid storeId)
        {
            var userToken = await _authorizationApi.Login(_login, _password);

            _terminalApi.SetUserToken(userToken);
            var rnd         = (new Random()).Next(Int32.MaxValue);
            var terminalDto = new TerminalDto()
            {
                TerminalId     = Guid.NewGuid(),
                IsConfirmed    = true,
                Name           = "term" + rnd,
                StoreId        = storeId,
                TerminalNumber = rnd
            };
            var token    = (await _terminalApi.AddTerminalToStore(terminalDto)).Value;
            var terminal = new Terminal()
            {
                StoreId    = storeId,
                TenantId   = tenantId,
                TerminalId = terminalDto.TerminalId,
                Token      = token
            };

            _db.Terminals.Add(terminal);
            return(terminal);
        }
Ejemplo n.º 2
0
 public void Update(TerminalDto terminalDto)
 {
     //Acknowledged = terminalDto.Acknowledged;
     Active = terminalDto.Active;
     // AlarmLevelName = terminalDto.AlarmLevelName;
     MaxValue = terminalDto.MaxValue;
     SetTime  = terminalDto.SetTime;
     //VariableName = terminalDto.VariableName;
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> Update(TerminalDto dto)
        {
            await terminalService.Update(dto);

            return(Ok(new JsonResultDto <TerminalDto>
            {
                Data = dto
            }));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Add(TerminalDto dto)
        {
            var result = await terminalService.Add(dto);

            return(Ok(new JsonResultDto <string>
            {
                Data = result,
                Message = string.IsNullOrEmpty(result) ? null : "操作失败"
            }));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Add(TerminalDto dto)
        {
            var result = await terminalService.Add(dto) > 0;

            return(Ok(new JsonResultDto <bool>
            {
                Data = result,
                Message = result ? null : "操作失败"
            }));
        }
Ejemplo n.º 6
0
 public TerminalViewModel(TerminalDto terminalDto, ServiceClient svc)
 {
     Acknowledged   = terminalDto.Acknowledged;
     Active         = terminalDto.Active;
     AlarmLevelName = terminalDto.AlarmLevelName;
     MaxValue       = terminalDto.MaxValue;
     SetTime        = terminalDto.SetTime;
     VariableName   = terminalDto.VariableName;
     _alarmId       = terminalDto.AlarmId;
     _svc           = svc;
 }
Ejemplo n.º 7
0
        public IActionResult Edit(TerminalDto dto, string roles)
        {
            try
            {
                if (dto.Id == Guid.Empty)
                {
                    dto.Id = Guid.NewGuid();
                }

                var Terminal = _service.InsertOrUpdate(dto);
                return(Json(new { Result = "Success" }));
            }
            catch (Exception ex)
            {
                return(Json(new { Result = "Faild", Message = ex.Message }));
            }
        }