Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Korisnik user = DataProvider.GetKorisnikPoMailu(textBox1.Text);
            Restoran res  = DataProvider.GetRestoranPoMailu(textBox1.Text);

            if (user != null && textBox2.Text.Equals(DataProvider.GetKorisnikPassword(textBox1.Text)))
            {
                Singleton.Instance.Korisnik = user;
                Singleton.Instance.Role     = Role.Korisnik;
                FormKorisnik userFrm = new FormKorisnik();
                userFrm.Show();
                this.Hide();
            }
            else if (res != null && textBox2.Text.Equals(DataProvider.GetRestoranPassword(textBox1.Text)))
            {
                Singleton.Instance.Restoran = res;
                Singleton.Instance.Role     = Role.Restoran;
                FormRestoran resFrm = new FormRestoran();
                resFrm.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Uneli ste pogresne podatke.", "Greska!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (DataProvider.GetKorisnikPoMailu(textEmail.Text) == null)
     {
         if (textPassword.Text == textBoxRepeatPassword.Text)
         {
             DataProvider.CreateKorisnik(textIme.Text, textPrezime.Text, textEmail.Text, textPassword.Text, textBrTel.Text);
             Singleton.Instance.Korisnik = DataProvider.GetKorisnikPoMailu(textEmail.Text);
             Singleton.Instance.Role     = Role.Korisnik;
             FormKorisnik userFrm = new FormKorisnik();
             userFrm.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("Sifre se ne poklapaju. Pokusajte opet.", "Greska!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Korisnik vec postoji.", "Greska!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }