private void EditReportBtn_Click(object sender, RoutedEventArgs e) { ReportViewModel reportVM = dataGrid.SelectedItem as ReportViewModel; AddReport editReport = new AddReport(libraryItems, libraryItems.First(i => i.Id == reportVM.LibraryId)); if (editReport.ShowDialog().Value) { LibraryViewModel model = editReport.SelectedItem; if (reportVM != null && model != null) { Report report = reportController.GetById(reportVM.Id); Library library = libraryController.GetById(model.Id); reportVM.LibraryId = library.Id; report.Library = library; report.CountClients = clientController.CountByLibraryId(library.Id); report.CountSections = sectionController.CountByLibraryId(library.Id); report.CountBooks = bookController.CountByLibraryId(library.Id); report.CountBooksInUse = bookClientController.CountInUseByLibraryId(library.Id); report.CountBooksNotInUse = report.CountBooks - report.CountBooksInUse; reportController.Edit(report); } } }
private void AddReportBtn_Click(object sender, RoutedEventArgs e) { InitDataSource(ref reportItems, Mapper.ReportsToReportViewModels, reportController.Get); AddReport addReport = new AddReport(libraryItems); if (addReport.ShowDialog().Value) { LibraryViewModel model = addReport.SelectedItem; if (model != null) { Library library = libraryController.GetById(model.Id); Report report = new Report(library); report.CountClients = clientController.CountByLibraryId(library.Id); report.CountSections = sectionController.CountByLibraryId(library.Id); report.CountBooks = bookController.CountByLibraryId(library.Id); report.CountBooksInUse = bookClientController.CountInUseByLibraryId(library.Id); report.CountBooksNotInUse = report.CountBooks - report.CountBooksInUse; reportController.Add(report); reportItems.Add(Mapper.ReportToReportViewModel(report)); return; } } }
// private void AddReport() { var addWindow = new AddReport(false, null); if (addWindow.ShowDialog() ?? false) { _model.SelectedResearcher.AddReport(addWindow.Report); } }
private void AddReportExecute() { try { AddReport addReport = new AddReport(EmployeeLogedIn); addReport.ShowDialog(); ReportList = reportService.GetAllReportsOfEmployee(EmployeeLogedIn); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Executes the add Worker command /// </summary> private void AddNewReportExecute() { try { AddReport addReport = new AddReport(); addReport.ShowDialog(); if ((addReport.DataContext as AddReportViewModel).IsUpdateReport == true) { ReportList = service.GetAllReports().ToList(); WorkerReportList = service.GetAllWorkerReports(Service.LoggedInUser[0].UserID).ToList(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Open a form to add a report /// </summary> private void AddExecute() { try { AddReport addReport = new AddReport(); addReport.ShowDialog(); if ((addReport.DataContext as AddReportViewmodel).IsUpdateReport == true) { Service s = new Service(); ReportList = s.GetAllReportIDtbl(LoggedEmployee.ID).ToList(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Executes the edit command /// </summary> public void EditReportExecute() { try { if (UserReport() != null) { AddReport addReport = new AddReport(UserReport()); addReport.ShowDialog(); if ((addReport.DataContext as AddReportViewModel).IsUpdateReport == true) { ReportList = service.GetAllReports().ToList(); WorkerReportList = service.GetAllWorkerReports(LoggedUser.CurrentUser.UserID).ToList(); } SectorModifier(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void EditReport() { var addWindow = new AddReport(true, _model.SelectedReport); addWindow.ShowDialog(); }