-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logovanje.cs
44 lines (42 loc) · 1.43 KB
/
Logovanje.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ProjekatProba
{
static class Logovanje
{
public static bool ulogujSe(string korisnickoIme, string lozinka)
{
List<Korisnik> niz;
niz = RadDatoteka.citanjeDatoteke<Korisnik>("korisnici.json");
foreach(Korisnik korisnik in niz)
{
try
{
if (korisnik.Idbr == int.Parse(korisnickoIme) && korisnik.Lozinka == lozinka)
{
if (korisnik is Kupac)
{
Kupac kupac = korisnik as Kupac;
KorisnickaForma forma = new KorisnickaForma(korisnik);
forma.Show();
}
else if (korisnik is Administrator)
{
Administrator admin = korisnik as Administrator;
FormaAdministracija forma = new FormaAdministracija(korisnik);
forma.Show();
}
return true;
}
}
catch { }
}
MessageBox.Show("Nije pronadjen korisnik s tim IDBRom i sifrom");
return false;
}
}
}