private void Obrisi_Click(object sender, EventArgs e) { int broj_selektovanih = this.listBox1.SelectedItems.Count; if (broj_selektovanih == 0) { MessageBox.Show("Niste selektovali specijalnog gosta za brisanje"); return; } string z = this.listBox1.SelectedItem.ToString(); char[] param = { ' ' }; string[] rez = z.Split(param); int p = Convert.ToInt32(rez[0]); try { ISession s = DataLayer.GetSession(); Fashion_Show.Entiteti.Specijalan_Gost ucesnik = s.Load <Fashion_Show.Entiteti.Specijalan_Gost>(p); s.Delete(ucesnik); s.Flush(); s.Close(); MessageBox.Show("Uspesno brisanje stavke"); } catch (Exception ec) { MessageBox.Show(ec.Message); } }
private void button3_Click(object sender, EventArgs e) { try { ISession s = DataLayer.GetSession(); Fashion_Show.Entiteti.Specijalan_Gost sgost = s.Load <Fashion_Show.Entiteti.Specijalan_Gost>(ID_SGosta); //IQuery q = s.CreateQuery("select a.PripadaAgeciji from Agencijski_Maneken as a where a.ID = ? "); // q.SetInt32(0, ID_AManekena); // Agencija stara_agencija = q.UniqueResult<Agencija>(); sgost.Maticni_Broj = Convert.ToInt64(this.textBox2.Text); sgost.Licno_Ime = this.textBox3.Text; sgost.Prezime = this.textBox4.Text; sgost.Datum_Rodjenja = Convert.ToDateTime(this.textBox5.Text); sgost.Pol = this.textBox1.Text; sgost.Boja_Kose = this.textBox6.Text; sgost.Boja_Ociju = this.textBox7.Text; sgost.Visina = Convert.ToInt32(this.textBox8.Text); sgost.Tezina = Convert.ToInt32(this.textBox9.Text); sgost.Konfekcijski_Broj = Convert.ToInt32(this.textBox10.Text); sgost.Zanimanje = this.textBox11.Text; s.SaveOrUpdate(sgost); s.Flush(); s.Close(); MessageBox.Show("Azurirali ste stavku idite na prikaz specijalnih gostiju za refresh!"); Close(); } catch (Exception ec) { MessageBox.Show(ec.Message); } }