public void Test1()
        {
            JT808BlacklistManager jT808BlacklistManager = new JT808BlacklistManager();

            jT808BlacklistManager.Add("1");
            Assert.True(jT808BlacklistManager.Contains("1"));
            jT808BlacklistManager.Add("2");
            Assert.True(jT808BlacklistManager.Contains("2"));
            jT808BlacklistManager.Remove("1");
            Assert.False(jT808BlacklistManager.Contains("1"));
        }
Ejemplo n.º 2
0
        public ActionResult <JT808ResultDto <bool> > BlacklistRemove([FromBody] JT808TerminalPhoneNoDto parameter)
        {
            JT808ResultDto <bool> resultDto = new JT808ResultDto <bool>();

            try
            {
                BlacklistManager.Remove(parameter.TerminalPhoneNo);
                resultDto.Code = JT808ResultCode.Ok;
                resultDto.Data = true;
            }
            catch (Exception ex)
            {
                resultDto.Data    = false;
                resultDto.Code    = JT808ResultCode.Error;
                resultDto.Message = ex.StackTrace;
            }
            return(resultDto);
        }
        /// <summary>
        /// 移除sim卡黑名单
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        public byte[] BlacklistRemove(string json)
        {
            if (string.IsNullOrEmpty(json))
            {
                return(EmptyHttpResponse());
            }
            JT808ResultDto <bool> resultDto = new JT808ResultDto <bool>();

            try
            {
                BlacklistManager.Remove(json);
                resultDto.Data = true;
                resultDto.Code = JT808ResultCode.Ok;
            }
            catch (Exception ex)
            {
                resultDto.Data    = false;
                resultDto.Code    = JT808ResultCode.Error;
                resultDto.Message = ex.StackTrace;
            }
            return(CreateHttpResponse(resultDto));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 移除sim卡黑名单
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        public byte[] BlacklistRemove(string json)
        {
            if (string.IsNullOrEmpty(json))
            {
                return(EmptyHttpResponse());
            }
            JT808ResultDto <bool> resultDto = new JT808ResultDto <bool>();

            try
            {
                JT808TerminalPhoneNoDto parameter = JsonSerializer.Deserialize <JT808TerminalPhoneNoDto>(json);
                BlacklistManager.Remove(parameter.TerminalPhoneNo);
                resultDto.Data = true;
                resultDto.Code = JT808ResultCode.Ok;
            }
            catch (Exception ex)
            {
                resultDto.Data    = false;
                resultDto.Code    = JT808ResultCode.Error;
                resultDto.Message = ex.StackTrace;
            }
            return(CreateHttpResponse(resultDto));
        }