コード例 #1
0
        //添加通道(暂时不使用)
        public AddChannelResponseDto AddChannel(AddChannelRequestDto req)
        {
            //暂时不使用
            AddChannelResponseDto ard = new AddChannelResponseDto();
            //收集信息:BstarCloud-User-Token
            string customerToken = "";

            if (!RestHelper.SecurityCheck(ref customerToken))
            {
                ard.Code    = (int)CodeEnum.ReqNoToken;
                ard.Message = RestHelper.SecNoTokenMessage;
            }
            else
            {
                //收集信息:Channel对象
                Bsr.Cloud.Model.Entities.Channel channel = new Bsr.Cloud.Model.Entities.Channel();
                channel.ChannelName   = req.ChannelName;
                channel.ChannelNumber = Convert.ToInt32(req.ChannelNumber);
                channel.DeviceId      = Convert.ToInt32(req.DeviceId);
                //设置返回通道Id 为0
                int             channelId = 0;
                ResponseBaseDto dto       = resourceGroupBLL.AddChannel(channel, customerToken, ref channelId);
                ard.Code          = dto.Code;
                ard.Message       = dto.Message;
                ard.ChannelId     = channelId;
                ard.ChannelName   = req.ChannelName;
                ard.ChannelNumber = req.ChannelNumber;
                ard.DeviceId      = req.DeviceId;
            }
            return(ard);
        }
コード例 #2
0
        //删除一个分组下的一个通道
        public DeleteGroupChannelResponseDto DeleteGroupChannel(DeleteGroupChannelRequestDto req)
        {
            DeleteGroupChannelResponseDto dcr = new DeleteGroupChannelResponseDto();
            string customerToken = "";

            if (!RestHelper.SecurityCheck(ref customerToken))
            {
                dcr.Code    = (int)CodeEnum.ReqNoToken;
                dcr.Message = RestHelper.SecNoTokenMessage;
            }
            else
            {
                Bsr.Cloud.Model.Entities.Customer      customer      = new Model.Entities.Customer();
                Bsr.Cloud.Model.Entities.Channel       channel       = new Bsr.Cloud.Model.Entities.Channel();
                Bsr.Cloud.Model.Entities.ResourceGroup resourceGroup = new Bsr.Cloud.Model.Entities.ResourceGroup();
                channel.ChannelId             = req.ChannelId;
                resourceGroup.ResourceGroupId = req.ResourceGroupId;
                ResponseBaseDto dto = resourceGroupBLL.DeleteSingleChannelByChannelId(resourceGroup, channel, customerToken);
                dcr.Code    = dto.Code;
                dcr.Message = dto.Message;
            }
            return(dcr);
        }