private void frmTipovi_Load(object sender, EventArgs e) { osveziTabelu(); Tip tip = (Tip)this.Tag; for (int i = 0; i < dataGridView1.RowCount; i++) { Tip t = (Tip)dataGridView1.Rows[i].Tag; if (tip.oznakaTipa.Equals(t.oznakaTipa)) { dataGridView1.Rows[i].Visible = false; break; } } }
private void button6_Click(object sender, EventArgs e) { frmTipovi ft = new frmTipovi(); ft.Tag = "odaberi"; ft.osveziTabelu(); ft.ShowDialog(); if (ft.DialogResult == DialogResult.OK) { Tip tip = (Tip)ft.Tag; tipSpomenika = tip; textBox3.Text = tip.oznakaTipa; textBox4.Text = tip.imeTipa; richTextBox1.Text = tip.opisTipa; pictureBox2.BackgroundImage = tip.ikonicaTipa; } }
private void dataGridView1_SelectionChanged(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { textBox1.Text = ""; textBox2.Text = ""; richTextBox1.Text = ""; return; } Tip tip = (Tip)dataGridView1.SelectedRows[0].Tag; if (tip == null) { return; } textBox1.Text = tip.oznakaTipa; textBox2.Text = tip.imeTipa; pictureBox1.Image = new Bitmap(tip.ikonicaTipa, new Size(64, 64)); // pictureBox1.BackgroundImage = tip.ikonicaTipa; richTextBox1.Text = tip.opisTipa; }
private void button4_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { toolStripStatusLabel1.Text = "Niste odabrali tip za brisanje."; statusStrip1.Visible = true; toolStripStatusLabel1.Visible = true; return; } statusStrip1.Visible = false; Tip tip = (Tip)dataGridView1.SelectedRows[0].Tag; bool imaSpomenik = false; List <Spomenik> spomenici = SpomeniciBaza.getInstance().getSpomenici(); foreach (Spomenik s in spomenici) { if (s.tip.imeTipa.Equals(tip.imeTipa)) { imaSpomenik = true; break; } } if (imaSpomenik) { brisanjeTipaYN btYN = new brisanjeTipaYN(); btYN.ShowDialog(); if (btYN.DialogResult == DialogResult.No) { //nista se ne desava; } else if (btYN.DialogResult == DialogResult.OK) { TipoviBaza.getInstance().getTipovi().Remove(tip); List <Spomenik> spomeniciZaBrisanje = new List <Spomenik>(); spomenici = SpomeniciBaza.getInstance().getSpomenici(); foreach (Spomenik s in spomenici) { if (s.tip.oznakaTipa.Equals(tip.oznakaTipa)) { spomeniciZaBrisanje.Add(s); } } foreach (Spomenik spo in spomeniciZaBrisanje) { spomenici.Remove(spo); } osveziTabelu(); } } else { TipoviBaza.getInstance().getTipovi().Remove(tip); dataGridView1.Rows.Remove(dataGridView1.SelectedRows[0]); osveziTabelu(); } }
public Spomenik(String oz, String im, String ep, String un, String ts, String ao, String nas, decimal pr, DateTime dat, Tip t, Image ik, List <Tag> tags) { this.oznaka = oz; this.ime = im; this.eraPorekla = ep; this.unesco = un; this.tustickiStatus = ts; this.arhObradjen = ao; this.naseljen = nas; this.prihod = pr; this.datum = dat; this.tip = t; this.ikona = ik; this.tagovi = tags; this.prevucen = false; }