public void DeleteProject(ProjectView _proj) { //int selectedProject = GetClickedProjectId(); ConfirmWindow confirmWindow = new ConfirmWindow(); if (confirmWindow.ShowDialog() == true) { try { if (_proj.Id != 0) { services.Delete <ProjectView>(_proj.Id); MessageBox.Show("The project has been successfully deleted!"); dgProjects.ItemsSource = LoadProjectsGrid(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { } }
public void ApprovedReport(TaskView _task) { ConfirmWindow confirmWindow = new ConfirmWindow(); int selectedProject = GetClickedProjectId(); if (confirmWindow.ShowDialog() == true) { try { TaskView task = services.Get <TaskView>(_task.Id); ReportView _report = services.Get <ReportView>(_task.report_id); _report.status = TMS.Data.ReportStatus.Approved; services.Update <ReportView>(_report); ApproveView apprView = services.Get <ApproveView>(_task.approveId); apprView.isApproved = true; apprView.rootCase = "Approved"; apprView.reportId = _report.Id; services.Update <ApproveView>(apprView); if (chkOpen.IsChecked == true) { dgTasks.ItemsSource = GetTasksWithReports().Where(x => x.projectId == selectedProject && x.status == TMS.Data.ReportStatus.Open); } if (chkAproved.IsChecked == true) { dgTasks.ItemsSource = GetTasksWithReports().Where(x => x.projectId == selectedProject && x.status == TMS.Data.ReportStatus.Approved); } if (chkDecline.IsChecked == true) { dgTasks.ItemsSource = GetTasksWithReports().Where(x => x.projectId == selectedProject && x.status == TMS.Data.ReportStatus.Declined); } MessageBox.Show("The report has been successfully approved!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { } }
public void DeleteTask(TaskView _task) { int selectedProject = GetClickedProjectId(); ConfirmWindow confirmWindow = new ConfirmWindow(); if (confirmWindow.ShowDialog() == true) { try { if (_task.Id != 0) { if (chkWithRep.IsChecked == true) { services.Delete <TaskView>(_task.Id); MessageBox.Show("The task has been successfully deleted!"); dgTasks.ItemsSource = GetTasksWithReports().Where(x => x.projectId == selectedProject); chkWithRep.IsChecked = true; } if (chkWithRep.IsChecked == false) { services.Delete <TaskView>(_task.Id); MessageBox.Show("The task has been successfully deleted!"); dgTasks.ItemsSource = GetAllTasks().Where(x => x.projectId == selectedProject); chkWithRep.IsChecked = false; } } else { MessageBox.Show("Error"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { } }