Beispiel #1
0
        public TaskModelBL GetById(int id)
        {
            bool editGrant = false;

            if (!CheckAccess(id, out MyTask task))
            {
                return(null);
            }

            string userId = HttpContextExtensions.GetUserId(_httpcontext);

            var grantModel = context.TaskEditGrants.GetAll().FirstOrDefault(gr => gr.TaskId == task.Id && gr.FriendId == userId);

            var isFriendTask = (context.UsersInTasks.GetAll().Where(ut => ut.MyTaskId == task.Id && ut.UserId == userId && ut.UserInTaskTypeCode == 2).Count() > 0);

            if (grantModel != null)
            {
                editGrant = grantModel.IsGranted;
            }
            else
            {
                if (isFriendTask)
                {
                    editGrant = false;
                }
                else
                {
                    editGrant = true;
                }
            }

            RepeatingTask repeatingTask = context.RepeatingTasks.GetById(id);

            return(new TaskModelBL
            {
                Id = task.Id,
                Name = task.Name,
                StartDate = task.StartDate,
                TargetDate = task.TargetDate,
                EndDate = task.EndDate,
                Details = task.Details,
                IsRepeating = task.IsRepeating,
                TaskСategoryId = task.TaskСategoryId,
                TaskPriorityId = task.TaskPriorityId,
                ParentTaskId = task.ParentTaskId,
                Multiplier = repeatingTask?.Multiplier,
                PeriodCode = repeatingTask?.PeriodCode,
                UserIds = context.UsersInTasks.GetAll().Where(ut => ut.MyTaskId == task.Id && ut.UserInTaskTypeCode == 2).Select(ut => ut.UserId).ToList(),
                files = _fileService.GetAll(id).ToList(),
                EditGrant = editGrant,
                UserId = userId,
                IsFriendTask = isFriendTask
            });
        }
Beispiel #2
0
        public void CheckReOccuring()
        {
            ToDoList toDoList = new ToDoList();

            ToDoListItem toDoListItem = new ToDoListItem();

            RepeatingTask repeatingTask = new RepeatingTask();

            repeatingTask.IsReOccuring = true;

            toDoList.AddReOccuringTask(toDoListItem, repeatingTask);

            var result = toDoList.GetAllTasks().Count();

            Assert.True(result == 1);
        }
        /// <summary>
        /// View the details about all the repeating tasks of the specified user.
        /// </summary>
        /// <param name="userId">User id of the task.</param>
        /// <returns>A list of repeating tasks filled with values from the database.</returns>
        public List <RepeatingTask> Details(uint?userId)
        {
            List <RepeatingTask> repeatingTasks = new List <RepeatingTask>();

            if (userId == null)
            {
                repeatingTasks = null;
            }
            else
            {
                try
                {
                    using (DataConnection db = new DataConnection())
                    {
                        List <RepeatingTask> query = (from repeatingTask in db.RepeatingTask
                                                      where repeatingTask.UserId == userId
                                                      select repeatingTask).ToList();

                        if (query != null)
                        {
                            foreach (RepeatingTask _repeatingTask in query)
                            {
                                repeatingTask = new RepeatingTask()
                                {
                                    Id       = _repeatingTask.Id,
                                    UserId   = _repeatingTask.UserId,
                                    Title    = _repeatingTask.Title,
                                    Day      = _repeatingTask.Day,
                                    Time     = _repeatingTask.Time,
                                    Duration = _repeatingTask.Duration,
                                    Label    = _repeatingTask.Label
                                };

                                repeatingTasks.Add(repeatingTask);
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    repeatingTasks = null;
                }
            }

            return(repeatingTasks);
        }
Beispiel #4
0
        /// <summary>
        /// Edit an existing repeating task.
        /// </summary>
        /// <param name="model">Repeating task details to edit.</param>
        /// <returns>0 on failure, 1 on success, 2 on unexpected database error.</returns>
        public int Edit(RepeatingTask model)
        {
            int result = 0;

            try
            {
                using (SQLiteConnection db = new SQLiteConnection(Program.STARTUP_PATH))
                {
                    result = db.Update(model);
                }
            }
            catch (Exception)
            {
                result = 2;
            }

            return(result);
        }
        /// <summary>
        /// Creates a new repeating task.
        /// </summary>
        /// <param name="model">Repeating task details to create.</param>
        /// <returns>0 on failure, 1 on success, 2 on unexpected database error.</returns>
        public int Create(RepeatingTask model)
        {
            int result = 0;

            try
            {
                using (TaskDatabase db = new TaskDatabase())
                {
                    result = db.Insert(model);
                }
            }
            catch (Exception)
            {
                result = 2;
            }

            return(result);
        }
        /// <summary>
        /// Creates a new repeating task.
        /// </summary>
        /// <param name="model">Repeating task details to create.</param>
        /// <returns>0 on failure, 1 on success, 2 on unexpected database error.</returns>
        public int Create(RepeatingTask model)
        {
            int result = 0;

            try
            {
                using (SQLiteConnection db = new SQLiteConnection(Program.DB_PATH))
                {
                    result = db.Insert(model);
                }
            }
            catch (Exception)
            {
                result = 2;
            }

            return(result);
        }
        /// <summary>
        /// Creates a new repeating task.
        /// </summary>
        /// <param name="model">Repeating task details to create.</param>
        /// <returns>0 on failure, 1 on success, 2 on unexpected database error.</returns>
        public int Create(RepeatingTask model)
        {
            int result = 0;

            try
            {
                using (DataConnection db = new DataConnection())
                {
                    result = db.Insert(model);
                }
            }
            catch (Exception)
            {
                result = 2;
            }

            return(result);
        }
Beispiel #8
0
        public void RepeatCompleted()
        {
            RepeatingTask repeatingTask = new RepeatingTask();

            ToDoListItem toDoListItem = new ToDoListItem();

            CompletedTasksList completedTasksList = new CompletedTasksList();

            toDoListItem.IsCompleted = true;

            repeatingTask.EndTime = DateTime.Today.AddDays(+2);

            completedTasksList.RepeatCompleted(toDoListItem, repeatingTask);

            var result = completedTasksList.GetAllCompleted().Count();

            Assert.False(result == 0);
        }
 /// <summary>
 /// Initializes a new instance of the form EditTask class.
 /// </summary>
 /// <param name="shedule">Details of the shedule to edit.</param>
 /// <param name="model">Repeating task details to edit.</param>
 /// <param name="dateTime">DateTime to edit.</param>
 public EditTask(RepeatingTask model, DateTime dateTime)
 {
     InitializeComponent();
     this.dateTime           = dateTime;
     this.repeatingTaskModel = new RepeatingTask()
     {
         Id       = model.Id,
         Title    = model.Title,
         Day      = dateTime.ToString("dddd"),
         Time     = model.Time,
         Duration = model.Duration,
         Label    = model.Label
     };
     taskController          = new TaskController();
     repeatingTaskController = new RepeatingTaskController();
     txtTitle.Text           = model.Title;
     nudDuration.Value       = model.Duration;
     txtLabel.Text           = model.Label;
     cbRepeating.Checked     = true;
     result = 0;
 }
        /// <summary>
        /// View the details about all the repeating tasks of the specified user.
        /// </summary>
        /// <param name="userId">User id of the task.</param>
        /// <returns>A list of repeating tasks filled with values from the database.</returns>
        public List <RepeatingTask> Details()
        {
            List <RepeatingTask> repeatingTasks = new List <RepeatingTask>();

            try
            {
                using (SQLiteConnection db = new SQLiteConnection(Program.DB_PATH))
                {
                    List <RepeatingTask> query = (from repeatingTask in db.Table <RepeatingTask>()
                                                  select repeatingTask).ToList();

                    if (query != null)
                    {
                        foreach (RepeatingTask _repeatingTask in query)
                        {
                            repeatingTask = new RepeatingTask()
                            {
                                Id       = _repeatingTask.Id,
                                Title    = _repeatingTask.Title,
                                Day      = _repeatingTask.Day,
                                Time     = _repeatingTask.Time,
                                Duration = _repeatingTask.Duration,
                                Label    = _repeatingTask.Label
                            };

                            repeatingTasks.Add(repeatingTask);
                        }
                    }
                }
            }
            catch (Exception)
            {
                repeatingTasks = null;
            }

            return(repeatingTasks);
        }
        /// <summary>
        /// Checks if an existing repeating task exceeds another repeating task or task.
        /// </summary>
        /// <param name="model">Repeating task details to check on.</param>
        /// <returns>0 on nothing exceeds, 3 on DateTime exceeds, 2 on unexpected database error.</returns>
        public int Exceeds(RepeatingTask model)
        {
            int result = 0;

            int[]                totalrecords   = new int[4];
            TaskController       taskController = new TaskController();
            List <RepeatingTask> repeatingTasks = new List <RepeatingTask>();
            List <Task>          tasks          = new List <Task>();

            if (model != null)
            {
                repeatingTasks = Details(model.UserId);
                tasks          = taskController.Details(model.UserId);
            }

            try
            {
                using (DataConnection db = new DataConnection())
                {
                    List <RepeatingTask> repeatingTaskQuery = (from repeatingTask in repeatingTasks
                                                               where repeatingTask.Day == model.Day && repeatingTask.Id != model.Id
                                                               select repeatingTask).ToList();

                    List <RepeatingTask> repeatingTaskDate = (from repeatingTask in repeatingTaskQuery
                                                              where repeatingTask.Time.Add(new TimeSpan(repeatingTask.Duration - 1, 0, 0)) < model.Time
                                                              select repeatingTask).ToList();

                    totalrecords[0] = repeatingTaskDate.Count;

                    repeatingTaskDate = (from repeatingTask in repeatingTaskQuery
                                         where repeatingTask.Time > new TimeSpan(model.Time.Hours + model.Duration - 1, 0, 0)
                                         select repeatingTask).ToList();

                    totalrecords[1] = repeatingTaskDate.Count;

                    if (repeatingTaskQuery.Count != totalrecords[0] + totalrecords[1])
                    {
                        result = 3;
                    }
                    else
                    {
                        List <Task> taskQuery = (from task in tasks
                                                 where task.Date.ToString("dddd") == model.Day
                                                 select task).ToList();

                        List <Task> taskDate = (from task in taskQuery
                                                where task.Date.AddHours(task.Duration - 1) < new DateTime(task.Date.Year, task.Date.Month, task.Date.Day, 0, 0, 0).Add(model.Time)
                                                select task).ToList();

                        totalrecords[2] = taskDate.Count;

                        taskDate = (from task in taskQuery
                                    where task.Date > new DateTime(task.Date.Year, task.Date.Month, task.Date.Day, 0, 0, 0).Add(model.Time).AddHours(model.Duration - 1)
                                    select task).ToList();

                        totalrecords[3] = taskDate.Count;

                        if (taskQuery.Count != totalrecords[2] + totalrecords[3])
                        {
                            result = 3;
                        }
                    }
                }
            }
            catch (Exception)
            {
                result = 2;
            }

            return(result);
        }
        /// <summary>
        /// Occurs when the Button control is clicked.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnEditTask_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtTitle.Text))
            {
                txtTitle.Text = "[Geen titel]";
            }

            if (Convert.ToByte(nudDuration.Value) == 0)
            {
                nudDuration.Value = 1;
            }

            if (Convert.ToByte(nudDuration.Value) + dateTime.Hour > 24)
            {
                nudDuration.Value = 24 - dateTime.Hour;
            }

            if (txtTitle.Text.Length > 64)
            {
                MessageBox.Show("Titel is te lang.");
            }
            else if (txtLabel.Text.Length > 64)
            {
                MessageBox.Show("Label is te lang.");
            }
            else
            {
                if (cbRepeating.Checked == false)
                {
                    if (taskModel != null)
                    {
                        this.taskModel.Duration = Convert.ToByte(nudDuration.Value);
                        this.taskModel.Title    = txtTitle.Text;
                        this.taskModel.Label    = txtLabel.Text;
                        result = taskController.Exceeds(taskModel);

                        if (result == 0)
                        {
                            result = taskController.Edit(taskModel);
                        }
                    }
                    else
                    {
                        Task task = new Task()
                        {
                            Title    = txtTitle.Text,
                            Date     = dateTime,
                            Duration = Convert.ToByte(nudDuration.Value),
                            Label    = txtLabel.Text
                        };
                        repeatingTaskController.Delete(repeatingTaskModel);
                        result = taskController.Exceeds(task);

                        if (result == 0)
                        {
                            result = taskController.Create(task);
                        }
                        else
                        {
                            repeatingTaskController.Create(repeatingTaskModel);
                        }
                    }
                }
                else
                {
                    if (repeatingTaskModel != null)
                    {
                        this.repeatingTaskModel.Duration = Convert.ToByte(nudDuration.Value);
                        this.repeatingTaskModel.Title    = txtTitle.Text;
                        this.repeatingTaskModel.Label    = txtLabel.Text;
                        this.repeatingTaskModel.Time     = dateTime.TimeOfDay;
                        result = repeatingTaskController.Exceeds(repeatingTaskModel);

                        if (result == 0)
                        {
                            result = repeatingTaskController.Edit(repeatingTaskModel);
                        }
                    }
                    else
                    {
                        RepeatingTask repeatingTask = new RepeatingTask()
                        {
                            Title    = txtTitle.Text,
                            Day      = dateTime.ToString("dddd"),
                            Time     = dateTime.TimeOfDay,
                            Duration = Convert.ToByte(nudDuration.Value),
                            Label    = txtLabel.Text
                        };
                        taskController.Delete(taskModel);
                        result = repeatingTaskController.Exceeds(repeatingTask);

                        if (result == 0)
                        {
                            result = repeatingTaskController.Create(repeatingTask);
                        }
                        else
                        {
                            taskController.Create(taskModel);
                        }
                    }
                }

                if (result == 1)
                {
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Kan de taak niet toevoegen. De tijd overlapt over een andere taak.");
                }
            }
        }
        /// <summary>
        /// Occurs when the Button control is clicked. Adds a new Task or RepeatingTask.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnAddTask_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtTitle.Text))
            {
                txtTitle.Text = "[Geen titel]";
            }

            if (Convert.ToByte(nudDuration.Value) == 0)
            {
                nudDuration.Value = 1;
            }

            if (txtTitle.Text.Length > 64)
            {
                MessageBox.Show("Titel is te lang.");
            }
            else if (txtLabel.Text.Length > 64)
            {
                MessageBox.Show("Label is te lang.");
            }
            else
            {
                if (cbRepeating.Checked == false)
                {
                    task = new Task()
                    {
                        UserId   = userId,
                        Title    = txtTitle.Text,
                        Duration = Convert.ToByte(nudDuration.Value),
                        Date     = Convert.ToDateTime(dateTime),
                        Label    = txtLabel.Text,
                    };

                    result = taskController.Exceeds(task);

                    if (result == 0)
                    {
                        result = taskController.Create(task);
                    }
                }
                else
                {
                    repeatingTask = new RepeatingTask()
                    {
                        UserId   = userId,
                        Title    = txtTitle.Text,
                        Day      = dateTime.ToString("dddd"),
                        Time     = dateTime.TimeOfDay,
                        Duration = Convert.ToByte(nudDuration.Value),
                        Label    = txtLabel.Text
                    };

                    result = repeatingTaskController.Exceeds(repeatingTask);

                    if (result == 0)
                    {
                        result = repeatingTaskController.Create(repeatingTask);
                    }
                }

                if (result == 1)
                {
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Kan de taak niet toevoegen. De tijd overlapt over een andere taak.");
                }
            }
        }
Beispiel #14
0
        public async Task <bool> Update(int id, TaskModelBL model)
        {
            if (model == null)
            {
                return(false);
            }

            if (!CheckAccess(id, out MyTask task))
            {
                return(false);
            }

            task.Name           = model.Name;
            task.TargetDate     = model.TargetDate;
            task.Details        = model.Details;
            task.IsRepeating    = model.IsRepeating;
            task.TaskСategoryId = model.TaskСategoryId;
            task.TaskPriorityId = model.TaskPriorityId;
            task.EndDate        = model.EndDate;
            task.ParentTaskId   = model.ParentTaskId;
            context.MyTasks.Update(task);

            if (model.Friends != null)
            {
                foreach (var friend in model.Friends)
                {
                    UsersInTask member = new UsersInTask
                    {
                        MyTaskId           = model.Id,
                        UserId             = friend.UserId,
                        UserInTaskTypeCode = 2
                    };

                    if (context.TaskTrackerUser.GetById(member.UserId) != null)
                    {
                        context.UsersInTasks.Create(member);
                    }
                    else
                    {
                        TaskTrackerUser user = new TaskTrackerUser {
                            UserId = member.UserId
                        };
                        context.TaskTrackerUser.Create(user);
                        if (!context.UsersInTasks.GetAll().Any(ut => ut.UserId == member.UserId && ut.UserInTaskTypeCode == 2))
                        {
                            context.UsersInTasks.Create(member);
                        }
                    }
                }
            }

            RepeatingTask repeatingTask = context.RepeatingTasks.GetById(id);

            if (repeatingTask != null && model.IsRepeating == true)
            {
                repeatingTask.Multiplier = (int)model.Multiplier;
                repeatingTask.PeriodCode = (int)model.PeriodCode;
                context.RepeatingTasks.Update(repeatingTask);
            }
            else if (repeatingTask != null && model.IsRepeating == false)
            {
                context.RepeatingTasks.Delete(repeatingTask);
            }
            else if (repeatingTask == null && model.IsRepeating == true &&
                     model.Multiplier != null && model.PeriodCode != null)
            {
                repeatingTask = new RepeatingTask
                {
                    Id         = model.Id,
                    Multiplier = (int)model.Multiplier,
                    PeriodCode = (int)model.PeriodCode
                };
                context.RepeatingTasks.Create(repeatingTask);
            }

            context.SaveChanges();

            var list = context.TaskFiles.GetAll().Where(tf => tf.TaskId == id).Select(tf => tf.FileId).ToList();

            foreach (int FileId in list)
            {
                if (!model.files.Any(fl => fl.Id == FileId))
                {
                    _fileService.Delete(FileId);
                }
            }

            foreach (FileModelBL fl in model.files.Where(fl => !list.Any(fileid => fileid == fl.Id)))
            {
                _fileService.Create(id, fl);
            }

            if (model.Friends != null)
            {
                foreach (var _friend in model.Friends)
                {
                    await _mailService.SendAsync(new MailModelBL()
                    {
                        To      = _friend.Friend.Email,
                        Subject = "Назначение соисполнителем на задачу",
                        Body    = $"Вы назначены соисполнителем на задачу <br> для просмотра перейдите по ссылке: <br> <a href=\"https://localhost:44347/MyTask/Update/{model.Id}\">Перейти...</a>"
                    });
                }
            }

            return(true);
        }
Beispiel #15
0
        public bool Create(TaskModelBL model)
        {
            if (model == null)
            {
                return(false);
            }

            string UserId = HttpContextExtensions.GetUserId(_httpcontext);

            var user = context.TaskTrackerUser.GetAll().FirstOrDefault(x => x.UserId == UserId);

            if (user == null)
            {
                user = new TaskTrackerUser()
                {
                    UserId = UserId
                };
                context.TaskTrackerUser.Create(user);
            }

            MyTask task = new MyTask
            {
                Name           = model.Name,
                StartDate      = DateTime.Now,
                TargetDate     = model.TargetDate,
                Details        = model.Details,
                IsRepeating    = model.IsRepeating,
                TaskСategoryId = model.TaskСategoryId,
                TaskPriorityId = model.TaskPriorityId,
                ParentTaskId   = model.ParentTaskId
            };

            context.MyTasks.Create(task);

            var UserInTask = new UsersInTask()
            {
                Task               = task,
                UserId             = UserId,
                TaskTrackerUser    = user,
                UserInTaskTypeCode = 1
            };

            context.UsersInTasks.Create(UserInTask);

            if (model.Multiplier != null && model.PeriodCode != null)
            {
                RepeatingTask repeatingTask = new RepeatingTask
                {
                    Task       = task,
                    PeriodCode = (int)model.PeriodCode,
                    Multiplier = (int)model.Multiplier
                };
                context.RepeatingTasks.Create(repeatingTask);
            }

            context.SaveChanges();

            foreach (FileModelBL fl in model.files)
            {
                _fileService.Create(task.Id, fl);
            }

            return(true);
        }
        /// <summary>
        /// Occurs when the user double-clicks anywhere in a cell. Gets the clicked cell position and chooses depending on the value of the cell to display the AddTask form or EditTask form.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DataGridViewCellEventArgs"/> instance containing the event data.</param>
        private void dgvShedule_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            //checks if it didn't touched the headers
            if (e.RowIndex > -1 && e.ColumnIndex > -1)
            {
                string cellContent = "";
                cellPos = new int[] { e.RowIndex, e.ColumnIndex }; //gets the position of the selected cell

                if (dgvShedule.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
                {
                    //if the cell value has content
                    cellContent = dgvShedule.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                }
                else if (!dgvShedule.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor.IsEmpty)
                {
                    //if the cell value is empty, but is different colored
                    //look up to most upper cell with value
                    int i = 0;

                    do
                    {
                        if (dgvShedule.Rows[e.RowIndex - i].Cells[e.ColumnIndex].Value != null)
                        {
                            cellContent = dgvShedule.Rows[e.RowIndex - i].Cells[e.ColumnIndex].Value.ToString();
                            cellPos     = new int[] { e.RowIndex - i, e.ColumnIndex }; //gets the position of the selected cell
                        }
                        i++;
                    }while (dgvShedule.Rows[e.RowIndex - i + 1].Cells[e.ColumnIndex].Value == null);
                }
                else
                {
                    //the cell is empty.
                    cellContent = null;
                }

                if (string.IsNullOrEmpty(cellContent))
                {
                    if (selectedUser.Id == currentUser.Id)
                    {
                        AddTask addTask = new AddTask(Convert.ToDateTime(dgvShedule.Columns[cellPos[1]].HeaderText + " " + dgvShedule.Rows[cellPos[0]].HeaderCell.Value.ToString()), currentUser.Id);
                        addTask.ShowDialog();
                        LoadToGrid(typeof(Task));
                    }
                    else
                    {
                        MessageBox.Show("Kan taken voor andere gebruikers niet toevoegen/wijzigen.");
                    }
                }
                else
                {
                    Task taskQuery = (from task in tasks
                                      where task.Date == Convert.ToDateTime(dgvShedule.Columns[cellPos[1]].HeaderText + " " + dgvShedule.Rows[cellPos[0]].HeaderCell.Value.ToString())
                                      select task).FirstOrDefault();

                    RepeatingTask repeatingTaskQuery = (from repeatingTask in repeatingTasks
                                                        where repeatingTask.Day == Convert.ToDateTime(dgvShedule.Columns[cellPos[1]].HeaderText).ToString("dddd") && repeatingTask.Time.ToString(@"h\:mm") == dgvShedule.Rows[cellPos[0]].HeaderCell.Value.ToString()
                                                        select repeatingTask).FirstOrDefault();

                    if (selectedUser.Id == currentUser.Id)
                    {
                        if (taskQuery != null)
                        {
                            EditTask editTask = new EditTask(new Task()
                            {
                                Id = taskQuery.Id, UserId = currentUser.Id, Title = taskQuery.Title, Duration = taskQuery.Duration, Label = taskQuery.Label
                            }, Convert.ToDateTime(dgvShedule.Columns[cellPos[1]].HeaderText + " " + dgvShedule.Rows[cellPos[0]].HeaderCell.Value.ToString()));
                            editTask.ShowDialog();
                            LoadToGrid(typeof(Task));
                        }
                        else if (repeatingTaskQuery != null)
                        {
                            EditTask editTask = new EditTask(new RepeatingTask()
                            {
                                Id = repeatingTaskQuery.Id, UserId = currentUser.Id, Title = repeatingTaskQuery.Title, Duration = repeatingTaskQuery.Duration, Label = repeatingTaskQuery.Label
                            }, Convert.ToDateTime(dgvShedule.Columns[cellPos[1]].HeaderText + " " + dgvShedule.Rows[cellPos[0]].HeaderCell.Value.ToString()));
                            editTask.ShowDialog();
                            LoadToGrid(typeof(Task));
                        }
                        else
                        {
                            MessageBox.Show("Kon de taak niet ophalen.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Kan taken voor andere gebruikers niet toevoegen/wijzigen.");
                    }
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the TaskController class.
 /// </summary>
 public RepeatingTaskController()
 {
     repeatingTask = null;
 }