private bool fetchCase() { bool result = false; txtZaaknaam.Text = string.Empty; txtZaakEigenaar.Text = string.Empty; dpCase.DisplayDate = DateTime.MinValue; dpCase.Text = DateTime.MinValue.ToString(); if (CasesDB.Exists(txtZaaknummer.Text)) { Case = CasesDB.GetCase(txtZaaknummer.Text); txtZaaknaam.Text = Case.Name; txtZaakEigenaar.Text = Case.Owner; dpCase.DisplayDate = Case.Date; dpCase.Text = Case.Date.ToString(); btnNext.IsEnabled = true; result = true; } else { Case = null; btnNext.IsEnabled = false; result = false; MessageBox.Show($"Zaak {txtZaaknummer.Text} niet gevonden", "Niet gevonden", MessageBoxButton.OK, MessageBoxImage.Exclamation); } return(result); }
private void PageTransfer_OnLoaded(object sender, RoutedEventArgs e) { // Add case to database --> if (Case.IsNew) { CasesDB.AddCase(Case); } else { CasesDB.ModifyCase(Case); } if (!bgWorker.IsBusy) { bgWorker.RunWorkerAsync(this.Case); } Util.ProgressInfo.StepSize = 100 / Case.Files.Count; if (ConfigHandler.EnableWeirdo) { backgroundMusicElement.Play(); } else { backgroundMusicElement.Stop(); } }
private void dgCases_row_DoubleClick(object sender, MouseButtonEventArgs e) { DataGridRow row = sender as DataGridRow; string caseNumber = ((System.Data.DataRowView)row.Item)[0].ToString(); MySqlDataAdapter adapter = CasesDB.GetDataAdapterCaseContent(caseNumber); DataTable dt = new DataTable("datamuncher_case_content"); adapter.Fill(dt); dgContentCase.ItemsSource = dt.DefaultView; }
private void Page_Loaded(object sender, RoutedEventArgs e) { MySqlDataAdapter adapterCase = CasesDB.GetDataAdapterCases(); DataTable dtCase = new DataTable("datamuncher_case"); adapterCase.Fill(dtCase); dgCases.ItemsSource = dtCase.DefaultView; /* * using (dt = new DataTable()) * { * sqlda.Fill(dt); * dataGridView1.DataSource = dt; * } */ }
private void btnNext_OnClick(object sender, RoutedEventArgs e) { //if (Case == null) //{ // if (MessageBox.Show("Zaak details ophalen?", "Ophalen gegevens", MessageBoxButton.YesNo, // MessageBoxImage.Question) == MessageBoxResult.Yes) // { // fetchCase(); // } // else // { // return; // } //} bool caseDatabaseRowExists = CasesDB.Exists(Case.Number); bool caseDirectoryExists = Util.DirectoryExistst(Case.CaseDirectory); if (caseDirectoryExists && caseDatabaseRowExists) { Case = CasesDB.GetCase(Case.Number); PageSelectFiles pageSelectFiles = new PageSelectFiles(Case); this.NavigationService.Navigate(pageSelectFiles); } else if (caseDirectoryExists && !caseDatabaseRowExists) { MessageBox.Show("Zaak bestaat op opslag maar niet in database. Waarschuw beheerder", "Inconsistentie gedetecteerd", MessageBoxButton.YesNo, MessageBoxImage.Warning); } else if (caseDatabaseRowExists && !caseDirectoryExists) { MessageBox.Show("Zaak bestaat in database maar niet in opslag. Waarschuw beheerder", "Inconsistentie gedetecteerd", MessageBoxButton.YesNo, MessageBoxImage.Warning); } else { if (MessageBox.Show("Zaak niet gevonden. Nieuwe zaak toevoegen in plaats van bestaande wijzigen?", "Zaak niet gevonden", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { NavigationService.Navigate(new PageNewData()); } } }
private void transfer_Completed(object sender, RunWorkerCompletedEventArgs e) { if (e.Cancelled) { MessageBox.Show("Cancelled", "Cancelled", MessageBoxButton.OK); } else if (e.Error != null) { MessageBox.Show("Error", e.Error.Message, MessageBoxButton.OK, MessageBoxImage.Error); } else { Util.ProgressInfo pi = (Util.ProgressInfo)e.Result; Case.Files.Clear(); // TODO: AddRange for ObservableCollection --> foreach (var piTransferredFile in pi.TransferredFiles) { Case.Files.Add(piTransferredFile); } CasesDB.AddTransferedFilesToCaseDB(pi.TransferredFiles, Case); Util.WriteCaseFileToOutput(this.Case); string failedFiles = pi.TransferredFiles.Where( fileSel => fileSel.State == Util.FileState.ERROR || fileSel.State == Util.FileState.DUPLICATE ).Aggregate(string.Empty, (current, fileSel) => current + (fileSel.Path + System.Environment.NewLine)); if (string.IsNullOrEmpty(failedFiles)) { failedFiles = "Alle bestanden gekopieerd!"; } if (MessageBox.Show(failedFiles, "Completed", MessageBoxButton.OK, MessageBoxImage.Information) == MessageBoxResult.OK) { NavigationService.Navigate(new PageSummaryAfter(this.Case)); } } }
private void export(string caseNumber = "") { MySqlDataAdapter adapterCase = CasesDB.GetDataAdapterCases(caseNumber); DataTable dtCase = new DataTable("zaken"); adapterCase.Fill(dtCase); XLWorkbook workbook = new XLWorkbook(); workbook.Worksheets.Add(dtCase); if (chkIncFilenames.IsChecked.HasValue && chkIncFilenames.IsChecked.Value) { foreach (DataRow row in dtCase.Rows) { string tmpCase = row[0].ToString(); MySqlDataAdapter adapterCaseContent = CasesDB.GetDataAdapterCaseContent(tmpCase); DataTable dtCaseContent = new DataTable($"zaak_{tmpCase}"); adapterCaseContent.Fill(dtCaseContent); workbook.Worksheets.Add(dtCaseContent); } } SaveFileDialog ofd = new SaveFileDialog() { RestoreDirectory = true, DefaultExt = "xlsx", Filter = "Excel Files Files (*.xlsx)|*.xlsx|All Files (*.*)|*.*", }; if (ofd.ShowDialog() == DialogResult.OK) { workbook.SaveAs(ofd.FileName); } }
private void btnNext_OnClick(object sender, RoutedEventArgs e) { Case = fetchAndValidateInput(); if (Case != null) { bool caseDatabaseRowExists = CasesDB.Exists(Case.Number); bool caseDirectoryExists = Util.DirectoryExistst(Case.CaseDirectory); if (caseDirectoryExists || caseDatabaseRowExists) { // Verify consistency --> if (caseDirectoryExists && !caseDatabaseRowExists) { MessageBox.Show("Zaak bestaat op opslag maar niet in database. Waarschuw beheerder", "Inconsistentie gedetecteerd", MessageBoxButton.YesNo, MessageBoxImage.Warning); } else if (caseDatabaseRowExists && !caseDirectoryExists) { MessageBox.Show("Zaak bestaat in database maar niet in opslag. Waarschuw beheerder", "Inconsistentie gedetecteerd", MessageBoxButton.YesNo, MessageBoxImage.Warning); } else if (MessageBox.Show($"Zaak met nummer {Case.Number} bestaat al.\r\nToevoegen aan bestaande zaak?", "Zaaknummer bestaat al", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { NavigationService.Navigate(new PageModifyExisting() { CaseNumber = Case.Number }); } } else { PageSelectFiles pageSelectFiles = new PageSelectFiles(this.Case); this.NavigationService.Navigate(pageSelectFiles); } } }