private void PatientLoader_Loaded(object Sender, RoutedEventArgs e) { //open database db.dbOpen(); //hide existing patient labels this.patientIDExisting.Visibility = Visibility.Collapsed; this.patientNameExisting.Visibility = Visibility.Collapsed; this.patientNhsNoExisting.Visibility = Visibility.Collapsed; this.patientweightExisting.Visibility = Visibility.Collapsed; this.patientDOBExisting.Visibility = Visibility.Collapsed; this.patientNationalityExisting.Visibility = Visibility.Collapsed; this.patientAddressExisting.Visibility = Visibility.Collapsed; //hide irrelevant tabs this.recordedscans.Visibility = Visibility.Collapsed; this.conditiondetail.Visibility = Visibility.Collapsed; //enable/disable appropriate controls this.patientIDText.IsEnabled = false; if (db.getAllPatients().Item1.Count != 0) { this.activeID = db.getAllPatients().Item1.Last(); this.patientIDText.Text = (activeID + 1).ToString(); this.patientIDExisting.Content = this.patientIDText.Text; } else { this.activeID = 0; this.patientIDText.Text = (activeID + 1).ToString(); } this.nameLabel.ToString(); }
void MetaLoader_Loaded(object sender, RoutedEventArgs e) { /// <summary> /// Calls patient information records from the database /// </summary> db.dbOpen(); //access all patients from database. Tuple <LinkedList <int>, LinkedList <String>, LinkedList <string> > patientsList = db.getAllPatients(); nodeID = patientsList.Item1.First; nodeName = patientsList.Item2.First; nodeNHSNo = patientsList.Item3.First; //populate datagrid while (nodeID != null) { var nextID = nodeID.Next; var nextName = nodeName.Next; var nextNHSNo = nodeNHSNo.Next; patientsList.Item1.Remove(nodeID); patientsList.Item2.Remove(nodeName); patientsList.Item3.Remove(nodeNHSNo); //null check when at end of list if (nodeID != null) { var nodes = new { Id = nodeID.Value, Patientname = nodeName.Value, Patientnhsno = nodeNHSNo.Value }; listBox1.Items.Add(nodes); } nodeID = nextID; nodeName = nextName; nodeNHSNo = nextNHSNo; } }