/// <summary> /// Изменение статуса плана /// </summary> private void CleanStatus() { PlannerSorting.SearchElement(Tree, SelectedTask.Id).TaskStatus = State.Queue; using (PlannerContext db = new PlannerContext()) { db.PlanDB.Find(SelectedTask.Id).TaskStatus = State.Queue; } }
private void Add_Perfomed_But_Click(object sender, RoutedEventArgs e) { if (SelectedTask != null) { Check(); using (PlannerContext db = new PlannerContext()) { db.PlanDB.Find(SelectedTask.Id).TaskStatus = State.Perfomed; } PlannerSorting.SearchElement(Tree, SelectedTask.Id).TaskStatus = State.Perfomed; to_do_list.Perfomed.Add(SelectedTask); } }
/// <summary> /// Удаление плана включая все его дочерние элементы /// </summary> /// <param name="children"></param> private void RemovePlanDB() { using (PlannerContext db = new PlannerContext()) { List <Guid> IdList = PlannerSorting.ReturnIdChildrenPlans(SelectedPlanner); foreach (Guid Id in IdList) { db.PlanDB.Remove(db.PlanDB.Find(Id)); } db.PlanDB.Remove(db.PlanDB.Find(SelectedPlanner.Id)); db.SaveChanges(); } }
private void Remove_Plan_Click(object sender, RoutedEventArgs e) { if (SelectedPlanner != null) { to_do_list.RemoveTasks(SelectedPlanner); RemovePlanDB(); SelectedPlanner.Children.Clear(); if (SelectedPlanner.ParentId == Guid.Empty) { Tree.Remove(SelectedPlanner); } else { PlannerSorting.SearchParent(Tree, SelectedPlanner).Children.Remove(SelectedPlanner); } } }
private void AssignmentValues() { using (PlannerContext db = new PlannerContext()) { Tree = PlannerSorting.ConvertToObservableC(db.PlanDB); Tree = PlannerSorting.SortingPlans(Tree); Plan_TV.ItemsSource = Tree; to_do_list = new To_do_list(Tree); Queue_TV.ItemsSource = to_do_list.Queue; InProgress_TV.ItemsSource = to_do_list.InProgress; Waiting_TV.ItemsSource = to_do_list.Waiting; Perfomed_TV.ItemsSource = to_do_list.Perfomed; DiaryRecords = PlannerSorting.ConvertToObservableC(db.DiaryDB); Table_TV.ItemsSource = DiaryRecords; } }