public void napuni() { Baza baza = new Baza(); string kabinet, mejl, konsultacije = ""; string biografija = "Нема описа."; string aktivnost = "Нема описа."; upit = "SELECT * FROM profesori WHERE idprofesor = " + id; using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { if (reader.GetString("biografija") != "") biografija = reader.GetString("biografija"); if (reader.GetString("aktivnost") != "") aktivnost = reader.GetString("aktivnost"); profesor = new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), biografija, aktivnost); gridProfesor.DataContext = profesor; } } upit1 = "SELECT * FROM predmeti WHERE id_predm IN (SELECT id_predm FROM pplink WHERE id_prof = " + id + ")"; using (reader = baza.izvrsiUpit(upit1)) { while (reader.Read()) { Predmet p = new Predmet(reader.GetString("id_predm"), reader.GetString("naziv")); lvPredmeti.Items.Add(p); } } }
void napraviListuTimova() { Baza baza = new Baza(); MySqlDataReader reader; string upit = "SELECT * FROM timovi WHERE id_tim = " + id_tim; string id_preds = ""; using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { id_preds = reader.GetString("id_preds"); frameTimovi.DataContext = new Tim(reader.GetString("id_tim"), reader.GetString("id_preds"), reader.GetString("ime"), reader.GetString("glavna_slika"), reader.GetString("pozadinska_slika"), reader.GetString("ikonica"), reader.GetString("podnaslov"), reader.GetString("tekst")); } } upit = "SELECT * FROM studenti WHERE id_stud = " + id_preds; using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { rectPredstavnik.DataContext = new Student(reader.GetString("id_stud"), reader.GetString("ime_prezime"), reader.GetString("mail"), reader.GetString("slika"), reader.GetString("opis")); spPredstavnik.DataContext = new Student(reader.GetString("id_stud"), reader.GetString("ime_prezime"), reader.GetString("mail"), reader.GetString("slika"), reader.GetString("opis")); } } upit = "SELECT * FROM studenti WHERE id_stud IN (SELECT id_stud FROM tslink WHERE id_tim = " + id_tim + " AND id_stud != " + id_preds + ")"; using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { // itemListView je lista studenata koji su u timu itemListView.Items.Add(new Student(reader.GetString("id_stud"), reader.GetString("ime_prezime"), reader.GetString("mail"), reader.GetString("slika"), reader.GetString("opis"))); } } }
public void napuni() { Baza baza = new Baza(); string kabinet, mejl, konsultacije = ""; string biografija = "Нема описа."; string aktivnost = "Нема описа."; upit = "SELECT * FROM profesori WHERE idprofesor = " + id; using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { if (reader.GetString("biografija") != "") { biografija = reader.GetString("biografija"); } if (reader.GetString("aktivnost") != "") { aktivnost = reader.GetString("aktivnost"); } profesor = new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), biografija, aktivnost); gridProfesor.DataContext = profesor; } } upit1 = "SELECT * FROM predmeti WHERE id_predm IN (SELECT id_predm FROM pplink WHERE id_prof = " + id + ")"; using (reader = baza.izvrsiUpit(upit1)) { while (reader.Read()) { Predmet p = new Predmet(reader.GetString("id_predm"), reader.GetString("naziv")); lvPredmeti.Items.Add(p); } } }
public Profesori() { this.InitializeComponent(); this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += navigationHelper_LoadState; this.navigationHelper.SaveState += navigationHelper_SaveState; baza = new Baza(); using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { profesori.Add(new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), reader.GetString("biografija"), reader.GetString("aktivnost"))); } } spProfesori.Margin = new Thickness(100, 50, 100, 100); lvProfesori.Tapped += lvProfesori_Tapped; lvProfesori.Width = 500; lvProfesori.HorizontalAlignment = HorizontalAlignment.Left; lvProfesori.IsSwipeEnabled = false; spProfesori.Children.Add(lvProfesori); StackPanel sp1 = new StackPanel(); TextBlock tbSlovo = new TextBlock(); tbSlovo.Text = "А"; tbSlovo.FontSize = 60; tbSlovo.Margin = new Thickness(5, 0, 0, 0); sp1.Background = new SolidColorBrush(Colors.RoyalBlue); sp1.Width = 500; sp1.Children.Add(tbSlovo); lvProfesori.Items.Add(sp1); foreach(ProfesorC p in profesori) { if (lvProfesori.Items.Count == maxCnt) { lvProfesori = new ListView(); lvProfesori.IsSwipeEnabled = false; lvProfesori.Width = 500; lvProfesori.HorizontalAlignment = HorizontalAlignment.Left; lvProfesori.Tapped += lvProfesori_Tapped; spProfesori.Children.Add(lvProfesori); } if (tbSlovo.Text.Equals(p.imePrezime.Substring(0, 1))) { dodajStavkuListe(p); } else { tbSlovo = new TextBlock(); tbSlovo.FontSize = 60; tbSlovo.Margin = new Thickness(5, 0, 0, 0); tbSlovo.Text = p.imePrezime.Substring(0, 1); if (lvProfesori.Items.Count == maxCnt) { lvProfesori = new ListView(); lvProfesori.Width = 500; lvProfesori.HorizontalAlignment = HorizontalAlignment.Left; lvProfesori.Tapped += lvProfesori_Tapped; spProfesori.Children.Add(lvProfesori); } sp1 = new StackPanel(); sp1.Background = new SolidColorBrush(Colors.RoyalBlue); sp1.Width = 500; sp1.Children.Add(tbSlovo); lvProfesori.Items.Add(sp1); dodajStavkuListe(p); } } }
void ucitajPozadinskeSlike() { Baza baza = new Baza(); MySqlDataReader reader; string upit = "SELECT * FROM smerovi LIMIT 7"; using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { pozadniskeSlike.Add(reader.GetString("slika")); } } }
void napraviListuTimova() { Baza baza = new Baza(); MySqlDataReader reader; string upit = "SELECT * FROM timovi"; using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { timoviLst.Add(new Tim(reader.GetString("id_tim"), reader.GetString("id_preds"), reader.GetString("ime"), reader.GetString("glavna_slika"), reader.GetString("pozadinska_slika"), reader.GetString("ikonica"), reader.GetString("podnaslov"), reader.GetString("tekst"))); } } }
void napraviListuProfesora() { Baza baza = new Baza(); MySqlDataReader reader; string upit = "SELECT idProfesor, imePrezime, titula, zvanje, slika, konsultacije, kabinet, mail, biografija, aktivnost FROM profesori WHERE slika != '/adresar/muskarac.jpg' AND slika != '/adresar/zena.jpg' ORDER BY imePrezime"; using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { prof.Add(new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), reader.GetString("biografija"), reader.GetString("aktivnost"))); } } }
private void napuniSmerovi() { string upit = "SELECT * FROM smerovi"; Baza baza = new Baza(); MySqlDataReader reader; List<string> lstSkracenica = new List<string>(); List<string> lstIdSmerovi = new List<string>(); List<string> lstBoje = new List<string>(); using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { lstSkracenica.Add(reader.GetString("skracenica")); lstIdSmerovi.Add(reader.GetString("id_smer")); lstBoje.Add(reader.GetString("boja")); } } int brojac = 0; for (int i = 0; i < 7; i = i + 2) { for (int j = 0; j < 7; j = j + 2) { TextBlock tb = new TextBlock(); tb.VerticalAlignment = VerticalAlignment.Center; tb.HorizontalAlignment = HorizontalAlignment.Center; tb.FontSize = 30; tb.Tag = lstIdSmerovi[brojac]; tb.Tapped += tb_Tapped; tb.Text = lstSkracenica[brojac]; Grid.SetColumn(tb, i); Grid.SetRow(tb, j); string rgb = lstBoje[brojac]; byte r, g, b; r = System.Convert.ToByte(rgb.Substring(1, 2), 16); g = System.Convert.ToByte(rgb.Substring(3, 2), 16); b = System.Convert.ToByte(rgb.Substring(5, 2), 16); Border pozadina = new Border(); pozadina.Height = 160; pozadina.Width = 160; pozadina.Tag = lstIdSmerovi[brojac++]; /*pozadina.Background = new SolidColorBrush(Color.FromArgb(255, 65, 105, 225)); if (brojac > 8) pozadina.Background = new SolidColorBrush(Color.FromArgb(255, 106, 90, 205));*/ pozadina.Background = new SolidColorBrush(Color.FromArgb(255, r, g, b)); if (brojac > 8) pozadina.Background = new SolidColorBrush(Color.FromArgb(255, r, g, b)); pozadina.Tapped += pozadina_Tapped; Grid.SetColumn(pozadina, i); Grid.SetRow(pozadina, j); gridSmerovi.Children.Add(pozadina); gridSmerovi.Children.Add(tb); if (brojac == 14) return; } } }
private void napuniSmerovi() { string upit = "SELECT * FROM smerovi"; Baza baza = new Baza(); MySqlDataReader reader; List <string> lstSkracenica = new List <string>(); List <string> lstIdSmerovi = new List <string>(); List <string> lstBoje = new List <string>(); using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { lstSkracenica.Add(reader.GetString("skracenica")); lstIdSmerovi.Add(reader.GetString("id_smer")); lstBoje.Add(reader.GetString("boja")); } } int brojac = 0; for (int i = 0; i < 7; i = i + 2) { for (int j = 0; j < 7; j = j + 2) { TextBlock tb = new TextBlock(); tb.VerticalAlignment = VerticalAlignment.Center; tb.HorizontalAlignment = HorizontalAlignment.Center; tb.FontSize = 30; tb.Tag = lstIdSmerovi[brojac]; tb.Tapped += tb_Tapped; tb.Text = lstSkracenica[brojac]; Grid.SetColumn(tb, i); Grid.SetRow(tb, j); string rgb = lstBoje[brojac]; byte r, g, b; r = System.Convert.ToByte(rgb.Substring(1, 2), 16); g = System.Convert.ToByte(rgb.Substring(3, 2), 16); b = System.Convert.ToByte(rgb.Substring(5, 2), 16); Border pozadina = new Border(); pozadina.Height = 160; pozadina.Width = 160; pozadina.Tag = lstIdSmerovi[brojac++]; /*pozadina.Background = new SolidColorBrush(Color.FromArgb(255, 65, 105, 225)); * if (brojac > 8) pozadina.Background = new SolidColorBrush(Color.FromArgb(255, 106, 90, 205));*/ pozadina.Background = new SolidColorBrush(Color.FromArgb(255, r, g, b)); if (brojac > 8) { pozadina.Background = new SolidColorBrush(Color.FromArgb(255, r, g, b)); } pozadina.Tapped += pozadina_Tapped; Grid.SetColumn(pozadina, i); Grid.SetRow(pozadina, j); gridSmerovi.Children.Add(pozadina); gridSmerovi.Children.Add(tb); if (brojac == 14) { return; } } } }
private void napuni() { Baza baza = new Baza(); upit = "SELECT * FROM smerovi WHERE id_smer = " + id; string naziv = ""; int duzinaStringa = 0; MySqlDataReader reader; using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { naziv = reader.GetString("naziv"); duzinaStringa = reader.GetString("naziv").Length; //if (duzinaStringa > 18) naziv = reader.GetString("skracenica"); Smer smer = new Smer(reader.GetInt32("id_smer"), naziv, reader.GetString("skracenica"), reader.GetInt32("id_smer"), reader.GetInt32("id_smer"), reader.GetString("slika"), reader.GetString("boja"), reader.GetString("opis"), reader.GetString("kompetencije")); gridSmer.DataContext = smer; upit = "SELECT * FROM profesori WHERE idProfesor = " + reader.GetString("id_ruk"); upit1 = "SELECT * FROM profesori WHERE idProfesor = " + reader.GetString("id_sek"); } } using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { ProfesorC p = new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), reader.GetString("biografija"), reader.GetString("aktivnost")); lvRukovodioci.Items.Add(p); } } using (reader = baza.izvrsiUpit(upit1)) { while (reader.Read()) { ProfesorC p = new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), reader.GetString("biografija"), reader.GetString("aktivnost")); lvRukovodioci.Items.Add(p); } } upit = "SELECT naziv, semestar FROM predmeti as P, splink as S WHERE id_smer =" + id + " AND P.id_predm = S.id_predm"; ListViewItem lvi = new ListViewItem(); lvi.Content = "I година"; lvi.FontSize = 18; lvi.Background = new SolidColorBrush(Colors.RoyalBlue); lvi.VerticalContentAlignment = VerticalAlignment.Center; lvi.Padding = new Thickness(5, 0, 0, 0); lvSpisakPredmeta.Items.Add(lvi); int status = 1; using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { if ((reader.GetString("semestar").Equals("3") || reader.GetString("semestar").Equals("4")) && (status == 1)) { lvi = new ListViewItem(); lvi.Content = "II година"; lvi.FontSize = 18; lvi.Background = new SolidColorBrush(Colors.Purple); lvi.VerticalContentAlignment = VerticalAlignment.Center; lvi.Padding = new Thickness(5, 0, 0, 0); lvSpisakPredmeta.Items.Add(lvi); status = 2; } else if ((reader.GetString("semestar").Equals("5") || reader.GetString("semestar").Equals("6")) && (status == 2)) { lvi = new ListViewItem(); lvi.Content = "III година"; lvi.FontSize = 18; lvi.Background = new SolidColorBrush(Colors.Pink); lvi.VerticalContentAlignment = VerticalAlignment.Center; lvi.Padding = new Thickness(5, 0, 0, 0); lvSpisakPredmeta.Items.Add(lvi); status = 0; } lvi = new ListViewItem(); lvi.BorderThickness = new Thickness(4, 0, 0, 0); lvi.BorderBrush = new SolidColorBrush(Colors.RoyalBlue); if (status == 2) { lvi.BorderBrush = new SolidColorBrush(Colors.Purple); } else if (status == 0) { lvi.BorderBrush = new SolidColorBrush(Colors.Pink); } lvi.VerticalContentAlignment = VerticalAlignment.Center; lvi.Padding = new Thickness(5, 0, 0, 0); lvi.Content = reader.GetString("naziv"); lvSpisakPredmeta.Items.Add(lvi); } } }
public Profesori() { this.InitializeComponent(); this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += navigationHelper_LoadState; this.navigationHelper.SaveState += navigationHelper_SaveState; baza = new Baza(); using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { profesori.Add(new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), reader.GetString("biografija"), reader.GetString("aktivnost"))); } } spProfesori.Margin = new Thickness(100, 50, 100, 100); lvProfesori.Tapped += lvProfesori_Tapped; lvProfesori.Width = 500; lvProfesori.HorizontalAlignment = HorizontalAlignment.Left; lvProfesori.IsSwipeEnabled = false; spProfesori.Children.Add(lvProfesori); StackPanel sp1 = new StackPanel(); TextBlock tbSlovo = new TextBlock(); tbSlovo.Text = "А"; tbSlovo.FontSize = 60; tbSlovo.Margin = new Thickness(5, 0, 0, 0); sp1.Background = new SolidColorBrush(Colors.RoyalBlue); sp1.Width = 500; sp1.Children.Add(tbSlovo); lvProfesori.Items.Add(sp1); foreach (ProfesorC p in profesori) { if (lvProfesori.Items.Count == maxCnt) { lvProfesori = new ListView(); lvProfesori.IsSwipeEnabled = false; lvProfesori.Width = 500; lvProfesori.HorizontalAlignment = HorizontalAlignment.Left; lvProfesori.Tapped += lvProfesori_Tapped; spProfesori.Children.Add(lvProfesori); } if (tbSlovo.Text.Equals(p.imePrezime.Substring(0, 1))) { dodajStavkuListe(p); } else { tbSlovo = new TextBlock(); tbSlovo.FontSize = 60; tbSlovo.Margin = new Thickness(5, 0, 0, 0); tbSlovo.Text = p.imePrezime.Substring(0, 1); if (lvProfesori.Items.Count == maxCnt) { lvProfesori = new ListView(); lvProfesori.Width = 500; lvProfesori.HorizontalAlignment = HorizontalAlignment.Left; lvProfesori.Tapped += lvProfesori_Tapped; spProfesori.Children.Add(lvProfesori); } sp1 = new StackPanel(); sp1.Background = new SolidColorBrush(Colors.RoyalBlue); sp1.Width = 500; sp1.Children.Add(tbSlovo); lvProfesori.Items.Add(sp1); dodajStavkuListe(p); } } }
private void napuni() { Baza baza = new Baza(); upit = "SELECT * FROM smerovi WHERE id_smer = " + id; string naziv = ""; int duzinaStringa = 0; MySqlDataReader reader; using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { naziv = reader.GetString("naziv"); duzinaStringa = reader.GetString("naziv").Length; //if (duzinaStringa > 18) naziv = reader.GetString("skracenica"); Smer smer = new Smer(reader.GetInt32("id_smer"), naziv, reader.GetString("skracenica"), reader.GetInt32("id_smer"), reader.GetInt32("id_smer"), reader.GetString("slika"), reader.GetString("boja"), reader.GetString("opis"), reader.GetString("kompetencije")); gridSmer.DataContext = smer; upit = "SELECT * FROM profesori WHERE idProfesor = " + reader.GetString("id_ruk"); upit1 = "SELECT * FROM profesori WHERE idProfesor = " + reader.GetString("id_sek"); } } using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { ProfesorC p = new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), reader.GetString("biografija"), reader.GetString("aktivnost")); lvRukovodioci.Items.Add(p); } } using (reader = baza.izvrsiUpit(upit1)) { while (reader.Read()) { ProfesorC p = new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), reader.GetString("biografija"), reader.GetString("aktivnost")); lvRukovodioci.Items.Add(p); } } upit = "SELECT naziv, semestar FROM predmeti as P, splink as S WHERE id_smer =" + id +" AND P.id_predm = S.id_predm"; ListViewItem lvi = new ListViewItem(); lvi.Content = "I година"; lvi.FontSize = 18; lvi.Background = new SolidColorBrush(Colors.RoyalBlue); lvi.VerticalContentAlignment = VerticalAlignment.Center; lvi.Padding = new Thickness(5, 0, 0, 0); lvSpisakPredmeta.Items.Add(lvi); int status = 1; using (reader = baza.izvrsiUpit(upit)) { while (reader.Read()) { if ((reader.GetString("semestar").Equals("3") || reader.GetString("semestar").Equals("4")) && (status == 1)) { lvi = new ListViewItem(); lvi.Content = "II година"; lvi.FontSize = 18; lvi.Background = new SolidColorBrush(Colors.Purple); lvi.VerticalContentAlignment = VerticalAlignment.Center; lvi.Padding = new Thickness(5, 0, 0, 0); lvSpisakPredmeta.Items.Add(lvi); status = 2; } else if ((reader.GetString("semestar").Equals("5") || reader.GetString("semestar").Equals("6")) && (status == 2)) { lvi = new ListViewItem(); lvi.Content = "III година"; lvi.FontSize = 18; lvi.Background = new SolidColorBrush(Colors.Pink); lvi.VerticalContentAlignment = VerticalAlignment.Center; lvi.Padding = new Thickness(5, 0, 0, 0); lvSpisakPredmeta.Items.Add(lvi); status = 0; } lvi = new ListViewItem(); lvi.BorderThickness = new Thickness(4, 0, 0, 0); lvi.BorderBrush = new SolidColorBrush(Colors.RoyalBlue); if (status == 2) { lvi.BorderBrush = new SolidColorBrush(Colors.Purple); } else if (status == 0) { lvi.BorderBrush = new SolidColorBrush(Colors.Pink); } lvi.VerticalContentAlignment = VerticalAlignment.Center; lvi.Padding = new Thickness(5, 0, 0, 0); lvi.Content = reader.GetString("naziv"); lvSpisakPredmeta.Items.Add(lvi); } } }