Esempio n. 1
0
        public static string InsertTaskRecord(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();

                localAdapter.InsertTaskRecord(theTask.TaskName,
                                              theTask.TaskDescription,
                                              theTask.StartDate, theTask.EndDate, theTask.PeriodLengthSeconds,
                                              theTask.Iterations, theTask.Enabled, 0, null, theTask.TaskId);

                log.Debug("Se insertó el Task con ID = " + theTask.TaskId);

                return(theTask.TaskId);
            }
            catch (Exception q)
            {
                log.Error("An error was ocurred while inserting Task", q);
                throw q;
            }
        }
Esempio n. 2
0
        public static string InsertTaskRecord(string taskId, string taskName,
                                              string taskDescription, DateTime startDate, DateTime?endDate,
                                              long periodLength, int iterations, bool enabled)
        {
            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.InsertTaskRecord(taskName,
                                              taskDescription,
                                              startDate, endDate, periodLength,
                                              iterations, enabled, 0, null, taskId);

                log.Debug("Se insertó el Task con ID = " + taskId);

                return(taskId);
            }
            catch (Exception q)
            {
                log.Error("An error was ocurred while inserting Task", q);
                throw q;
            }
        }