public static void assignTask(decimal id, decimal userId) { using (var conn = new db_entities()) { try { var task = conn.tasks.Where(x => x.id == id).FirstOrDefault(); if (task != null) { task.task_status = "0"; task.assing_id = userId; } conn.SaveChanges(); conn.SP_LOG_TASK(id, userId, DateTime.Now, "0"); var alert = conn.alerts.Where(x => x.task_id == id && x.state == 0).FirstOrDefault(); if (alert != null) { conn.SP_ALERT_UPDATE(alert.id, alert.message, id, DateTime.Now, 1); } } catch (Exception e) { throw e; } } }
/** * Método para actualizar el registro */ public static void update(decimal id, decimal taskId, String message, decimal state) { using (var conn = new db_entities()) { try { var entity = conn.alerts.Where(x => x.id == id).FirstOrDefault(); if (entity == null) { throw new NotExistsException(); } else { conn.SP_ALERT_UPDATE(id, message, taskId, DateTime.Now, state); } } catch (Exception e) { throw e; } } }