private void Btn_CrtTsk_Click(object sender, RoutedEventArgs e) { Project selectedProject = (from project in App._projects where project.ProjectId == projectId select project).FirstOrDefault() as Project; var toDoTasks = from t in selectedProject.tasks where t.Status == "To Do" select t; var inProgressTasks = from t in selectedProject.tasks where t.Status == "In Progress" select t; Task newTask = new Task { TaskId = Math.Abs(Guid.NewGuid().GetHashCode()).ToString(), Title = "Edit...", Description = "Edit...", TaskStartDate = DateTime.Now, TaskDeadline = DateTime.Now, AddtnInfo = "Edit...", Status = "To DO" /* Title = Tbx_title.Text, * Description = Tbx_Description.Text, * Priority = CoBox_TaskPrioprity.SelectionBoxItem as String, * Status = CoBox_Status.SelectionBoxItem as String, * AddtnInfo = Tbx_Add_Info.Text, * DependentTaskID = CoBoxDepend_Tsk.SelectionBoxItem as String*/ }; selectedProject.tasks.Add(newTask); App._projects.Add(selectedProject); Lbx_Task.SelectedItem = newTask; Lbx_Task.ScrollIntoView(newTask); if (toDoTasks != null && toDoTasks.Count() >= Int32.Parse(selectedProject.ToDoLimit)) { MessageBox.Show("Number of allowed tasks in To do is exhausted.", "Project Management", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (inProgressTasks != null && inProgressTasks.Count() >= Int32.Parse(selectedProject.InProgressLimit)) { MessageBox.Show("Number of allowed tasks in In Progress is exhausted.", "Project Management", MessageBoxButton.OK, MessageBoxImage.Warning); return; } selectedProject.tasks.Add(newTask); var res = MessageBox.Show("Task created successfully! \n Do you want to create more tasks ?", "Project Management", MessageBoxButton.YesNo, MessageBoxImage.Question); if (res == MessageBoxResult.No) { Kanban kanban = new Kanban(selectedProject.ProjectId); kanban.Show(); this.Close(); } else { AddTask addTask = new AddTask(selectedProject.ProjectId); addTask.Show(); this.Close(); } }
private void AddTask_Click(object sender, RoutedEventArgs e) { Project projectdetails = (from s in App._projects where s.ProjectId == projId select s).FirstOrDefault() as Project; var toDoTasks = from t in projectdetails.tasks where t.Status == "To Do" select t; if (toDoTasks != null) { if (toDoTasks.Count() >= Int32.Parse(projectdetails.ToDoLimit)) { MessageBox.Show("Number of allowed tasks in To do is exhausted.", "Project Management", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } var goToAddTask = new AddTask(projId); goToAddTask.Show(); this.Close(); }
private void Edit_Click(object sender, RoutedEventArgs e) { Project selectedProject = (from p in App._projects where p.ProjectId == projId select p).FirstOrDefault() as Project; Task toEdit = new Task(); MenuItem menu = sender as MenuItem; if (menu.Name == "ToDoDelMenu") { toEdit = Lbx_ToDoTasks.SelectedItem as Task; var goToAddTask = new AddTask(projId); goToAddTask.Show(); this.Close(); } else if (menu.Name == "InProgDelMenu") { toEdit = Lbx_InProgressTasks.SelectedItem as Task; var goToAddTask = new AddTask(projId); goToAddTask.Show(); this.Close(); } else if (menu.Name == "TestDelMenu") { toEdit = Lbx_TestingTasks.SelectedItem as Task; var goToAddTask = new AddTask(projId); goToAddTask.Show(); this.Close(); } else if (menu.Name == "DoneDelMenu") { toEdit = Lbx_DoneTasks.SelectedItem as Task; var goToAddTask = new AddTask(projId); goToAddTask.Show(); this.Close(); } }