private void button_Click(object sender, RoutedEventArgs e) { int broj = Convert.ToInt32(tb_sifraRacuna.Text); ServisRacunaraDataContext DC = new ServisRacunaraDataContext(); RacunVlasnika rc = (from x in DC.RacunVlasnikas where x.sifraRacuna == broj select x).SingleOrDefault(); DC.RacunVlasnikas.DeleteOnSubmit(rc); DC.SubmitChanges(); MessageBox.Show("Racuna je uspesno obrisan!", "Obavestenje", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); }
private void button_Click(object sender, RoutedEventArgs e) { bool pom = false; ServisRacunaraDataContext DC = new ServisRacunaraDataContext(); try { RacunVlasnika rv = new RacunVlasnika(); rv.sifraNaloga = Convert.ToInt32(cb.SelectedValue.ToString()); rv.radnik = tb_imeRadnika.Text; rv.vreme = tb_vreme.Text; rv.imePrezime = tb_imePrezime.Text; rv.brLicne = Convert.ToInt32(tb_brLicne.Text); rv.telefon = tb_telefon.Text; rv.mail = tb_mail.Text; rv.sifraRac = tb_sifRacunara.Text; rv.opisKva = new TextRange(rtb_opisKvara.Document.ContentStart, rtb_opisKvara.Document.ContentEnd).Text; rv.spisPoslova = new TextRange(rtb_SpisakPoslova.Document.ContentStart, rtb_SpisakPoslova.Document.ContentEnd).Text; rv.rezDel = new TextRange(rtb_SpisakRezDel.Document.ContentStart, rtb_SpisakRezDel.Document.ContentEnd).Text; rv.cenaDelova = tb_cenaDelova.Text; rv.cenaUsluga = tb_cenaUsluga.Text; rv.cenaUkupna = tb_ukupnaCena.Text; DC.RacunVlasnikas.InsertOnSubmit(rv); DC.SubmitChanges(); pom = true; } catch (Exception) { MessageBox.Show("Doslo je do greskee!"); } if (pom) { MessageBox.Show("Uspesno ste kreirali racun!", "Obavestenje", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } }
partial void DeleteRacunVlasnika(RacunVlasnika instance);
partial void UpdateRacunVlasnika(RacunVlasnika instance);
partial void InsertRacunVlasnika(RacunVlasnika instance);
private void detach_RacunVlasnikas(RacunVlasnika entity) { this.SendPropertyChanging(); entity.RadNalog = null; }