public bool Read() { try { Data.PROCESSED_TASK processedTask = Connection.ProcessSA_DB.PROCESSED_TASK.First(pt => pt.ID == Id); Id = (int)processedTask.ID; Commentary = processedTask.COMMENTARY; AssignationDate = processedTask.ASSIGNATIONDATE; StartDate = processedTask.STARTDATE; EndDate = processedTask.ENDDATE; IdTaskStatus = (int)processedTask.ID_TASKSTATUS; TaskAssignment = new TaskAssignment((int)processedTask.ID_TASK_ASSIGNMENT); if (processedTask.ID_SCHEDULED_LOOPTASK != null) { LoopTaskSchedule = new LoopTaskSchedule((int)processedTask.ID_SCHEDULED_LOOPTASK); } else { LoopTaskSchedule = null; } return(true); } catch (Exception e) { log.Error("Ha ocurrido un error durante la lectura de ProcessedTask con Id: " + Id, e); return(false); } }
public List <LoopTaskSchedule> GetSchedule() { List <LoopTaskSchedule> ltsList = new List <LoopTaskSchedule>(); List <Data.LOOP_TASK_SCHEDULE> ltsData = Connection.ProcessSA_DB.LOOP_TASK_SCHEDULE.Where(X => X.ID_LOOP_TASK == Id).ToList(); foreach (Data.LOOP_TASK_SCHEDULE lts in ltsData) { LoopTaskSchedule schedule = new LoopTaskSchedule((int)lts.ID); ltsList.Add(schedule); } return(ltsList); }
public List <string> GetScheduleDistinct(bool getDayOfWeek) { List <Data.LOOP_TASK_SCHEDULE> ltsData = Connection.ProcessSA_DB.LOOP_TASK_SCHEDULE.Where(X => X.ID_LOOP_TASK == Id).ToList(); List <string> list = new List <string>(); foreach (Data.LOOP_TASK_SCHEDULE lts in ltsData) { LoopTaskSchedule schedule = new LoopTaskSchedule((int)lts.ID); if (getDayOfWeek) { list.Add(schedule.DayOfWeek.ToString()); } else { list.Add(schedule.NumberOfWeek.ToString()); } } return(list.Distinct().ToList()); }