private void button3_Click(object sender, RoutedEventArgs e) { this.Hide(); DateTime curTime = DateTime.Now; //retrieve as an anonymous object type Object activeRecord = listBox1.SelectedItems[0]; //access attributes through reflection dynamic d = activeRecord; object id = d.Id; object nm = d.Patientname; object nhs = d.Patientnhsno; int patientID = Convert.ToInt32(id); db.insertScans(1, patientID, System.IO.Path.Combine(workingDir, patientID + "-" + curTime.ToString("ddMMyyyyHHMM") + ".PARSE"), "", curTime); //save scan to .parse file in the working directory ScanSerializer.serialize(Path.Combine(workingDir, patientID + "-" + curTime.ToString("ddMMyyyyHHMM") + ".PARSE"), pcdl); //confirm save MessageBoxResult result = System.Windows.MessageBox.Show(this, "Patient saved to database", "Patient Scan Saved", MessageBoxButton.OK, MessageBoxImage.Information); }
private void SaveScan_Click(object sender, RoutedEventArgs e) { //Test if patientloader is currently active and then attribute the scan to them. //Otherwise if this is not the case, we need to manually attribute the scan to //a patient. DateTime curTime = DateTime.Now; if (windowPatient == null) { windowMeta = new MetaLoader(); windowMeta.WindowStartupLocation = WindowStartupLocation.CenterScreen; windowMeta.Owner = this; //save specific actions. windowMeta.setWorkingDir(workingDir); windowMeta.setPC(pcdl); windowMeta.Title = "Attribute scan to whom?"; windowMeta.button1.Visibility = Visibility.Collapsed; windowMeta.button2.Visibility = Visibility.Collapsed; windowMeta.button3.Visibility = Visibility.Visible; windowMeta.Show(); } else { int currentPatient = Convert.ToInt32(windowPatient.patientIDExisting.Content); //save to db and workingdirectory with appropriate id. db.insertScans(1, currentPatient, System.IO.Path.Combine(workingDir, currentPatient + "-" + curTime.ToString("ddMMyyyyHHMM") + ".PARSE"), "", curTime); //save scan to .parse file in the working directory ScanSerializer.serialize(System.IO.Path.Combine(workingDir, currentPatient + "-" + curTime.ToString("ddMMyyyyHHMM") + ".PARSE"), pcdl); MessageBoxResult result = System.Windows.MessageBox.Show(this, "Patient saved to database", "Patient Scan Saved", MessageBoxButton.OK, MessageBoxImage.Information); } }