private void home_btn_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
            KorisnikPocetna kp = new KorisnikPocetna();

            kp.ShowDialog();
        }
Пример #2
0
        private void login_btn_Click(object sender, RoutedEventArgs e)
        {
            if (username_TB.Text != String.Empty && password_PB.Password != String.Empty)
            {
                try
                {
                    BazaDataContext bdc  = new BazaDataContext();
                    var             upit = (from Korisnik in bdc.Korisniks where Korisnik.Username.Equals(username_TB.Text) & Korisnik.Password.Equals(password_PB.Password) select Korisnik).First();
                    Application.Current.Properties["ID"] = upit.ID;

                    string vrsta = upit.Rank;

                    if (vrsta == "Administrator")
                    {
                        if (MessageBox.Show("Uspešno ste se ulogovali!", "INFO", MessageBoxButton.OK, MessageBoxImage.Information) == MessageBoxResult.OK)
                        {
                            this.Hide();
                            AdminPocetna ap = new AdminPocetna();
                            ap.ShowDialog();
                        }
                    }
                    else
                    {
                        if (MessageBox.Show("Uspešno ste se ulogovali!", "INFO", MessageBoxButton.OK, MessageBoxImage.Information) == MessageBoxResult.OK)
                        {
                            this.Hide();
                            KorisnikPocetna kp = new KorisnikPocetna();
                            kp.ShowDialog();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ne postoji korisnik sa tim korisnickim imenom i sifrom!"
                                    , "Obaveštenje", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show("Polja 'Username' i 'Password' moraju biti popunjena! ",
                                "Obaveštenje", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }