public CheckingDrug() { InitializeComponent(); List <Drug> drugs = dc.ViewUnconfirmedDrugs(); drug = drugs[0]; newDrug.Text = drugs[0].Name; List <Ingredient> ingredients = drugs[0].ingredient; List <string> names = new List <string>(); foreach (Ingredient i in ingredients) { names.Add(i.Name); } listBox1.DataContext = names; }
private void Button_Click(object sender, RoutedEventArgs e) { List <Drug> drugs = dc.ViewUnconfirmedDrugs(); if (drugs.Count > 0) { var s = new CheckingDrug(); s.Show(); } else { var s = new NotNewDrug(); s.Show(); } }
public DrugsView() { InitializeComponent(); this.DataContext = this; Lekovi = new ObservableCollection <Lek>(); TempLekovi = new ObservableCollection <Lek>(); Kriterijumi = new ObservableCollection <string>(); Kriterijumi.Add("Naziv"); Kriterijumi.Add("Sifra"); SifraTb.IsEnabled = true; List <Drug> confirmedDrugs = dc.ViewConfirmedDrugs(); List <Drug> unconfirmedDrugs = dc.ViewUnconfirmedDrugs(); List <Ingredient> ingredients = new List <Ingredient>(); ingredients = dt.ViewIngridients(); List <string> ingStr = new List <string>(); foreach (Ingredient i in ingredients) { ingStr.Add(i.Name); } listBox1.DataContext = ingStr; List <DrugType> drugTypes = new List <DrugType>(); List <string> drugTypesStr = new List <string>(); drugTypes = dt.ViewDrugTypes(); foreach (DrugType d in drugTypes) { drugTypesStr.Add(d.Type); } TipTb.DataContext = drugTypesStr; if (confirmedDrugs != null) { foreach (Drug d in confirmedDrugs) { Lek lek = new Lek(); lek.Naziv = d.Name; lek.Kolicina = d.Quantity; lek.Proizvodjac = d.Producer; lek.RokTrajanja = d.ExpirationDate; lek.Sifra = d.Id; lek.Sastav = new List <string>(); foreach (Ingredient a in d.ingredient) { lek.Sastav.Add(a.Name); } lek.Tip = d.drugType.Type; Lekovi.Add(lek); } } if (unconfirmedDrugs != null) { foreach (Drug d in unconfirmedDrugs) { Lek lek = new Lek(); lek.Naziv = d.Name; lek.Kolicina = d.Quantity; lek.Proizvodjac = d.Producer; lek.RokTrajanja = d.ExpirationDate; lek.Sifra = d.Id; lek.Sastav = new List <string>(); foreach (Ingredient a in d.ingredient) { lek.Sastav.Add(a.Name); } lek.Tip = d.drugType.Type; Lekovi.Add(lek); } } //Lekovi.Add(new Lek() { Naziv = "Brufen\nBrufen\nBrufen\nBrufen\nBrufen\nBrufen\n", Kolicina = "3", Sifra = "djna" }); //Lekovi.Add(new Lek() { Naziv = "Para", Kolicina = "30", Sifra = "aadjna" }); //Lekovi.Add(new Lek() { Naziv = "AAAAA", Kolicina = "40", Sifra = "jdjna" }); //Lekovi.Add(new Lek() { Naziv = "Wbdk", Kolicina = "4000", Sifra = "ccdjna" }); //Lekovi.Add(new Lek() { Naziv = "Cjdla", Kolicina = "50", Sifra = "aadjna" }); foreach (var lek in Lekovi) { TempLekovi.Add(lek); } SelectedKriterijum = Kriterijumi[0]; NazivHint = "Unesi tekst"; KolicinaHint = "Unesi broj"; NamenaHint = "Unesi tekst"; SifraHint = "Unesi broj"; RokHint = "Izaberi datum"; TipHint = "Unesi tekst"; ProizvodjacHint = "Unesi tekst"; SastavHint = "Unesi tekst"; PretragaHint = "Unesi tekst za pretragu"; SelektovaniLek = null; }