Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
        }