Esempio n. 1
0
        private void ObrisiOblast()
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                return;
            }

            int indeks = dataGridView1.SelectedRows[0].Index;

            int povratnaVrednost = DTOManangerOblast.ObrisiOblast(Int32.Parse(dataGridView1[0, indeks].Value.ToString()));

            if (povratnaVrednost == 2)
            {
                MessageBox.Show("Doslo je do greske");
            }
            else if (povratnaVrednost == 1)
            {
                MessageBox.Show("Uspesno ste obrisali oblast");
            }
            else if (povratnaVrednost == 0)
            {
                MessageBox.Show("Neko je u medjuvremenu obrisao oblast");
            }
            PrikaziOblasti();
        }
Esempio n. 2
0
        public void Update()
        {
            OblastBasic o = new OblastBasic()
            {
                JedinstvenoIme = tbxIme.Text,
                Povrsina       = int.Parse(tbxPovrsina.Text),
                OblastId       = IdOblastUpdate
            };

            int i = DTOManangerOblast.UpdateOblastBasic(o);

            if (i == 0)
            {
                MessageBox.Show("Vec postoji oblast sa tim imenom");
            }
            else if (i == 2)
            {
                MessageBox.Show("Doslo je do greske");
            }
            else
            {
                this.Close();
                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
        }
Esempio n. 3
0
 private void PrikaziOblasti()
 {
     if (chbStalnazastita.Checked)
     {
         dataGridView1.DataSource = DTOManangerOblast.VratiOblastiSaStalnomZastitom();
     }
     else
     {
         dataGridView1.DataSource = DTOManangerOblast.VratiSveOblasti().ToList();
     }
 }
Esempio n. 4
0
 private void postaviKontrole()
 {
     if (IdOblastUpdate == 0)
     {
         tbxId.Visible          = false;
         lblId.Visible          = false;
         cbxTipZastite.Location = new Point(341, 29);
         lblTip.Location        = new Point(338, 9);
     }
     else
     {
         cbxTipZastite.Visible = false;
         lblTip.Visible        = false;
         tbxId.Location        = new Point(341, 29);
         lblId.Location        = new Point(338, 9);
         OblastBasic o = DTOManangerOblast.VratiOblast(IdOblastUpdate);
         tbxId.Text       = o.OblastId.ToString();
         tbxId.Enabled    = false;
         tbxIme.Text      = o.JedinstvenoIme;
         tbxPovrsina.Text = o.Povrsina.ToString();
     }
 }