private void button1_Click(object sender, EventArgs e) { Korisnici_ k = new Korisnici_(); k.backup(); Artikal a = new Artikal(); a.backup(); a.backup_knjizeno(); a.backup_mob_hover(); a.backup_mob_hover_knjizeno(); Racun r = new Racun(); r.backup(); r.backup_knjizeno(); r.backup_hover_mob(); Servis_ s = new Servis_(); s.backup(); Rezervacija_ rez = new Rezervacija_(); rez.backup(); Narudzbine_ n = new Narudzbine_(); n.backup(); Dug d = new Dug(); d.backup(); MessageBox.Show("Baza podataka je sacuvana!"); }
private void button1_Click(object sender, EventArgs e) { Racun r = new Racun(); try { r.prodavac = "servis"; r.datum_izdavanja = DateTime.Now; r.artikli = ime_prezime; r.iznos = decimal.Parse(textBox1.Text); r.iznos_nabavna = cena_popravke; if (r.unesi_racun()) { MessageBox.Show("Servis naplacen"); Servis_ s = new Servis_(); s.izbrisi_servis(sifra); this.Close(); stampaj_racun(); } else { MessageBox.Show("Servis nije naplacen"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { Servis_ s = new Servis_(); try { if (e.ColumnIndex == 7) { int n = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); if (MessageBox.Show("Zelite li da izbrisete servisiranje sa sifrom: " + n + " ?", "Poruka", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (s.izbrisi_servis(n)) { MessageBox.Show("Servisiranje je obrisano!"); } else { MessageBox.Show("Servisiranje nije obrisano!"); } } } else if (e.ColumnIndex == 8) { int sifra = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); string serviser = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); DateTime dt_ost = DateTime.Parse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString()); decimal cena_popravke = decimal.Parse(dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString()); string ime_prezime = dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(); string br_tel = dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString(); string opis_kvara = dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString(); Naplati_servis ns = new Naplati_servis(sifra, serviser, dt_ost, cena_popravke, ime_prezime, br_tel, opis_kvara); ns.ShowDialog(); } else if (e.ColumnIndex == 9) { int sifra = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); string serviser = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); decimal cena_popravke = decimal.Parse(dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString()); Izmeni_servis izs = new Izmeni_servis(sifra, serviser, cena_popravke); izs.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } Lista_servisa_Load(sender, e); }
private void Lista_servisa_Load(object sender, EventArgs e) { dataGridView1.Rows.Clear(); dataGridView1.Refresh(); Servis_ s = new Servis_(); List <Servis_> ls = s.get_seris_ls(); foreach (Servis_ i in ls) { dataGridView1.Rows.Add(i.id_servisa, i.serviser, i.DateTime, i.cena_popravke, i.ime_prezime, i.broj_telefona, i.opis_kvara); } }
private void button1_Click(object sender, EventArgs e) { Servis_ s = new Servis_(); s.serviser = textBox1.Text; s.cena_popravke = decimal.Parse(textBox2.Text); if (s.update_serivs(id_servisa)) { MessageBox.Show("Servis je izmenjen!"); this.Close(); } else { MessageBox.Show("Servis nije izmenjen!"); } }
private void button1_Click(object sender, EventArgs e) { Servis_ a = new Servis_(); try { if (string.IsNullOrWhiteSpace(textBox1.Text)) { a.serviser = ""; } else { a.serviser = textBox1.Text; } a.DateTime = dateTimePicker1.Value.Date; if (string.IsNullOrWhiteSpace(textBox2.Text)) { a.cena_popravke = 0; } else { a.cena_popravke = decimal.Parse(textBox2.Text); } a.ime_prezime = textBox3.Text; a.broj_telefona = textBox4.Text; a.opis_kvara = textBox5.Text; if (a.unesi_servis()) { MessageBox.Show("Servis je unesen!"); this.Close(); } else { MessageBox.Show("Servis nije unesen!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public List <Servis_> get_seris_ls() { List <Servis_> ls = new List <Servis_>(); using (SqlConnection conn = new SqlConnection(connString)) { try { conn.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM Servis", conn); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { Servis_ s = new Servis_(); s.id_servisa = int.Parse(reader["id_servisa"].ToString()); s.serviser = reader["serviser"].ToString(); s.DateTime = DateTime.Parse(reader["datum_preuzimanja"].ToString()); s.cena_popravke = decimal.Parse(reader["cena_popravke"].ToString()); s.ime_prezime = reader["ime_prezime"].ToString(); s.broj_telefona = reader["broj_telefona"].ToString(); s.opis_kvara = reader["opis_kvara"].ToString(); ls.Add(s); } } } catch (SqlException ex) { Console.WriteLine(ex.Message); } finally { conn.Close(); } } return(ls); }