private void lstInformers_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Console.WriteLine(lstInformants.SelectedIndex); if (lstInformers.SelectedIndex != -1) { Informer inf = (Informer)lstInformers.SelectedItem; // id txtInformerId.Text = inf.Id.ToString(); // name txtInformerName.Text = inf.Name; // nationality txtInformerNationality.Text = inf.Nationality; // cpr txtInformerCPR.Text = inf.CPR; // currency txtInformerCurrency.Text = inf.Currency; // paymenttype txtInformerPaymentType.Text = inf.PaymentType; // tags txtInformerTags.Text = inf.Tags; // Check for existence of appearance, and insert if it exists Appearance infapp = InfoWrapper.GetAppearance(inf.Id); if (infapp.Id != -1) { txtInformerHeight.Text = infapp.Height.ToString(); txtInformerEyecolor.Text = infapp.Eyecolor; txtInformerHaircolor.Text = infapp.Haircolor; } Address infadd = InfoWrapper.GetAddress(inf.Id); // Check for existence of address, and insert if it exists if (infadd.Id != -1) { txtInformerStreet.Text = infadd.Street; txtInformerAreacode.Text = infadd.AreaCode.ToString(); } Database.Entities.Image infimg = InfoWrapper.GetImage(inf.Id); // Check for existence of image, and insert if it exists if (infimg.Id != -1) { try { MemoryStream ms = new MemoryStream(infimg.Data); BitmapImage bimg = new BitmapImage(); bimg.BeginInit(); bimg.StreamSource = ms; bimg.EndInit(); imgInformer.Source = bimg; } catch (Exception ex) { MessageBox.Show($"Billedformatet er ikke understøttet.\n\n{ex.Message}"); } } } }
private void lstObserved_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lstObserved.SelectedIndex != -1) { Observed obs = (Observed)lstObserved.SelectedItem; // id txtObservedId.Text = obs.Id.ToString(); // name txtObservedName.Text = obs.Name; // nationality txtObservedNationality.Text = obs.Nationality; // cpr txtObservedCPR.Text = obs.CPR; // tags txtObservedTags.Text = obs.Tags; // Check for existence of appearance, and insert if it exists Appearance obsapp = InfoWrapper.GetAppearance(obs.Id); if (obsapp.Id != -1) { txtObservedHeight.Text = obsapp.Height.ToString(); txtObservedEyecolor.Text = obsapp.Eyecolor; txtObservedHaircolor.Text = obsapp.Haircolor; } Address obsadd = InfoWrapper.GetAddress(obs.Id); // Check for existence of address, and insert if it exists if (obsadd.Id != -1) { txtObservedStreet.Text = obsadd.Street; txtObservedAreacode.Text = obsadd.AreaCode.ToString(); } Database.Entities.Image obsimg = InfoWrapper.GetImage(obs.Id); // Check for existence of image, and insert if it exists if (obsimg.Id != -1) { try { MemoryStream ms = new MemoryStream(obsimg.Data); BitmapImage bimg = new BitmapImage(); bimg.BeginInit(); bimg.StreamSource = ms; bimg.EndInit(); imgObserved.Source = bimg; } catch (Exception ex) { MessageBox.Show($"Billedformatet er ikke understøttet.\n\n{ex.Message}"); } } } }
private void lstAgents_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lstAgents.SelectedIndex != -1) { Agent agent = (Agent)lstAgents.SelectedItem; // id txtAgentId.Text = agent.Id.ToString(); // name txtAgentName.Text = agent.Name; // nationality txtAgentNationality.Text = agent.Nationality; // cpr txtAgentCPR.Text = agent.CPR; // Check for existence of appearance, and populate if it exists Appearance agentapp = InfoWrapper.GetAppearance(agent.Id); if (agentapp.Id != -1) { txtAgentHeight.Text = agentapp.Height.ToString(); txtAgentEyecolor.Text = agentapp.Eyecolor; txtAgentHaircolor.Text = agentapp.Haircolor; } Address agentadd = InfoWrapper.GetAddress(agent.Id); // Check for existence of address, and populate if it exists if (agentadd.Id != -1) { txtAgentStreet.Text = agentadd.Street; txtAgentAreacode.Text = agentadd.AreaCode.ToString(); } Database.Entities.Image agentimg = InfoWrapper.GetImage(agent.Id); // Check for existence of image, and populate if it exists if (agentimg.Id != -1) { try { MemoryStream ms = new MemoryStream(agentimg.Data); BitmapImage bimg = new BitmapImage(); bimg.BeginInit(); bimg.StreamSource = ms; bimg.EndInit(); imgAgent.Source = bimg; } catch (Exception ex) { MessageBox.Show($"Billedformatet er ikke understøttet.\n\n{ex.Message}"); } } } }