private bool ValidateTaskCreation(ProcessedTask processedTask)
 {
     if (processedTask.TaskAssignment.Task.Id > 0)
     {
         if (processedTask.TaskAssignment.Create() && processedTask.Create())
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         if (processedTask.TaskAssignment.Task.Create() && processedTask.TaskAssignment.Create() && processedTask.Create())
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
        private bool CreateProcessedTask(LoopTaskSchedule loopTaskSchedule, DateTime startDate, DateTime endDate)
        {
            int           assignedStatusId = 1;
            ProcessedTask processedTask    = new ProcessedTask()
            {
                Commentary       = null,
                AssignationDate  = DateTime.Now,
                IdTaskStatus     = assignedStatusId,
                TaskAssignment   = loopTaskSchedule.LoopTask.TaskAssignment,
                LoopTaskSchedule = loopTaskSchedule,
                StartDate        = startDate,
                EndDate          = endDate
            };

            return(processedTask.Create());
        }
        private bool CreateProcessedTask(LoopTaskSchedule loopTaskSchedule, DateTime startTime, DateTime endTime, int differenceBetweenDays)
        {
            int      assignedStatusId = 1;
            DateTime startDate        = DateTime.Now.AddDays(differenceBetweenDays);

            startDate = startDate.Date + startTime.TimeOfDay;
            DateTime      endDate       = startDate.Date + endTime.TimeOfDay;
            ProcessedTask processedTask = new ProcessedTask()
            {
                Commentary       = null,
                AssignationDate  = DateTime.Now,
                IdTaskStatus     = assignedStatusId,
                TaskAssignment   = loopTaskSchedule.LoopTask.TaskAssignment,
                LoopTaskSchedule = loopTaskSchedule,
                StartDate        = startDate,
                EndDate          = endDate
            };

            return(processedTask.Create());
        }