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); } }
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); } }
private void PromjenaStudent_Load(object sender, EventArgs e) { ime.Text = s.Ime; prezime.Text = s.Prezime; licna.Text = s.BrojLicneKarte; index.Text = s.BrojIndexa.ToString(); faks.Text = s.NazivFakulteta; adresa.Text = s.Adresa; email.Text = s.Email; telefon.Text = s.BrojTelefona; datum.Value = s.DatumUclanjivanja; tipClanarine.SelectedItem = s.TipClanarine.ToString(); DAO dao = new DAO("etf.ba", "ooadtim6", "ooadtim6", "ooadtim6"); int ID = dao.VratiStudentID(s.BrojIndexa); naslovnaStrana.Image = (Image)dao.VratiStudentSliku(ID); toolStripStatusLabel1.Text = ""; }
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); }