public static Task GetTaskById(string idTask) { TaskTableAdapter localAdapter = new TaskTableAdapter(); if (string.IsNullOrEmpty(idTask)) { return(null); } Task theTask = null; try { TaskDS.TaskDataTable table = localAdapter.GetTaskById(idTask); if (table != null && table.Rows.Count > 0) { TaskDS.TaskRow row = table[0]; theTask = FillTaskRecord(row); } } catch (Exception q) { log.Error("An error was ocurred while geting client data", q); return(null); } return(theTask); }
private static Task FillTaskRecord(TaskDS.TaskRow row) { Task theNewRecord = new Task(row.TaskId, row.TaskName, row.TaskDescription, row.StartDate, row.IsEndDateNull() ? new DateTime?() : row.EndDate, row.Iterations, row.Enabled, row.IterationsExecuted, row.IsLastExecutionDateNull() ? new DateTime?() : row.LastExecutionDate, row.PeriodLengthSeconds); return(theNewRecord); }