public static bool UpdateTaskRecord(string taskId, string taskName, string taskDescription, DateTime startDate, DateTime?endDate, long periodLength, int iterations, bool enabled, DateTime?lastExecutionDate, int iterationsExecuted) { if (string.IsNullOrEmpty(taskId)) { throw new ArgumentException("Task Id no puede ser nulo."); } if (string.IsNullOrEmpty(taskName)) { throw new ArgumentException("Task Name no puede ser nulo."); } if (string.IsNullOrEmpty(taskDescription)) { throw new ArgumentException("Task Description no puede ser nulo."); } try { TaskTableAdapter localAdapter = new TaskTableAdapter(); localAdapter.UpdateTaskRecord(taskName, taskDescription, startDate, endDate, periodLength, iterations, enabled, iterationsExecuted, lastExecutionDate, taskId); log.Debug("Se modifico el Task con id = " + taskId); return(true); } catch (Exception q) { log.Error("An error was ocurred while updating Task", q); return(false); } }
public static bool UpdateTaskRecord(Task theTask) { if (string.IsNullOrEmpty(theTask.TaskId)) { throw new ArgumentException("Task Id no puede ser nulo."); } if (string.IsNullOrEmpty(theTask.TaskName)) { throw new ArgumentException("Task Name no puede ser nulo."); } if (string.IsNullOrEmpty(theTask.TaskDescription)) { throw new ArgumentException("Task Description no puede ser nulo."); } try { TaskTableAdapter localAdapter = new TaskTableAdapter(); if (theTask.LastExecutionDate.Value.Year == 1) { theTask.LastExecutionDate = new DateTime?(); } localAdapter.UpdateTaskRecord(theTask.TaskName, theTask.TaskDescription, theTask.StartDate, theTask.EndDate, theTask.PeriodLengthSeconds, theTask.Iterations, theTask.Enabled, theTask.IterationsExecuted, theTask.LastExecutionDate, theTask.TaskId); log.Debug("Se modifico el Task con id = " + theTask.TaskId); return(true); } catch (Exception q) { log.Error("An error was ocurred while updating task", q); return(false); } }