Example #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (dgvVinograd.SelectedRows.Count > 0)
     {
         mojVinograd  odabraniVin     = dgvVinograd.SelectedRows[0].DataBoundItem as mojVinograd;
         NoviVinograd frmNoviVinograd = new NoviVinograd(odabraniVin);
         frmNoviVinograd.ShowDialog();
         OsvjeziVinograd();
     }
 }
Example #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (dgvVinograd.SelectedRows.Count > 0)
     {
         foreach (DataGridViewRow row in dgvVinograd.SelectedRows)
         {
             mojVinograd odabraniVin = row.DataBoundItem as mojVinograd;
             odabraniVin.Obrisi();
         }
     }
     OsvjeziVinograd();
 }
        private void Spremi_Click(object sender, EventArgs e)
        {
            if (vinograd == null)
            {
                vinograd = new mojVinograd();
            }
            vinograd.naziv    = txtNaziv.Text;
            vinograd.lokacija = txtLokacija.Text;
            vinograd.brCokota = int.Parse(txtBrCokota.Text);
            vinograd.brRedova = int.Parse(txtBrRedova.Text);

            vinograd.Spremi();
            this.Close();
        }
        public static List <mojVinograd> DohvatiVinograd()
        {
            List <mojVinograd> lista = new List <mojVinograd>();

            string       sqlUpit = "SELECT * FROM vinograd";
            DbDataReader dr      = DB.Instance.DohvatiDataReader(sqlUpit);

            while (dr.Read())
            {
                mojVinograd vinograd = new mojVinograd(dr);
                lista.Add(vinograd);
            }
            dr.Close();
            return(lista);
        }
 public NoviVinograd(mojVinograd odabraniVin)
 {
     InitializeComponent();
     vinograd = odabraniVin;
 }