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;
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void addclik(object sender, RoutedEventArgs e)
 {
     if (!Validated())
     {
         contentProvider.Content += "Please correct your mistakes!";
     }
     else
     {
         if (Convert.ToBoolean(vodic.IsChecked))
         {
             Vodic tempVodic = new Vodic(name.Text, surname.Text, username.Text, password.Text, email.Text, number.Text, adress.Text);
             tours.Osobe.Add(new Vodic(tempVodic));
             tours.Vodici.Add(tempVodic);
             tempVodic.Id = tours.Vodici.Count;
             vodiciTable.InsertAsync(tempVodic);
         }
         else
         {
             Uposlenik tempUpos = new Uposlenik(name.Text, surname.Text, username.Text, password.Text, email.Text, number.Text, adress.Text);
             tours.Osobe.Add(new Uposlenik(tempUpos));
             tours.Uposlenici.Add(tempUpos);
             tempUpos.Id = tours.Uposlenici.Count;
             uposleniciTable.InsertAsync(tempUpos);
         }
         Page adm = new PregledAdminView(ref tours);
         this.Content = adm;
     }
 }
Ejemplo n.º 3
0
        private void Button_Click_del(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < tours.Osobe.Count; i++)
            {
                if (tours.Osobe[i].ToString().Equals(passL.SelectedItem) || tours.Osobe[i].ToString().Equals(touristL.SelectedItem) || tours.Osobe[i].ToString().Equals(employeL.SelectedItem))
                {
                    tours.Osobe.Remove(tours.Osobe[i]);
                }
            }
            Page reload = new PregledAdminView(ref tours);

            this.Content = reload;
        }
Ejemplo n.º 4
0
        private void CancelBtn_Click(object sender, RoutedEventArgs e)
        {
            Page adm = new PregledAdminView(ref tours);

            this.Content = adm;
        }