Exemplo n.º 1
0
 public static RabbitMQHelper CreateInstance()
 {
     if (_instance == null)
     {
         lock (obj)
         {
             if (_instance == null)
             {
                 _instance = new RabbitMQHelper();
             }
         }
     }
     return(_instance);
 }
Exemplo n.º 2
0
 /// <summary>
 /// 删除数据
 /// </summary>
 /// <param name="keyValue">主键</param>
 public void RemoveForm(string keyValue)
 {
     try
     {
         service.RemoveForm(keyValue);
         RabbitMQHelper rh = RabbitMQHelper.CreateInstance();
         SendData       sd = new SendData();
         sd.DataName     = "RemoveDevice";
         sd.EntityString = keyValue;
         rh.SendMessage(JsonConvert.SerializeObject(sd));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, KbsdeviceEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
         RabbitMQHelper rh = RabbitMQHelper.CreateInstance();
         SendData       sd = new SendData();
         if (keyValue == "")
         {
             sd.DataName = "AddDevice";
         }
         else
         {
             sd.DataName = "UpdateDevice";
         }
         sd.EntityString = JsonConvert.SerializeObject(entity);
         rh.SendMessage(JsonConvert.SerializeObject(sd));
     }
     catch (Exception)
     {
         throw;
     }
 }