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)); }
public bool Add(sconnGsmRcpt device) { try { return(true); //no adding - filled with empty objects } catch (Exception e) { _logger.Error(e, e.Message); return(false); } }
public void Fake() { try { sconnGsmRcpt zone = new sconnGsmRcpt(); zone.Fake(); Rcpts.Add(zone); } catch (Exception e) { _logger.Error(e, e.Message); } }
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); } }
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); } }
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); } }
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); } }
public AlarmSystemGsmAddRcptModel(sconnGsmRcpt rcpt) { this.GsmRcpt = rcpt; }