public static void turnLights(bool on, string line) { DateTime now = convertToTimeZone(DateTime.Now, line); if (hasLightsOnFeature()) { using (DB db = new DB(DBHelper.GetConnectionString(Filter_Client))) { ProductionSchedule ps = new ProductionSchedule(); ps.EventTime = now; ps.Client = Filter_Client; ps.Line = line; ps.LightsOn = on; db.AddToProductionSchedules(ps); int res = db.SaveChanges(); } } }