Beispiel #1
0
        public void SaveSensor(Model.Sensor record)
        {
            using (Ringsted1Entities111 context = new Ringsted1Entities111())
            {
                Sensor query = (from o in context.Sensors
                                where o.BassinID == record.BassinID
                                select o).FirstOrDefault();

                if (query == null)
                {
                    Sensor sensorE = new Sensor();
                    sensorE.BassinID  = record.BassinID;
                    sensorE.IPAddress = record.IP;
                    context.Sensors.Add(sensorE);
                    try
                    {
                        context.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        LoggerSingleton.Instance.Log("An exception occurred when attempting to save a new sensor to the database: ", ex);
                    }
                }
            }
        }
Beispiel #2
0
 public void Init()
 {
     _bassin     = new Model.Bassin();
     _hall       = new Model.Hall();
     _silo       = new Model.Silo();
     _sensor     = new Model.Sensor();
     _sensorData = new Model.SensorData();
     _trigger    = new Model.Trigger();
     _warning    = new Model.Warning();
     _hall.Name  = "Test";
 }