private void dodaj_Click(object sender, RoutedEventArgs e) { List <string> ls = new List <string>(); for (int i = 0; i < hoteli.Text.Length; i++) { int a = i; while (hoteli.Text[a] != ',') { a++; } string s = hoteli.Text.Substring(i, a - 1); i = a; ls.Add(s); } List <string> la = new List <string>(); for (int i = 0; i < mainatr.Text.Length; i++) { int a = i; while (mainatr.Text[a] != ',') { a++; } string s = mainatr.Text.Substring(i, a - 1); i = a; la.Add(s); } tours.Lokacije.Add(new Lokacija(info.Text, Convert.ToDouble(cjena.Text), ls, la, ime.Text)); Page page = new UposlenikView(ref tours); this.Content = page; }
private void btnLogin_Click(object sender, RoutedEventArgs e) { if (textBoxUser.Text == "admin" && passBox.Password == "admin") { myView.Navigate(typeof(PregledAdminView)); return; } for (int i = 0; i < tours.Osobe.Count; i++) { if (textBoxUser.Text == tours.Osobe[i].Username && passBox.Password == tours.Osobe[i].Password) { if (tours.Osobe[i].GetType() == typeof(Admin)) { Page admPage = new PregledAdminView(ref tours); this.Content = admPage; } if (tours.Osobe[i].GetType() == typeof(Vodic)) { Page admPage = new Pregled_Vodic_(ref tours); this.Content = admPage; }//promjenit if (tours.Osobe[i].GetType() == typeof(Putnik)) { Page admPage = new HomePage(ref tours); this.Content = admPage; }//promjenit if (tours.Osobe[i].GetType() == typeof(Uposlenik)) { Page uposPage = new UposlenikView(ref tours); this.Content = uposPage; } } } }