private void otvoriProzorZaRadToolStripMenuItem_Click(object sender, EventArgs e) { RadnikForma forma = new RadnikForma(); forma.logRadnik = logSef; forma.ShowDialog(); }
private void buttonLogin_Click(object sender, EventArgs e) { try { var pass = textBoxLozinka.Text; var md5 = new MD5CryptoServiceProvider(); var data = Encoding.ASCII.GetBytes(pass); var hash_pass = md5.ComputeHash(data); Korisnik log = new Korisnik(); log.korisnicko_ime = textBoxKorisnickoIme.Text; log.lozinka = Convert.ToBase64String(hash_pass); log.proveri_korisnika(); if (log.Uloga == "radnik" || log.Uloga == "Radnik") { RadnikForma forma = new RadnikForma(); this.Hide(); forma.logRadnik = log; forma.Show(); forma.WindowState = FormWindowState.Maximized; } else if (log.Uloga == "Sef" || log.Uloga == "admin" || log.Uloga == "Admin") { SefForma forma = new SefForma(); this.Hide(); forma.Show(); forma.logSef = log; forma.WindowState = FormWindowState.Maximized; } else { textBoxKorisnickoIme.Clear(); textBoxLozinka.Clear(); MessageBox.Show("Neispravno korisnicko ime ili lozinka!", "Greska"); } } catch (Exception ex) { if (ex is SystemException || ex is NotSupportedException || ex is UnauthorizedAccessException || ex is FormatException || ex is IndexOutOfRangeException || ex is InsufficientMemoryException || ex is EntryPointNotFoundException || ex is EntryPointNotFoundException || ex is EvaluateException || ex is InvalidCastException || ex is InvalidProgramException) { MessageBox.Show(ex.Message, "Greska"); } else { MessageBox.Show(ex.Message, "Greska"); } } }