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"); //Resources.clanska)); 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); if (tabControl1.SelectedIndex == 1) { DAO dao1 = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6"); int x = dao1.VratiStudentID(Convert.ToInt32(index.Text)); DAO dao2 = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6"); int y = dao2.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); } else if (tabControl1.SelectedIndex == 0) { DAO dao3 = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6"); int p = dao3.VratiUposlenikID(jmbg.Text); DAO dao4 = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6"); int q = dao4.VratiClanBibliotekeID(p, "uposlenik"); SizeF barCodeSize = g.MeasureString(Convert.ToString(q), c39Font); g.DrawString("Uposlenik", new Font(FontFamily.GenericSansSerif, 9, FontStyle.Bold), Brushes.Black, 18, 190); g.DrawString(Convert.ToString(q), new Font(FontFamily.GenericSansSerif, 8, FontStyle.Bold), Brushes.Black, 183, 160); g.DrawString(Convert.ToString(q), c39Font, new SolidBrush(Color.Black), 190, 200); } e.Graphics.DrawImage((Bitmap)clanska, 0, 0); }
private void PromjenaUposlenik_Load(object sender, EventArgs e) { ime.Text = u.Ime; prezime.Text = u.Prezime; licna.Text = u.BrojLicneKarte; jmbg.Text = u.Jmbg; tipUposlenika.Text = u.TipUposlenika; adresa.Text = u.Adresa; email.Text = u.Email; telefon.Text = u.BrojTelefona; datum.Value = u.DatumUclanjivanja; tipClanarine.Enabled = false; label0.Enabled = false; toolStripStatusLabel1.Text = ""; DAO dao = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6"); int ID = dao.VratiUposlenikID(u.Jmbg); naslovnaStrana.Image = dao.VratiUposlenikSliku(ID); }
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); } }
private void ponisti_Click(object sender, EventArgs e) { try { DialogResult dr = new DialogResult(); dr = MessageBox.Show("Da li ste sigurni da želite izrisati uposlenika 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.VratiUposlenikID(jmbg.Text); int cbid = dao.VratiClanBibliotekeID(id, "uposlenik"); dao.IzbrisiUposlenika(id, cbid); Close(); } } catch (Exception izuzetak) { MessageBox.Show(izuzetak.Message); } }