Beispiel #1
0
        public void Synchronize()
        {
            Tasks <string> systemUnderTest = new Tasks <string>();

            systemUnderTest.Add("first");
            Assert.AreEqual("first", systemUnderTest.GetNext());

            List <string> obtained = new List <string>();
            Thread        consumer = new Thread(() =>
            {
                while (true)
                {
                    string value = systemUnderTest.GetNext();
                    if (value == null)
                    {
                        return;
                    }
                    obtained.Add(value);
                    systemUnderTest.Done();
                }
            });

            consumer.Start();
            Assert.IsTrue(consumer.IsAlive);
            Assert.AreEqual(0, obtained.Count);
            systemUnderTest.Add("second");
            Thread.Sleep(50);
            Assert.AreEqual("second", obtained[0]);
            Assert.IsTrue(consumer.IsAlive);
            systemUnderTest.Done();
            Thread.Sleep(50);
            Assert.IsFalse(consumer.IsAlive);
        }
Beispiel #2
0
        /// <summary>
        /// This method helps to generate tasks for performing delete duplicate documents from vault and search sub-system
        /// </summary>
        private void GeneratetasksForDeleteOperation(IEnumerable <DocumentHashMapEntity> lsDocumentHash,
                                                     List <string> lsdupDoc)
        {
            var dupDocToDelete = (from docHash in lsDocumentHash
                                  where lsdupDoc.Contains(docHash.DocumentReferenceId + docHash.CollectionId)
                                  select docHash).GroupBy(d => d.CollectionId);

            if (dupDocToDelete != null && dupDocToDelete.Any())
            {
                foreach (var docGroup in dupDocToDelete)
                {
                    var duplicateBatches = docGroup.Batch(100);
                    foreach (var batch in duplicateBatches)
                    {
                        _task = new DeduplicationJobTaskBEO {
                            IsDelete = true
                        };
                        _taskNumber++;
                        _task.TaskNumber   = _taskNumber;
                        _task.MatterId     = _matterId;
                        _task.CollectionId = docGroup.Key.ToString();
                        _task.DeleteDocumentList.AddRange(batch.Select(d => d.DocumentReferenceId));
                        //_task.DocumentReferenceId = documentHash.DocumentReferenceId;
                        //_task.HashValue = documentHash.HashValue;
                        _task.TaskComplete = false;
                        //_task.TaskPercent = 100.0 / lsdupDoc.Count;
                        _task.TaskKey = string.Format("Task # {0} - JobRunId : {1}", _task.TaskNumber, _jobrunId);
                        _tasks.Add(_task);
                    }
                }
            }

            _tasks.SafeForEach(t => t.TaskPercent = (100.0 / _tasks.Count));

            var nonDupDocs = (from docHash in lsDocumentHash
                              where !lsdupDoc.Contains(docHash.DocumentReferenceId + docHash.CollectionId)
                              select docHash);

            if (nonDupDocs != null && nonDupDocs.Any())
            {
                foreach (var docHash in nonDupDocs)
                {
                    OriginalDocumentsLogInfo(docHash.CollectionId, docHash.DocumentReferenceId);
                }
            }

            TaskCount        = _tasks.Count;
            _affectedDocList = _lsAffectedDocument;
            EvLog.WriteEntry(_jobid.ToString(CultureInfo.InvariantCulture), Constants.GenerateTaskDelete,
                             EventLogEntryType.Information);
        }
Beispiel #3
0
        public ITableTask AddTask(ITableFactory tableFactory, TaskText taskText)
        {
            var task = tableFactory.NewTask(this, taskText);

            Tasks.Add(task);
            return(task);
        }
Beispiel #4
0
 public void AddTask(Job job)
 {
     Tasks.Add(new VirtualTask(job.Name));
     Period       = job.Period;
     _hyperperiod = Extensions.LeastCommonMultiple(_hyperperiod, job.Period); // TODO undo this after benchmarking
     _chainLength++;
 }
 void IContact.AddTasks(IList <ITask> tasks)
 {
     foreach (var task in tasks.Cast <DemoTask>())
     {
         Tasks.Add(task);
     }
 }
Beispiel #6
0
        // add a new task to the list - returns number of tasks in the list
        public int AddNewTask(Task t)
        {
            Log.Instance.LogDebug(string.Format("TaskList.AddNewTask {0}", t));

            Tasks.Add(t);
            return(Tasks.Count);
        }
 private void Projects_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (e.NewItems != null)
     {
         foreach (ProjectViewModel newItem in e.NewItems)
         {
             foreach (TaskViewModel newTask in newItem.Tasks)
             {
                 Tasks.Add(newTask);
             }
             //Add listener for each item on PropertyChanged event
             newItem.PropertyChanged += this.OnItemPropertyChanged;
         }
     }
     if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
     {
         foreach (ProjectViewModel removingItem in e.OldItems)
         {
             //Remove listener
             removingItem.PropertyChanged -= this.OnItemPropertyChanged;
             foreach (TaskViewModel item in removingItem.Tasks)
             {
                 //remove projects task from the main task list
                 Tasks.Remove(item);
             }
         }
     }
 }
Beispiel #8
0
        public ThemedNumericEditBox()
        {
            ThemedEditBox.Decorate(this);
            MinWidth           = 0.0f;
            MaxWidth           = 105.0f;
            TextWidget.Padding = new Thickness(left: 5.0f, right: 5.0f, top: 2.0f, bottom: 2.0f);
            Layout             = new HBoxLayout();
            // Lime.EditorParams.MouseSelectionThreshold is 3 by default and this gesture should be recognized first.
            // To achieve that we're setting its drag threshold to 2.0f, add it to Editor.ClickableWidget (same collection
            // editor adds its widgets to) and do it in LateTasks.
            var dragGesture = new DragGesture(exclusive: true, dragThreshold: 2.0f);

            Updated += (delta) => {
                if (Editor.FocusableWidget.IsFocused())
                {
                    dragGesture.Cancel();
                }
                else if (IsMouseOverThisOrDescendant() || isDragging)
                {
                    WidgetContext.Current.MouseCursor = MouseCursor.SizeWE;
                }
            };
            LateTasks.Add(Task.Repeat(() => {
                dragGesture.Recognized += () => Tasks.Add(SpinByDragTask(dragGesture));
                Editor.ClickableWidget.Gestures.Insert(0, dragGesture);
                return(false);
            }));
        }
Beispiel #9
0
        public async Task <bool> _atualizaLista()
        {
            try
            {
                List <TaskModel> lt =
                    await api.GetAll <TaskModel>("/tasks");

                Tasks.Clear();
                foreach (TaskModel t in lt)
                {
                    Tasks.Add(t);
                }
                TaskModel t2 = new TaskModel();
                t2.name   = "Novo";
                t2.status = null;
                Tasks.Add(t2);
                OnPropertyChanged("Tasks");
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
 private void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     //if taskList was edit, then update it
     if (e.PropertyName == "TaskList")
     {
         ProjectViewModel collection = sender as ProjectViewModel;
         //add new tasks
         foreach (TaskViewModel t in collection.Tasks)
         {
             if (!Tasks.Contains(t))
             {
                 Tasks.Add(t);
             }
         }
         //remove deleted tasks
         for (int i = 0; i < Tasks.Count; i++)
         {
             ProjectViewModel curProject = Tasks[i].ViewModel;
             if (curProject.Equals(collection))
             {
                 if (!collection.Tasks.Contains(Tasks[i]))
                 {
                     Tasks.RemoveAt(i);
                 }
             }
         }
     }
 }
Beispiel #11
0
        /// <summary>
        /// Creates the task.
        /// </summary>
        /// <param name="taskName">Name of the task.</param>
        /// <returns></returns>
        public virtual LogTask CreateTask(string taskName)
        {
            LogTask task = new LogTask(taskName);

            Tasks.Add(task);
            return(task);
        }
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Tasks.Clear();
                var items = await ToDoDataStore.GetItemsAsync();

                foreach (var item in items)
                {
                    Tasks.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #13
0
        internal void LoadState(AfterburnFile file)
        {
            DisableCalculation();

            foreach (var task in file.Tasks)
            {
                var vm = new TaskViewModel
                {
                    Feature = task.Feature,
                    Name    = task.Name,
                    Hours   = task.Hours
                };

                Tasks.Add(vm);

                foreach (var update in task.Updates)
                {
                    vm.Updates.Add(new TaskUpdateViewModel
                    {
                        Date  = update.Date,
                        Hours = update.Hours
                    });
                }
            }
            AllowCalculation();
            CalculateTotals();
        }
 private void AddTask(TaskModel item)
 {
     if (!Tasks.Contains(item))
     {
         Tasks.Add(item);
     }
 }
Beispiel #15
0
    /// <summary>
    /// Schedules a delay.
    /// </summary>
    /// <param name="delay">The delay in milliseconds.</param>
    /// <returns>A <see cref="BaseRunner"/> ready to schedule tasks for execution.</returns>
    public BaseRunner Run(int delay)
    {
        var task = new TypedTask(delay);

        Tasks.Add(task);
        return(this);
    }
Beispiel #16
0
        /// <summary>
        /// Calls stored procedure to obtain list of alerts to be notified.
        /// </summary>
        /// <param name="toTime">Alerts scheduled till this time</param>
        /// <param name="fromTime">Alerts scheduled to run beginning this time</param>
        /// <returns>List of tasks</returns>
        internal Tasks<SearchAlertsTaskBEO> GetActiveAlerts(DateTime toTime, DateTime fromTime)
        {
            Tasks<SearchAlertsTaskBEO> tasks = new Tasks<SearchAlertsTaskBEO>();

            // create command object
            DbCommand dbCommand = AlertsDbManager.GetStoredProcCommand(Constants.STOREDPROCEDURE_GET_ALERTS_TOBE_NOTIFIED);

            // add in parameters
            // param - to time, alerts till what time to be retrieved.
            AlertsDbManager.AddInParameter(dbCommand, Constants.GA_TO_TIMESTAMP, DbType.DateTime, toTime);
            AlertsDbManager.AddInParameter(dbCommand, Constants.GA_FROM_TIMESTAMP, DbType.DateTime, fromTime);

            // call stored procedure
            DataSet dataset = AlertsDbManager.ExecuteDataSet(dbCommand);

            // Create tasks - each search alert to be notified is a task.
            // Get all Alerts and add them to tasks.
            if (dataset != null)
            {
                foreach (SearchAlertsTaskBEO tmpSearchAlertsTask in (from DataTable dataTable in dataset.Tables from DataRow dataRow in dataTable.Rows select dataRow).Select(ConvertToTask).Where(tmpSearchAlertsTask => tmpSearchAlertsTask != null))
                {
                    tasks.Add(tmpSearchAlertsTask);
                }
            }

            // return list of active alerts objects.
            return tasks;
        }
Beispiel #17
0
        public static void ReadTasks()
        {
            string queryString = "select task_id, task_text, day_of_app from tasks";

            using (NpgsqlConnection connection = new NpgsqlConnection(ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString))
            {
                NpgsqlCommand command = new NpgsqlCommand(queryString, connection);
                connection.Open();
                NpgsqlDataReader reader = command.ExecuteReader();
                try
                {
                    while (reader.Read())
                    {
                        Model.Task new_Task = new Model.Task
                        {
                            Task_id  = (int)reader[0],
                            Text     = reader[1].ToString(),
                            End_date = DateTime.Now,
                            App_date = (DateTime)reader[2]
                        };
                        Tasks.Add(new_Task);
                        new_Task = null;
                    }
                }
                finally { reader.Close(); }
            }
        }
 private void AddNoLock(params Task[] tasks)
 {
     foreach (var t in tasks)
     {
         Tasks.Add(t);
     }
 }
Beispiel #19
0
        public static void Start(WorkerTask task)
        {
            if (task != null)
            {
                Tasks.Add(task);
                UpdateMainFormTip();

                if (task.Status != TaskStatus.History)
                {
                    task.StatusChanged                  += Task_StatusChanged;
                    task.ImageReady                     += Task_ImageReady;
                    task.UploadStarted                  += Task_UploadStarted;
                    task.UploadProgressChanged          += Task_UploadProgressChanged;
                    task.UploadCompleted                += Task_UploadCompleted;
                    task.TaskCompleted                  += Task_TaskCompleted;
                    task.UploadersConfigWindowRequested += Task_UploadersConfigWindowRequested;
                }

                TaskListView.AddItem(task);

                TaskThumbnailPanel panel = TaskThumbnailView.AddPanel(task);

                if (Program.Settings.TaskViewMode == TaskViewMode.ThumbnailView)
                {
                    panel.UpdateThumbnail();
                }

                if (task.Status != TaskStatus.History)
                {
                    StartTasks();
                }
            }
        }
        private void OnAddTaskCommandExecute()
        {
            if (Body is null)
            {
                return;
            }
            if (Priority == null)
            {
                Priority = "Without";
            }
            if (TaskCategoryClass == null)
            {
                TaskCategoryClass = categoryManager.Create("Without", "White");
            }
            bool     CheckAlarm = false;
            DateTime dateTime   = new DateTime(Data.Year, Data.Month, Data.Day, Time.Hour, Time.Minute, Time.Second);

            taskManager.Add(taskManager.Create("", Body, DateTime.Now, dateTime, TaskCategoryClass, CheckAlarm, Priority));
            taskManager.Save();
            if (CheckTask == false)
            {
                Tasks.Add(taskManager.Create("", Body, DateTime.Now, dateTime, TaskCategoryClass, CheckAlarm, Priority));
            }
            Priority          = null;
            Data              = new DateTime();
            Time              = new DateTime();
            CheckAlarm        = false;
            TaskCategoryClass = null;
            Body              = null;
        }
Beispiel #21
0
        private void DetailTask_OnClick(object sender, RoutedEventArgs e)
        {
            if (Tasks.ToList().Exists((x => x.TaskName == ((Label)((Grid)((StackPanel)((Button)sender).Parent
                                                                          .GetParentObject()).Children[0]).Children[0])
                                       .Content.ToString())))
            {
                var temp = Tasks.SingleOrDefault(x => x.TaskName == ((Label)((Grid)((StackPanel)((Button)sender)
                                                                                    .Parent
                                                                                    .GetParentObject()).Children[0]).Children[0])
                                                 .Content.ToString());

                new DetailsView(ref temp).ShowDialog();
                Tasks.Remove(temp);
                Tasks.Add(temp);
            }
            else
            {
                var temp = TasksDone.SingleOrDefault(x => x.TaskName == ((Label)((Grid)((StackPanel)((Button)sender)
                                                                                        .Parent
                                                                                        .GetParentObject()).Children[0]).Children[0])
                                                     .Content.ToString());

                new DetailsView(ref temp).ShowDialog();
                TasksDone.Remove(temp);
                TasksDone.Add(temp);
            }
        }
Beispiel #22
0
        private void SetupApplication()
        {
            Tweets.Clear();
            Tasks.Clear();

            Tasks.Add(new UserTask {
                Title = "Timeline", Command = new DelegateCommand(GetTimeline)
            });
            Tasks.Add(new UserTask {
                Title = "Mentions", Command = new DelegateCommand(GetMentions)
            });
            Tasks.Add(new UserTask {
                Title = "Retweets", Command = new DelegateCommand(GetRetweets)
            });
            Tasks.Add(new UserTask {
                Title = "DMs", Command = new DelegateCommand(GetDirectMessages)
            });
            Tasks.Add(new UserTask {
                Title = "New Followers"
            });
            Tasks.Add(new UserTask {
                Title = "Lost Followers"
            });

            StartStreaming();
        }
        public List <Task> ExtractTasks(string line, Validations validations)
        {
            // Check whether the line starts opening/closing TASKS section
            // If yes, mark it exist
            TasksSection.MarkSection(line, Int16.Parse(validations.LineNumber));

            // Count TASK section
            TaskPair.CheckValidKeyword(line);

            // Extract Task data within TASK section
            if (TasksSection.ValidSectionPair[0] &&
                !TasksSection.ValidSectionPair[1])
            {
                Task task;

                // Check whether the reader goes within the TASK section
                CffTaskExtraction.MarkInsideTask(line, validations);

                task = CffTaskExtraction.ExtractTask(line, validations);
                if (task != null)
                {
                    Tasks.Add(task);
                }
            }

            return(Tasks);
        }
        public async Task <TaskResult> RunTaskAsync(string taskName)
        {
            context.Output
            .Append("Running Deploy-Task ", ConsoleColor.DarkCyan)
            .Append(taskName, ConsoleColor.Cyan)
            .Append(" on Agent ", ConsoleColor.DarkCyan)
            .Append(definition.Name, ConsoleColor.Cyan)
            .AppendLine("...", ConsoleColor.DarkCyan);

            var runner = new TaskRunner(messageClient, AgentSessionId);

            runner.OutputEvent += (o, e) => {
                context.Output.AppendRaw(e.Text);
            };

            Tasks.Add(runner);

            var result = await runner.Run(taskName);

            if (!result.Successful)
            {
                context.Output
                .AppendLine($"Deploy-Task '{taskName}' Failed!", ConsoleColor.Red)
                .AppendLine(result.Message, ConsoleColor.DarkYellow);
            }

            context.Output
            .Append("Deploy-Task ", ConsoleColor.DarkGreen)
            .Append(taskName, ConsoleColor.Green)
            .AppendLine(" completed successfully.", ConsoleColor.DarkGreen);

            return(result);
        }
Beispiel #25
0
        /// <summary>
        /// This bullet is fired from another bullet, initialize it from the node that fired it
        /// </summary>
        /// <param name="subNode">Sub node that defines this bullet</param>
        public void InitNode(BulletMLNode subNode)
        {
            Debug.Assert(null != subNode);

            //clear everything out
            Tasks.Clear();

            //Grab that top level node
            MyNode = subNode;

            //found a top num node, add a task for it
            BulletMLTask task = new BulletMLTask(subNode, null);

            //parse the nodes into the task list
            task.ParseTasks(this);

            //initialize all the tasks
            task.InitTask(this);

            Tasks.Add(task);

            //Check if we should change the start heading and speed to adjust for an initial velocity
            if (Vector2.Zero != InitialVelocity)
            {
                //now that the heading and speed have been set, adjust them according to the initial velocity.
                Vector2 final = (Direction.ToVector2() * Speed * Scale) + InitialVelocity;
                Direction = final.Angle();
                Speed     = final.Length() / Scale;
            }
        }
Beispiel #26
0
        private async Task test4()
        {
            List <Uri> urls = new List <Uri>()
            {
                new Uri("https://www.kenneth-truyers.net/2016/05/12/yield-return-in-c/"),
                new Uri("https://dailycaller.com/2019/11/02/nancy-pelosi-democratic-party-left-wing-election/"),
                new Uri("https://finance.yahoo.com/quote/SCOR?p=SCOR&.tsrc=fin-srch"),
                new Uri("https://weather.com/weather/hourbyhour/l/70db2a5645ebed723839fc9c8c84f0987938b3fa739ade5fd47d8ef3bfda4b0e")
            };

            List <Task <(string, int, long)> > Tasks = new List <Task <(string, int, long)> >();
            int index = 0;

            urls.ForEach(url => Tasks.Add(GetAsync(url, index++)));

            while (Tasks.Any())
            {
                Task <(string content, int index, long runtime)> completedTask = await Task.WhenAny(Tasks).ConfigureAwait(false);

                Log("---------------------------------------------------------------------------");
                Log($"[index: {completedTask.Result.index}][{urls[completedTask.Result.index]}] => [length: {completedTask.Result.content.Length:#,##0}] [runtime: {completedTask.Result.runtime:#,##0} ms]");
                //Log($"{completedTask.Result.content}");
                parseHREFs(completedTask.Result.content);
                Log("---------------------------------------------------------------------------");

                Tasks.Remove(completedTask);
            }
        }
Beispiel #27
0
        Widget CreateSpinButton(SpinButtonType type)
        {
            var button = new Widget {
                HitTestTarget = true,
                LayoutCell    = new LayoutCell {
                    StretchX = 0
                },
                MinWidth      = SpinButtonPresenter.ButtonWidth,
                PostPresenter = new SpinButtonPresenter(type)
            };

            button.Awoken += instance => {
                var dragGesture = new DragGesture();
                dragGesture.Recognized += () => Tasks.Add(SpinByDragTask(dragGesture));
                var clickGesture = new ClickGesture(() => {
                    var delta = (type == SpinButtonType.Additive ? 1 : -1) * Step;
                    if (Input.IsKeyPressed(Key.Shift))
                    {
                        delta *= 10f;
                    }
                    else if (Input.IsKeyPressed(Key.Control))
                    {
                        delta *= 0.1f;
                    }
                    if (!IsReadOnly)
                    {
                        Value += delta;
                    }
                });
                var gestures = ((Widget)instance).Gestures;
                gestures.Add(clickGesture);
                gestures.Add(dragGesture);
            };
            return(button);
        }
Beispiel #28
0
    public BaseRunner Run <T>(Action <T> action, T arg)
    {
        var task = new TypedTask(() => action(arg), RunType.And);

        Tasks.Add(task);
        return(this);
    }
        public void Add(TodoTask model)
        {
            int newId = Tasks.Max(t => t.TodoTaskID) + 1;

            model.TodoTaskID = newId;
            Tasks.Add(model);
        }
        private async TTask LoadTasksAsync(Project project)
        {
            Tasks.Clear();

            IEnumerable <Task> tasks = null;

            try
            {
                tasks = await _apiService.GetListAsync <Task>($"projects/{project.Id}/tasks");
            }
            catch (AccessTokenExpiredException)
            {
                // Ugly way of retrying after refreshing a token.
                try
                {
                    await _apiService.RefreshAccessTokenAsync();

                    tasks = await _apiService.GetListAsync <Task>($"projects/{project.Id}/tasks");
                }
                catch
                {
                    ApiService.RemoveTokenFromVault();
                    _navService.GoBack();
                    return;
                }
            }

            foreach (var task in tasks.OrderBy(t => t.Name))
            {
                Tasks.Add(task);
            }
        }
Beispiel #31
0
        /// <summary>
        /// Saves the new task to the collection.
        /// </summary>
        private async Task AddTask()
        {
            // Create new object
            TaskViewModel task = new TaskViewModel(_dialogService)
            {
                Name        = NewTask.Name,
                Description = "",
                Order       = Tasks.Count + 1,
                Subtasks    = new ObservableCollection <SubtaskViewModel>()
            };

            // Add item to database
            await _repo.AddTask(task, this.Id).ContinueWith(async p =>
            {
                task.Id = await p;
            });

            // Add item to collection
            Tasks.Add(task);

            // Set as the selected task
            SelectedTask = task;

            // Clear new task
            NewTask = new TaskViewModel(_dialogService);

            // Update UI
            UpdateProgress();
        }
Beispiel #32
0
        // Laden aller Tasks die einem User zugeordnet sind
        internal static Tasks LoadUserTasks(User u)
        {
            SqlCommand cmd = new SqlCommand("select t.TaskID, t.WorkPackageID, t.Name, t.CreatedDate, t.EndDate, t.Description  from UserTask as ut inner join Task as t on ut.TaskID = t.TaskID where Username = @username and t.status = '0'", Main.GetConnection());
            cmd.Parameters.Add(new SqlParameter("username", u.Username));
            SqlDataReader reader = cmd.ExecuteReader();
            Tasks userTasks = new Tasks();
            while (reader.Read()) {
                Task t = new Task();
                t.ID = reader.GetString(0);
                t.WorkPackageID = reader.GetString(1);
                t.Name = reader.GetString(2);
                t.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]);
                t.EndDate = Convert.ToDateTime(reader["EndDate"]);
                t.Description = reader.GetString(5);

                userTasks.Add(t);
            }
            return userTasks;
        }
Beispiel #33
0
 public Tasks loadWorkPackageTasks()
 {
     if (mID != "")
     {
         SqlCommand cmd = new SqlCommand("select t.Name, t.Description, t.CreatedDate, t.EndDate, t.TaskID, t.WorkpackageID, t.Status from Task as t where WorkpackageID = @id", Main.GetConnection());
         cmd.Parameters.Add(new SqlParameter("id", mID));
         SqlDataReader reader = cmd.ExecuteReader();
         Tasks ts = new Tasks();
         while (reader.Read())
         {
             Task t = new Task();
             t.Name = reader.GetString(0);
             t.Description = reader.GetString(1);
             t.ID = reader.GetString(4);
             t.WorkPackageID = reader.GetString(5);
             t.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]);
             t.EndDate = Convert.ToDateTime(reader["EndDate"]);
             t.Status = reader.GetString(6);
             ts.Add(t);
         }
         return ts;
     }
     else return null;
 }