Esempio n. 1
0
        private void refreshF5ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OrdinacijaDoktora nova = new OrdinacijaDoktora(ref novaKlinika, maticniDoktoraa);

            this.Hide();
            nova.Show();
        }
Esempio n. 2
0
 private void OrdinacijaDoktora_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         OrdinacijaDoktora nova = new OrdinacijaDoktora(ref novaKlinika, maticniDoktoraa);
         this.Hide();
         nova.Show();
     }
 }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            toolStripStatusLabel1.Text      = "";
            toolStripStatusLabel1.ForeColor = Color.Red;
            errorProvider1.Clear();
            string hash          = "";
            string korisnickoIme = textBox1.Text;
            string sifra         = textBox2.Text;

            using (MD5 md5Hash = MD5.Create())
            {
                hash = NMK_17993.Entiteti.Uposlenik.GetMd5Hash(md5Hash, sifra);
            }

            bool      jeLiUposlenik = true;
            Uposlenik a, b;


            try
            {
                a = novaKlinika.ListaUposlenih.Single(x => x.Username == korisnickoIme);
            }
            catch (Exception ex)
            {
                ex.GetType();
                jeLiUposlenik = false;
                errorProvider1.SetError(textBox1, "Pogrešan user!");
                toolStripStatusLabel1.Text = "Pogrešan unos!";
                textBox1.Clear();
                textBox2.Clear();
                textBox3.Clear();
                return;
            }

            try
            {
                b = novaKlinika.ListaUposlenih.Single(x => x.SifraUposlenikaMD5Hash == hash);
            }
            catch (Exception ex)
            {
                ex.GetType();
                jeLiUposlenik = false;
                errorProvider1.SetError(textBox2, "Pogrešan password!");
                toolStripStatusLabel1.Text = "Pogrešan unos!";
                textBox2.Clear();
                textBox3.Clear();
                return;
            }

            if (!Validacije.validacijaPassworda(textBox2.Text, textBox3.Text))
            {
                toolStripStatusLabel1.ForeColor = Color.Red;
                toolStripStatusLabel1.Text      = "Ne poklapaju se šifre! Unesite opet potvrdu.";
                errorProvider1.SetError(textBox3, "Ne poklapa se šifra.");
                textBox3.Clear();
                return;
            }


            if (jeLiUposlenik)
            {
                a = novaKlinika.ListaUposlenih.Single(x => x.Username == korisnickoIme && x.SifraUposlenikaMD5Hash == hash);
                if (a.GetType() == typeof(Doktor))           // ukoliko je Doktor
                {
                    OrdinacijaDoktora nov = new OrdinacijaDoktora(ref novaKlinika, a.MaticniBroj);
                    this.Hide();
                    nov.Show();
                }
                else if (a.GetType() == typeof(Uposlenik) && a.JeLiPortir)
                {
                    Portirnica forma = new Portirnica(ref novaKlinika);
                    this.Hide();
                    forma.Show();
                }
                else
                {
                    OrdinacijaUposlenika form = new OrdinacijaUposlenika(ref novaKlinika);
                    this.Hide();
                    form.Show();
                }
            }

            textBox1.Clear();
            textBox2.Clear();
            textBox3.Clear();
        }