private void unesi_Click(object sender, EventArgs e)
        {
            try
            {
                DAO dao = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6");
               // slika = new Bitmap(defaultpic);
                if (tabControl1.SelectedIndex == 0)
                {
                    if (ime.Text.Length < 1 || email.Text.Length < 1 || adresa.Text.Length < 1 || prezime.Text.Length < 1 || jmbg.Text.Length < 1 || telefon.Text.Length < 1)
                    {
                        toolStripStatusLabel1.Text = "Popunite sva polja";
                    }

                    else if ((IspravnaLicna(licna.Text)) && ime.Text.Length < 45 && email.Text.Length < 50 && adresa.Text.Length < 45 && provjeriJMBG(jmbg.Text) && prezime.Text.Length < 45 && IspravanIndeks(index.Text))
                    {
                        Uposlenik u = new Uposlenik(licna.Text, ime.Text, prezime.Text, adresa.Text, email.Text, telefon.Text, Convert.ToDateTime(datum.Text), jmbg.Text, tipUposlenika.Text);
                        u.Slika = (Bitmap)naslovnaStrana.Image;
                        dao.DodajUposlenika(u);

                        PrintPreviewDialog previewDialog = new PrintPreviewDialog();
                        PrintDocument pd = new PrintDocument();
                        pd.PrintPage += new PrintPageEventHandler(this.pd_Stampaj);

                        previewDialog.Document = pd;
                        previewDialog.SetBounds(50, -550, 200, 200);
                        previewDialog.ShowDialog();

                        toolStripStatusLabel1.Text = "";
                        ime.Text = prezime.Text = licna.Text = jmbg.Text = adresa.Text = email.Text = index.Text = telefon.Text= "";
                        faks.SelectedIndex = 1;
                        clanarina.SelectedIndex = 1;
                        tipUposlenika.SelectedIndex = 1;
                        naslovnaStrana.Image = ((System.Drawing.Image)(Properties.Resources.Misc_User_icon));
                        //   ));
                        toolStripStatusLabel1.Text = "Korisnik dodan";

                    }
                    else toolStripStatusLabel1.Text = "Unesite ispravne podatke, korisnik nije dodan!";

                }
                if (tabControl1.SelectedIndex == 1)
                {
                    if (ime.Text.Length < 1 || email.Text.Length < 1 || adresa.Text.Length < 1 || index.Text.Length < 1 || prezime.Text.Length < 1)
                    {
                        toolStripStatusLabel1.Text = "Popunite sva polja";
                    }
                    else if ((IspravnaLicna(licna.Text)) && ime.Text.Length < 45 && email.Text.Length < 50 && adresa.Text.Length < 45 && index.Text.Length < 11 && prezime.Text.Length < 45)
                    {
                        Student s = new Student(licna.Text, ime.Text, prezime.Text, adresa.Text, email.Text, telefon.Text, Convert.ToDateTime(datum.Text), Convert.ToInt16(index.Text), faks.Text, Convert.ToInt32(clanarina.Text));
                        s.Slika = (Bitmap)naslovnaStrana.Image;
                        dao.DodajStudenta(s);

                        if (tabControl1.SelectedIndex == 1) student = true;

                        if (tabControl2.SelectedIndex == 5)
                        {
                            Image camera = Image.FromFile("capture.png");
                            slika = new Bitmap(camera);

                        }

                        PrintPreviewDialog previewDialog = new PrintPreviewDialog();
                        PrintDocument pd = new PrintDocument();
                        pd.PrintPage += new PrintPageEventHandler(this.pd_Stampaj);

                        previewDialog.Document = pd;
                        previewDialog.SetBounds(50, -550, 200, 200);
                        previewDialog.ShowDialog();

                        ime.Text = prezime.Text = licna.Text = jmbg.Text = adresa.Text = email.Text = index.Text = telefon.Text ="";
                        faks.SelectedIndex = 1;
                        clanarina.SelectedIndex = 1;
                        tipUposlenika.SelectedIndex = 1;
                        naslovnaStrana.Image = ((System.Drawing.Image)(Properties.Resources.Misc_User_icon));
                        toolStripStatusLabel1.Text = "Korisnik dodan";
                    }

                    else toolStripStatusLabel1.Text = "Unesite ispravne podatke, korisnik nije dodan!";

                }
            }
            catch (Exception izuzetak)
            {
                MessageBox.Show(izuzetak.Message);
            }
        }