public static TaskScheduleObjectCollection DataTableToCollection(DataTable taskSchedules) { TaskScheduleObjectCollection objectsTotal; TaskScheduleObjectCollection objects = new TaskScheduleObjectCollection(); try { IEnumerator enumerator = null; try { enumerator = taskSchedules.Rows.GetEnumerator(); while (enumerator.MoveNext()) { DataRow current = (DataRow)enumerator.Current; objects.Add(TaskScheduleRowToObject(current)); } } finally { if (enumerator is IDisposable) { (enumerator as IDisposable).Dispose(); } } objectsTotal = objects; } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } return(objectsTotal); }
public TaskScheduleObjectCollection GetActive() { TaskScheduleObjectCollection taskSchedules = new TaskScheduleObjectCollection(); foreach (TaskScheduleObject schedule in this) { if (schedule.State != PROF_IT.Common.Enumerations.ObjectState.Deleted) { taskSchedules.Add(schedule); } } return(taskSchedules); }