public void SaveWarning(Model.Warning record) { using (Ringsted1Entities111 context = new Ringsted1Entities111()) { Warning query = (from o in context.Warnings where o.ID == 1 select o).FirstOrDefault(); if (query == null) { Warning warningE = new Warning(); warningE.Priority = record.Priority; warningE.Message = record.Message; context.Warnings.Add(warningE); try { context.SaveChanges(); } catch (Exception ex) { LoggerSingleton.Instance.Log("An exception occurred when attempting to save a new warning to the database: ", ex); } } } }
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"; }