예제 #1
0
        public Format_DetailForExternal External_GetById(int id, int companyId)
        {
            using (CDStudioEntities dbEntity = new CDStudioEntities())
            {
                IoTDevice existingData = (from c in dbEntity.IoTDevice.AsNoTracking()
                                          where c.Id == id && c.CompanyID == companyId
                                          select c).SingleOrDefault <IoTDevice>();

                if (existingData == null)
                {
                    throw new CDSException(10902);
                }

                return(new Format_DetailForExternal()
                {
                    Id = existingData.Id,
                    IoTHubDeviceId = existingData.IoTHubDeviceID,
                    IoTHubProtocol = existingData.IoTHubProtocol,
                    FactoryId = existingData.FactoryID,
                    FactoryName = (existingData.Factory == null ? "" : existingData.Factory.Name),
                    DeviceTypeId = existingData.DeviceTypeId,
                    DeviceTypeName = (existingData.DeviceType == null ? "" : existingData.DeviceType.Name),
                    DeviceVendor = existingData.DeviceVendor,
                    DeviceModel = existingData.DeviceModel
                });
            }
        }
예제 #2
0
        private void DeviceListSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (e.AddedItems.Count < 1)
                {
                    return;
                }

                detailTimer.Stop();

                var device = e.AddedItems[0] as IoTDevice;

                selectedDevice = device;

                pairedDeviceListBox.SelectedItems = null;

                RefreshDetailInfo(this, new EventArgs());

                detailTimer.Start();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
예제 #3
0
        public static IoTDevice DTOMessageToIoTDevice(DTOMessage dtoMessage)
        {
            IoTDevice ioTDevice = new IoTDevice()
            {
                Id       = dtoMessage.Iotdeviceid,
                Messages = new HashSet <Message>()
            };

            Message message = new Message()
            {
                TimeStampSent     = dtoMessage.TimeStamp,
                TimeStampReceived = (long)DateTime.Now.ToUniversalTime().Subtract(
                    new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)
                    ).TotalMilliseconds,

                TransmissionsCounter = dtoMessage.TransmissionsCounter,
                IoTDevice            = ioTDevice,
                Measurements         = new HashSet <Measurement>()
            };

            foreach (var dtoMeasurement in dtoMessage.Measurements)
            {
                message.Measurements.Add(new Measurement()
                {
                    SensorType = dtoMeasurement.SensorType,
                    Value      = dtoMeasurement.Value,
                    Message    = message
                });
            }

            ioTDevice.Messages.Add(message);

            return(ioTDevice);
        }
예제 #4
0
        public void deleteIoTDevice(string iotHubDeviceId)
        {
            DBHelper._IoTDevice dbhelp            = new DBHelper._IoTDevice();
            IoTDevice           existingIoTDevice = dbhelp.GetByid(iotHubDeviceId);

            dbhelp.Delete(existingIoTDevice);
        }
예제 #5
0
        public void FunPropertySample(string serverUri, int port, string deviceId, string deviceSecret)
        {
            // 创建设备
            IoTDevice device = new IoTDevice(serverUri, port, deviceId, deviceSecret);

            if (device.Init() != 0)
            {
                return;
            }

            Dictionary <string, object> json = new Dictionary <string, object>();

            // 按照物模型设置属性
            json["alarm"]              = 1;
            json["temperature"]        = 23.45812;
            json["humidity"]           = 56.89013;
            json["smokeConcentration"] = 89.56724;

            ServiceProperty serviceProperty = new ServiceProperty();

            serviceProperty.properties = json;
            serviceProperty.serviceId  = "smokeDetector"; // serviceId要和物模型一致

            List <ServiceProperty> properties = new List <ServiceProperty>();

            properties.Add(serviceProperty);

            device.GetClient().messagePublishListener = this;
            device.GetClient().Report(new PubMessage(properties));
        }
        public void FunDeviceShadowSample(string serverUri, int port, string deviceId)
        {
            // 创建设备
            string deviceCertPath = IotUtil.GetRootDirectory() + @"\certificate\deviceCert.pfx";

            if (!File.Exists(deviceCertPath))
            {
                Log.Error("请将设备证书放到根目录!");

                return;
            }

            X509Certificate2 deviceCert = new X509Certificate2(deviceCertPath, "123456");

            // 使用证书创建设备,X509证书接入
            device = new IoTDevice(serverUri, port, deviceId, deviceCert);

            if (device.Init() != 0)
            {
                return;
            }

            device.GetClient().deviceShadowListener = this;

            string guid = Guid.NewGuid().ToString();

            Console.WriteLine(guid);

            string topic = CommonTopic.TOPIC_SYS_SHADOW_GET + "=" + guid;

            device.GetClient().Report(new PubMessage(topic, string.Empty));
        }
예제 #7
0
        /// <summary>
        /// Get the last Response saved on DB cache for a given method and payload
        /// </summary>
        /// <param name="device"></param>
        /// <param name="method"></param>
        /// <param name="payload"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public string GetResponseFromCache(IoTDevice device, IoTDeviceMethod method, string payload, Database db = null)
        {
            if (method == null)
            {
                return(string.Empty);
            }

            db = GetDatabase(db);
            if (db == null)
            {
                return(string.Empty);
            }

            var key = GetMethodKey(device, method, payload);

            if (string.IsNullOrEmpty(key))
            {
                return(string.Empty);
            }

            // Retrieve and return saved value
            var savedValue = db.PropertyStore.GetStringValue(key);

            return(savedValue);
        }
        public void FunMessageSample(string serverUri, int port, string deviceId, string deviceSecret)
        {
            // 创建设备
            IoTDevice device = new IoTDevice(serverUri, port, deviceId, deviceSecret);

            if (device.Init() != 0)
            {
                return;
            }

            device.GetClient().Report(new PubMessage(new DeviceMessage("hello11")));
            device.GetClient().deviceCustomMessageListener = this;
            device.GetClient().messagePublishListener      = this;

            // 上报自定义topic消息,注意需要先在平台配置自定义topic,并且topic的前缀已经规定好,固定为:$oc/devices/{device_id}/user/,通过Postman模拟应用侧使用自定义Topic进行命令下发。
            string suf_topic = "wpy";

            device.GetClient().SubscribeTopic(suf_topic);

            device.GetClient().Report(new PubMessage(CommonTopic.PRE_TOPIC + suf_topic, "hello raw message "));
            ////while (true)
            ////{
            ////    Thread.Sleep(5000);
            ////}
        }
예제 #9
0
        public void AddDeviceToDB(IoTDevice device)
        {
            try
            {
                var dic = new Dictionary <string, object>();
                dic.Add(DBConstant.DEVICE_NAME, device.DeviceName);
                dic.Add(DBConstant.BLUETOOTH_NAME, device.BTName);
                dic.Add(DBConstant.BLUEZ_PATH, device.Path);
                dic.Add(DBConstant.MAC_ADDRESS, device.MACAddress);
                dic.Add(DBConstant.SENSOR_TYPE, (int)device.SensorType);
                dic.Add(DBConstant.STATUS_ARG, string.Empty);
                dic.Add(DBConstant.DEVICE_STATUS, (int)device.Status);
                dic.Add(DBConstant.BT_SERVICE_UUID, device.ServiceUUID);
                dic.Add(DBConstant.BT_GATT_RX_UUID, device.RXUUID);
                dic.Add(DBConstant.BT_GATT_TX_UUID, device.TXUUID);

                SmallDBService.AddRow(dic);

                //SmallDBService.SaveDB();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
        public async Task <IActionResult> PutIoTDevices(string id, IoTDevice ioTDevice)
        {
            if (id != ioTDevice.id)
            {
                return(BadRequest());
            }

            _context.Entry(ioTDevice).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!IoTDeviceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #11
0
        public int GetIoTDeviceCompanyId(string iotHubDeviceId)
        {
            DBHelper._IoTDevice dbhelp            = new DBHelper._IoTDevice();
            IoTDevice           existingIoTDevice = dbhelp.GetByid(iotHubDeviceId);

            return(existingIoTDevice.Factory.CompanyId);
        }
예제 #12
0
        public Format_Detail GetById(int id)
        {
            using (CDStudioEntities dbEntity = new CDStudioEntities())
            {
                IoTDevice existingData = (from c in dbEntity.IoTDevice.AsNoTracking()
                                          where c.Id == id
                                          select c).SingleOrDefault <IoTDevice>();

                if (existingData == null)
                {
                    throw new CDSException(10902);
                }

                return(new Format_Detail()
                {
                    Id = existingData.Id,
                    IoTHubDeviceId = existingData.IoTHubDeviceID,
                    IoTHubId = existingData.IoTHubID,
                    IoTHubName = existingData.IoTHub == null ? "" : existingData.IoTHub.IoTHubName,
                    IoTHubProtocol = existingData.IoTHubProtocol,
                    FactoryId = existingData.FactoryID,
                    FactoryName = (existingData.Factory == null ? "" : existingData.Factory.Name),
                    AuthenticationType = existingData.AuthenticationType,
                    DeviceCertificateID = existingData.DeviceCertificateID,
                    DeviceTypeId = existingData.DeviceTypeId,
                    DeviceTypeName = (existingData.DeviceType == null ? "" : existingData.DeviceType.Name),
                    DeviceVendor = existingData.DeviceVendor,
                    DeviceModel = existingData.DeviceModel,
                    MessageConvertScript = existingData.MessageConvertScript,
                    EnableMessageConvert = existingData.EnableMessageConvert,
                    OriginMessage = existingData.OriginMessage
                });
            }
        }
예제 #13
0
        public async Task <IActionResult> AddOrEdit(IoTDevice IoTdevice)
        {
            if (ModelState.IsValid)
            {
                string deviceName;
                var    userId = _httpContextAccessor.HttpContext.User?.Claims?
                                .FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value;

                var Uid = _context.Users.FirstOrDefault(x => x.Id == userId);
                IoTdevice.UserId = userId;
                if (IoTdevice.DeviceId == 0)
                {
                    IoTdevice.CurrentCoffeeWeight = IoTdevice.CoffeeHopperCapacity;
                    IoTdevice.CurrentWaterWeight  = IoTdevice.WaterHopperCapacity;
                    _context.Add(IoTdevice);
                    deviceName = IoTdevice.ModelName.Replace(" ", "") + userId;
                    AddDevice addDevice = new AddDevice(deviceName, true);
                    //addDevices.Add(addDevice);
                    IoTdevice.ConnectionString = addDevice.GetConnectionSrting();
                }
                else
                {
                    _context.Update(IoTdevice);
                }
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(IoTdevice));
        }
예제 #14
0
        public async Task TestSensor()
        {
            List <IoTDevice> iotDevices = await _iotDeviceHelper.GetAllInputDevices();

            if (iotDevices == null || iotDevices.Count == 0)
            {
                ConsoleHelper.WriteWarning($"No devices found! Make sure to run '1. Setup list of devices' first.");
                return;
            }

            int       i           = 0;
            int       valueParsed = 0;
            IoTDevice device      = null;

            do
            {
                bool waitingForNumber = true;
                do
                {
                    ConsoleHelper.ClearConsole();
                    ConsoleHelper.WriteHighlight($"{i} messages sent from {(iotDevices.Count)} device(s).");
                    ConsoleHelper.WriteInfo("");
                    for (int n = 0; n < iotDevices.Count; n++)
                    {
                        ConsoleHelper.WriteInfo($"{n}. {iotDevices[n].DeviceType} {iotDevices[n].Name} [{iotDevices[n].Longitude}|{iotDevices[n].Latitude}]");
                    }
                    ConsoleHelper.WriteInfo("");
                    ConsoleHelper.WriteInfo("Type a number corresponding to the device to trigger. Or stop to terminate the simulation");
                    string value = Console.ReadLine();

                    if (int.TryParse(value, out valueParsed))
                    {
                        waitingForNumber = false;
                    }

                    if (value.ToLower() == "stop")
                    {
                        return;
                    }
                }while (waitingForNumber);

                device = iotDevices[valueParsed];

                string eventType  = device.DeviceType == "SoundSensor" ? "Sound" : "Button";
                object messageObj = new ButtonSensorMessage();
                if (device.DeviceType == "SoundSensor")
                {
                    messageObj = new SoundSensorMessage()
                    {
                        Decibel = GetSoundMetadata()
                    };
                }
                await _iotDeviceHelper.SendMessage(device, eventType, messageObj);

                i++;

                await Task.Delay(1000);
            }while (true);
        }
예제 #15
0
        public void ResetIoTDevicePassword(string deviceId, string newPassword)
        {
            DBHelper._IoTDevice dbhelp    = new DBHelper._IoTDevice();
            IoTDevice           iotDevice = dbhelp.GetByid(deviceId);

            iotDevice.IoTHubDevicePW = Crypto.HashPassword(newPassword);
            dbhelp.Update(iotDevice);
        }
예제 #16
0
        public void UpdateDBIoTDeviceKey(string deviceKey)
        {
            DBHelper._IoTDevice iotDeviceHelper = new DBHelper._IoTDevice();
            IoTDevice           iotDevice       = iotDeviceHelper.GetByid(this._IoTHubDeviceId);

            iotDevice.IoTHubDeviceKey = deviceKey;
            iotDeviceHelper.Update(iotDevice);
        }
예제 #17
0
 public OTAUpgrade(IoTDevice device, string packageSavePath)
 {
     this.device     = device;
     this.otaService = device.otaService;
     otaService.SetOtaListener(this);
     this.packageSavePath = packageSavePath;
     this.version         = "v0.0.1"; // 修改为实际值
 }
예제 #18
0
        /// <summary>
        /// Invoke a given Method passing optional payload
        /// </summary>
        /// <param name="device"></param>
        /// <param name="method"></param>
        /// <param name="payload"></param>
        /// <returns></returns>
        public static DynamicMessage InvokeMethod(IoTDevice device, IoTDeviceMethod method, string payload = "")
        {
            var hub = device.GetHub();
            var connectionStringsServer = hub.ConnectionString;
            var parsedDictionary        =
                InvokeMethodInternal(device, method, connectionStringsServer, payload).GetAwaiter().GetResult();

            return(parsedDictionary);
        }
예제 #19
0
        public async Task SendMessage(IoTDevice device, string eventType, object message)
        {
            string messageJson = JsonConvert.SerializeObject(message);

            var messageIoT = new Microsoft.Azure.Devices.Client.Message(Encoding.UTF8.GetBytes(messageJson));

            messageIoT.Properties.Add("opType", "eventDevice");
            messageIoT.Properties.Add("eventType", eventType);
            await device.Client.SendEventAsync(messageIoT);
        }
예제 #20
0
        private void PrepareServer()
        {
            this.IoTDev01 = new IoTDevice("IoT - 01");
            this.IoTDev02 = new IoTDevice("IoT - 02");

            this.IoTDev01.ChannelChangedEvent += this.OnChannelDataChanged;

            this.server01 = CreateServer(this.IoTDev01);
            this.server02 = CreateServer(this.IoTDev02);
        }
예제 #21
0
        /// <summary>
        /// OTA sample,用来演示如何实现设备升级。
        /// 使用方法:用户在平台上创建升级任务后,修改main函数里设备参数后启动本例,即可看到设备收到升级通知,并下   载升级包进行升级,
        /// 并上报升级结果。在平台上可以看到升级结果
        /// 前提条件:\download\ 其中根目录必须包含download文件夹(可根据情况自定义)
        /// </summary>
        /// <param name="serverUri"></param>
        /// <param name="port"></param>
        /// <param name="deviceId"></param>
        /// <param name="deviceSecret"></param>
        public void FunOTASample(string serverUri, int port, string deviceId, string deviceSecret)
        {
            // 创建设备
            IoTDevice device = new IoTDevice(serverUri, port, deviceId, deviceSecret);

            // package路径必须包含软固件包名称及后缀
            string     packageSavePath = IotUtil.GetRootDirectory() + @"\download\test.bin";
            OTAUpgrade otaSample       = new OTAUpgrade(device, packageSavePath);

            otaSample.Init();
        }
예제 #22
0
        private static string GetMethodKey(IoTDevice device, IoTDeviceMethod method, string payload)
        {
            var sb = new StringBuilder();

            sb.Append(device.ID);
            sb.Append("_");
            sb.Append(method.ID);
            sb.Append("_");
            sb.Append(GetMd5(payload));
            return(sb.ToString());
        }
예제 #23
0
 public Tuple <int, string> TurnONOFF(IoTDevice ioTDevice)
 {
     iotDevice.CurrentWaterWeight -= iotDevice.WaterNessessaryForLavage;
     if (iotDevice.CurrentWaterWeight > 0)
     {
         return(Tuple.Create(iotDevice.CurrentWaterWeight, "Wszystko w porządku "));
     }
     else
     {
         return(Tuple.Create(0, "wymagane uzupełnienie wody"));
     }
 }
예제 #24
0
    public bool AddNewDevice(string env, string rpi, string id)
    {
        GameObject newDevice = new GameObject("MQTT" + id);
        IoTDevice  dev       = newDevice.AddComponent <IoTDevice>();

        dev.Environment = env;
        dev.RPI         = rpi;
        dev.ID          = id;
        devices.Add(dev);
        onDeviceAdded(dev);
        return(false);
    }
예제 #25
0
파일: Lights.cs 프로젝트: superkid200/Light
        public static Lights GetLights(IoTDevice deviceType)
        {
            if (Helpers.IsCapable())
            {
                Lights      lights = new Lights();
                IList <int> index  = new List <int>();
                if (deviceType == IoTDevice.RaspberryPi)
                {
                    for (int i = 2; i < 28; i++)
                    {
                        index.Add(i);
                    }
                    index.Add(35);
                    index.Add(47);
                }
                else if (deviceType == IoTDevice.MinnowBoardMax)
                {
                    for (int i = 0; i < 10; i++)
                    {
                        index.Add(i);
                    }
                }
                else if (deviceType == IoTDevice.DragonBoard)
                {
                    index.Add(36);
                    index.Add(12);
                    index.Add(13);
                    index.Add(69);
                    index.Add(115);
                    index.Add(24);
                    index.Add(25);
                    index.Add(35);
                    index.Add(34);
                    index.Add(28);
                    index.Add(33);
                    index.Add(21);
                    index.Add(120);
                }
                foreach (int i in index)
                {
                    lights.lights.Add(new Light {
                        Pin = i
                    });
                }
                return(lights);
            }

            else
            {
                Debug.WriteLine("You need to run this app in an IoT Device to use the features in this application.");
                return(null);
            }
        }
예제 #26
0
        /// <summary>
        /// 通过Postman查询和设置平台属性
        /// </summary>
        /// <param name="serverUri"></param>
        /// <param name="port"></param>
        /// <param name="deviceId"></param>
        /// <param name="deviceSecret"></param>
        public void FunPropertiesSample(string serverUri, int port, string deviceId, string deviceSecret)
        {
            // 创建设备
            device = new IoTDevice(serverUri, port, deviceId, deviceSecret);

            if (device.Init() != 0)
            {
                return;
            }

            device.GetClient().propertyListener = this;
        }
예제 #27
0
        private static IoTServer CreateServer(IoTDevice device)
        {
            Logger.Debug($"Create server'{device.Id}'...");
            AppDomain appDomain      = CreateAppDomain(device.Id);
            var       assemblyPath   = new Uri(typeof(IoTServer).Assembly.CodeBase).LocalPath;
            var       serverInstance = (IoTServer)appDomain.CreateInstanceFromAndUnwrap(assemblyPath, typeof(IoTServer).FullName);

            serverInstance.Initialize(device.Id, device);
            return(serverInstance);

            Logger.Debug($"Create server'{device.Id}'... DONE");
        }
예제 #28
0
        public async void TestSensors()
        {
            _InterruptSimulation = false;

            List <IoTDevice> iotDevices = await _iotDeviceHelper.GetAllInputDevices();

            if (iotDevices == null || iotDevices.Count == 0)
            {
                ConsoleHelper.WriteWarning($"No devices found! Make sure to run '1. Setup list of devices' first.");
                _InterruptSimulation = true;
                return;
            }

            int       i      = 0;
            IoTDevice device = null;

            do
            {
                device = iotDevices[_rand.Next(0, iotDevices.Count - 1)];

                string eventType  = device.DeviceType == "SoundSensor" ? "Sound" : "Button";
                object messageObj = new ButtonSensorMessage();
                if (device.DeviceType == "SoundSensor")
                {
                    messageObj = new SoundSensorMessage()
                    {
                        Decibel = GetSoundMetadata()
                    };
                }
                await _iotDeviceHelper.SendMessage(device, eventType, messageObj);

                i++;

                ConsoleHelper.ClearConsole();
                ConsoleHelper.WriteInfo("Press Escape when you want to end the simulation.");
                ConsoleHelper.WriteInfo("");
                ConsoleHelper.WriteHighlight($"{i} messages sent from {(iotDevices.Count)} device(s).");
                ConsoleHelper.WriteInfo("");
                ConsoleHelper.WriteInfo($"Last message sent from {device.DeviceId}");
                ConsoleHelper.WriteInfo($"-Device Type: {device.DeviceType}");
                ConsoleHelper.WriteInfo($"-Event Type: {eventType}");
                ConsoleHelper.WriteInfo($"-Location Name: {device.Name}");
                ConsoleHelper.WriteInfo($"-Location 1: {device.Location1}");
                ConsoleHelper.WriteInfo($"-Location 2: {device.Location2}");
                ConsoleHelper.WriteInfo($"-Location 3: {device.Location3}");
                ConsoleHelper.WriteInfo($"-Latitude: {device.Latitude}");
                ConsoleHelper.WriteInfo($"-Longitude: {device.Longitude}");

                await Task.Delay(1000);
            }while (!_InterruptSimulation);
        }
예제 #29
0
        public async Task <IoTDevice> Register(string name)
        {
            Dictionary <string, string> parms = new Dictionary <string, string>();

            parms.Add("Name", name);
            parms.Add("Type", "mobile");
            parms.Add("Owner", "Mike");

            var rc = new IoTDevice();

            rc = await _client.InvokeApiAsync <IoTDevice>("Register", HttpMethod.Post, parms);

            return(rc);
        }
예제 #30
0
        public void UpdateIoTDevice(int companyId, int iotDeviceId, Format_UpdateIoTDevice parseData)
        {
            CDSShareLib.ServiceBus.Model.IoTDeviceUpdateModel message = new CDSShareLib.ServiceBus.Model.IoTDeviceUpdateModel();
            message.content = new CDSShareLib.ServiceBus.Model.IoTDeviceUpdateModel.ContentFormat();

            using (CDStudioEntities dbEntity = new CDStudioEntities())
            {
                IoTDevice iotDevice = dbEntity.IoTDevice.Find(iotDeviceId);
                if (iotDevice == null)
                {
                    throw new CDSException(10902);
                }

                //ServiceBus - Content
                message.content.oldIothubConnectionString = parseData.OldIothubConnectionString;
                message.content.iothubDeviceId            = iotDevice.IoTHubDeviceID;
                message.content.authenticationType        = iotDevice.AuthenticationType;
                message.content.iothubConnectionString    = (iotDevice.IoTHub == null ? "" : iotDevice.IoTHub.IoTHubConnectionString);
                switch (message.content.authenticationType.ToLower())
                {
                case "key":
                    message.content.iothubDeviceKey       = iotDevice.IoTHubDeviceKey;
                    message.content.certificateThumbprint = null;
                    break;

                case "certificate":
                    message.content.iothubDeviceKey       = null;
                    message.content.certificateThumbprint = (iotDevice.DeviceCertificate == null ? "" : iotDevice.DeviceCertificate.Thumbprint);
                    break;
                }
            }

            //ServiceBus - Base parameter
            message.entityId       = iotDeviceId;
            message.requester      = parseData.Requester;
            message.requesterEmail = parseData.requesterEmail;

            //Operation task
            OperationTaskModel.Format_Create operationTaskData = new OperationTaskModel.Format_Create();
            operationTaskData.Entity      = message.entity;
            operationTaskData.Name        = message.task;
            operationTaskData.EntityId    = message.entityId.ToString();
            operationTaskData.TaskContent = JsonConvert.SerializeObject(message);

            OperationTaskModel operationTaskModel = new OperationTaskModel();

            message.taskId = operationTaskModel.Create(companyId, operationTaskData);

            Global.ServiceBus.Helper.SendToQueue(Global.ServiceBus.Queue.Provision, JsonConvert.SerializeObject(message));
        }