private void b_dodaj_Click(object sender, EventArgs e)
        {
            double kvota1,kvotax,kvota2,kvota1x,kvotax2,kvota12;
            kvota1=Convert.ToInt32(n_kvota1_1.Value)+(Convert.ToInt32(n_kvota1_2.Value)*0.1)+(Convert.ToInt32(n_kvota1_3.Value)*0.01);
            kvotax=Convert.ToInt32(n_kvotax_1.Value)+(Convert.ToInt32(n_kvotax_2.Value)*0.1)+(Convert.ToInt32(n_kvotax_3.Value)*0.01);
            kvota2=Convert.ToInt32(n_kvota2_1.Value)+(Convert.ToInt32(n_kvota2_2.Value)*0.1)+(Convert.ToInt32(n_kvota2_3.Value)*0.01);
            kvota1x=Convert.ToInt32(n_kvota1x_1.Value)+(Convert.ToInt32(n_kvota1x_2.Value)*0.1)+(Convert.ToInt32(n_kvota1x_3.Value)*0.01);
            kvotax2=Convert.ToInt32(n_kvotax2_1.Value)+(Convert.ToInt32(n_kvotax2_2.Value)*0.1)+(Convert.ToInt32(n_kvotax2_3.Value)*0.01);
            kvota12=Convert.ToInt32(n_kvota12_1.Value)+(Convert.ToInt32(n_kvota12_2.Value)*0.1)+(Convert.ToInt32(n_kvota12_3.Value)*0.01);
            if (!c_kvota1.Checked) kvota1=1.00;
            if (!c_kvotax.Checked) kvotax=1.00;
            if (!c_kvota2.Checked) kvota2=1.00;
            if (!c_kvota1x.Checked) kvota1x=1.00;
            if (!c_kvotax2.Checked) kvotax2=1.00;
            if (!c_kvota12.Checked) kvota12=1.00;
            Dogadjaj dog = new Dogadjaj(c_imeprvogucenika.Text, c_imedrugogucesnika.Text, kvota1, kvotax, kvota2, kvota1x, kvotax2, kvota12,Convert.ToString(dtp_do.Value),Convert.ToInt32(n_satnica_h.Value*100+n_satnica_m.Value));
            try
            {
                DAL.DAL d = DAL.DAL.Instanca;
                d.kreirajKonekciju("localhost", "kladionica", "root", "");

                DAL.DAL.DogadjajDAO dd = d.getDAO.getDogadjajDAO();
                dog.Id = dd.create(dog);
                d.terminirajKonekciju();
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message);

            }
            MessageBox.Show("Događaj uspješno stvoren!");
        }
Exemplo n.º 2
0
 public void DodajDogadjaj(Dogadjaj d,int tip)
 {
     foreach (Dogadjaj a in dogadjaji)
     {
         if (a.Id == d.Id) throw new Exception("Događaj već dodan!");
     }
     if (Convert.ToDateTime(d.DatumOdrzavanja) < DateTime.Now) throw new Exception("Događaj već prošao!");
     dogadjaji.Add(d);
     lista_tipova.Add(tip);
 }
 private void b_dodaj_Click(object sender, EventArgs e)
 {
     double kvota1,kvotax,kvota2,kvota1x,kvotax2,kvota12;
     kvota1=Convert.ToInt32(n_kvota1_1.Value)+(Convert.ToInt32(n_kvota1_2.Value)*0.1)+(Convert.ToInt32(n_kvota1_3.Value)*0.01);
     kvotax=Convert.ToInt32(n_kvotax_1.Value)+(Convert.ToInt32(n_kvotax_2.Value)*0.1)+(Convert.ToInt32(n_kvotax_3.Value)*0.01);
     kvota2=Convert.ToInt32(n_kvota2_1.Value)+(Convert.ToInt32(n_kvota2_2.Value)*0.1)+(Convert.ToInt32(n_kvota2_3.Value)*0.01);
     kvota1x=Convert.ToInt32(n_kvota1x_1.Value)+(Convert.ToInt32(n_kvota1x_2.Value)*0.1)+(Convert.ToInt32(n_kvota1x_3.Value)*0.01);
     kvotax2=Convert.ToInt32(n_kvotax2_1.Value)+(Convert.ToInt32(n_kvotax2_2.Value)*0.1)+(Convert.ToInt32(n_kvotax2_3.Value)*0.01);
     kvota12=Convert.ToInt32(n_kvota12_1.Value)+(Convert.ToInt32(n_kvota12_2.Value)*0.1)+(Convert.ToInt32(n_kvota12_3.Value)*0.01);
     if (!c_kvota1.Checked) kvota1=1.00;
     if (!c_kvotax.Checked) kvotax=1.00;
     if (!c_kvota2.Checked) kvota2=1.00;
     if (!c_kvota1x.Checked) kvota1x=1.00;
     if (!c_kvotax2.Checked) kvotax2=1.00;
     if (!c_kvota12.Checked) kvota12=1.00;
     Dogadjaj d = new Dogadjaj(t_imeprvogucesnika.Text, t_imedrugogucesnika.Text, kvota1, kvotax, kvota2, kvota1x, kvotax2, kvota12);
     MessageBox.Show("Događaj uspješno stvoren!");
 }
 public PotvrdaTipa(Tiket t,Dogadjaj d)
 {
     tik = t;
     dog = d;
     InitializeComponent();
 }
 private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     Dogadjaj d = new Dogadjaj(Convert.ToString(dataGridView1.SelectedRows[0].Cells[1].Value), Convert.ToString(dataGridView1.SelectedRows[0].Cells[2].Value), Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[3].Value), Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[4].Value), Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[5].Value), Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[6].Value), Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[7].Value), Convert.ToDouble(dataGridView1.SelectedRows[0].Cells[8].Value), Convert.ToString(dataGridView1.SelectedRows[0].Cells[9].Value), Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[10].Value));
     d.Rezultat = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[8].Value);
     d.Id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value);
     try
     {
         if (Convert.ToDateTime(d.DatumOdrzavanja) < DateTime.Now) throw new Exception("Taj događaj je već prošao!");
         ld1.Add(d);
         dataGridView2.DataSource = null;
         dataGridView2.DataSource = ld1;
         PotvrdaTipa pt = new PotvrdaTipa(novi_tiket, d);
         pt.Show();
     }
     catch (Exception aad)
     {
         MessageBox.Show(aad.Message);
     }
 }