コード例 #1
0
        private void unesi_Click(object sender, EventArgs e)
        {
            try
            {
                if (ime.Text.Length < 1 || email.Text.Length < 1 || adresa.Text.Length < 1 || index.Text.Length < 1 || prezime.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 && index.Text.Length < 11 && prezime.Text.Length < 45 && IspravanIndeks(index.Text))
                {
                    DAO dao = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6");
                    int id = dao.VratiStudentID(s.BrojIndexa);
                    int bck = dao.VratiClanBibliotekeID(id, "student");

                    s.Ime = ime.Text;
                    s.Prezime = prezime.Text;
                    s.BrojLicneKarte = licna.Text;
                    s.Adresa = adresa.Text;
                    s.Email = email.Text;
                    s.BrojTelefona = telefon.Text;
                    s.DatumUclanjivanja = datum.Value;
                    s.TipClanarine = Convert.ToInt32(tipClanarine.Text);
                    s.BrojIndexa = Convert.ToInt32(index.Text);
                    s.NazivFakulteta = faks.Text;
                    s.Slika = (Bitmap)naslovnaStrana.Image;

                    dao.AzurirajStudenta(s, id, bck);
                    toolStripStatusLabel1.Text = "";
                    Close();

                }

                else toolStripStatusLabel1.Text = "Unesite ispravne podatke, promjene nisu izvrsene!";

            }
            catch (Exception izuzetak)
            {
                MessageBox.Show(izuzetak.Message);
            }
        }
コード例 #2
0
        private void pd_Stampaj(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            PrivateFontCollection pfc = new PrivateFontCollection();

            pfc.AddFontFile("fre3of9x.ttf");
            FontFamily barkod = new FontFamily("Free 3 of 9 Extended", pfc);
            Font c39Font = new Font(barkod, 30);

            Image clanska = Image.FromFile("clanska1.jpg");
            Graphics g = Graphics.FromImage(clanska);

            slika = new Bitmap(naslovnaStrana.Image);
            g.DrawImage(Smanji(slika, 140, 140), new Point(15, 27));

            g.DrawString(ime.Text, new Font(FontFamily.GenericSansSerif, 11, FontStyle.Bold), Brushes.Black, 183, 43);
            g.DrawString(prezime.Text, new Font(FontFamily.GenericSansSerif, 11, FontStyle.Bold), Brushes.Black, 183, 98);

            DAO dao = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6");
            int x = dao.VratiStudentID(Convert.ToInt32(index.Text));
            int y = dao.VratiClanBibliotekeID(x, "student");
            SizeF barCodeSize = g.MeasureString(Convert.ToString(y), c39Font);
            g.DrawString("Student", new Font(FontFamily.GenericSansSerif, 9, FontStyle.Bold), Brushes.Black, 18, 190);
            g.DrawString(Convert.ToString(y), new Font(FontFamily.GenericSansSerif, 8, FontStyle.Bold), Brushes.Black, 183, 160);
            g.DrawString(Convert.ToString(y), c39Font, new SolidBrush(Color.Black), 190, 200);

            e.Graphics.DrawImage((Bitmap)clanska, 0, 0);
        }
コード例 #3
0
        private void ponisti_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dr = new DialogResult();
                dr = MessageBox.Show("Da li ste sigurni da želite izrisati studenta iz baze podataka?", "Upozorenje", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dr == System.Windows.Forms.DialogResult.Yes)
                {
                    DAO dao = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6");
                    int id = dao.VratiStudentID(Convert.ToInt32(index.Text));
                    int cbid = dao.VratiClanBibliotekeID(id, "student");
                    dao.IzbrisiStudenta(id, cbid);

                    Close();
                }
            }
            catch (Exception izuzetak)
            {
                MessageBox.Show(izuzetak.Message);
            }
        }
コード例 #4
0
        private void unesi_Click(object sender, EventArgs e)
        {
            try
            {
                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)
                {
                    DAO dao = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6");
                    int id = dao.VratiUposlenikID(u.Jmbg);
                    int bck = dao.VratiClanBibliotekeID(id, "uposlenik");

                    u.Ime = ime.Text;
                    u.Prezime = prezime.Text;
                    u.BrojLicneKarte = licna.Text;
                    u.Adresa = adresa.Text;
                    u.Email = email.Text;
                    u.BrojTelefona = telefon.Text;
                    u.DatumUclanjivanja = datum.Value;
                    u.Jmbg = jmbg.Text;
                    u.TipUposlenika = tipUposlenika.Text;
                    u.Slika = (Bitmap)naslovnaStrana.Image;

                    dao.AzurirajUposlenika(u, id, bck);
                    toolStripStatusLabel1.Text = "";
                    Close();

                }
                else toolStripStatusLabel1.Text = "Unesite ispravne podatke, promjene nisu izvrsene!";

            }

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