示例#1
0
 public bool Remove(sconnGsmRcpt device)
 {
     try
     {
         if (Online)
         {
             // 'Remove' clears static record instead - replace with new empty record with the same Id
             sconnGsmRcpt stub = new sconnGsmRcpt {
                 Id = device.Id
             };
             this.Update(stub);
             return(SaveChanges());
         }
         else
         {
             this.ConfigManager.Config.GsmConfig.Rcpts.Remove(device);
             return(true);
         }
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
         return(false);
     }
 }
        public ActionResult Remove(sconnGsmRcpt Rcpt)
        {
            AlarmSystemGsmAddRcptModel model = new AlarmSystemGsmAddRcptModel();

            this._provider = new GsmConfigurationService(DomainSession.GetAlarmConfigForContextSession(this.HttpContext));
            var remRes = this._provider.Remove(Rcpt);

            model.Result = StatusResponseGenerator.GetStatusResponseResultForReturnParam(remRes);
            return(View(model));
        }
示例#3
0
 public bool Add(sconnGsmRcpt device)
 {
     try
     {
         return(true);    //no adding -  filled with empty objects
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
         return(false);
     }
 }
示例#4
0
 public void Fake()
 {
     try
     {
         sconnGsmRcpt zone = new sconnGsmRcpt();
         zone.Fake();
         Rcpts.Add(zone);
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
     }
 }
示例#5
0
 public sconnGsmRcpt GetById(int Id)
 {
     try
     {
         if (Online)
         {
             EntityManager.Download();
         }
         sconnGsmRcpt dev = ConfigManager.Config.GsmConfig.Rcpts.FirstOrDefault(d => d.Id == Id);
         return(dev);
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
         return(null);
     }
 }
示例#6
0
 public bool RemoveById(int Id)
 {
     try
     {
         sconnGsmRcpt dev = this.GetById(Id);
         if (dev != null)
         {
             return(this.Remove(dev));
         }
         return(false);
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
         return(false);
     }
 }
示例#7
0
 public void Deserialize(byte[] buffer)
 {
     try
     {
         int relays = ipcDefines.RAM_SMS_RECP_NO;
         for (int i = 0; i < relays; i++)
         {
             byte[] relayCfg = new byte[ipcDefines.RAM_SMS_RECP_SIZE];
             for (int j = 0; j < ipcDefines.RAM_SMS_RECP_SIZE; j++)
             {
                 relayCfg[j] = buffer[i * ipcDefines.RAM_SMS_RECP_SIZE + j];
             }
             sconnGsmRcpt relay = new sconnGsmRcpt(relayCfg);
             relay.Id = i;
             Rcpts.Add(relay);
         }
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
     }
 }
示例#8
0
 public bool Update(sconnGsmRcpt rcpt)
 {
     try
     {
         ConfigManager.Config.GsmConfig.Rcpts
         .Where(z => z.Id == rcpt.Id)
         .ToList()
         .ForEach(x =>
         {
             x.MessageLevel = rcpt.MessageLevel;
             x.NumberE164   = rcpt.NumberE164;
             x.CountryCode  = rcpt.CountryCode;
         }
                  );
         return(SaveChanges());
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
         return(false);
     }
 }
示例#9
0
 public AlarmSystemGsmAddRcptModel(sconnGsmRcpt rcpt)
 {
     this.GsmRcpt = rcpt;
 }