partial void DeletetblUpit(tblUpit instance);
partial void UpdatetblUpit(tblUpit instance);
partial void InserttblUpit(tblUpit instance);
private void detach_tblUpits(tblUpit entity) { this.SendPropertyChanging(); entity.tblServer = null; }
private void attach_tblUpits(tblUpit entity) { this.SendPropertyChanging(); entity.tblServer = this; }
protected void buttonUpitSnimi_Click(object sender, EventArgs e) { SemaforiDataContext db = new SemaforiDataContext(); // slično kao i kod servera; ako je Id=-1, onda je dodavanje novog, inače je edit if (Convert.ToInt32(labelUpitID.Text)>0) { //edit postojećeg tblUpit upit = (from u in db.tblUpits where u.id == Convert.ToInt32(labelUpitID.Text) select u).Single(); upit.naziv = textBoxUpitNaziv.Text; upit.upit = textBoxUpitDefinicija.Text; upit.serverID = Convert.ToInt32(dropDownListUpitOdaberiDatasource.SelectedValue); // petljanje, ali kad se mora. tblDB dbase = (from d in db.tblDBs where d.serverid == upit.serverID select d).Single(); upit.dbID = dbase.id; db.SubmitChanges(); } else { //dodajemo novi tblUpit upit = new tblUpit(); upit.naziv = textBoxUpitNaziv.Text; upit.upit = textBoxUpitDefinicija.Text; upit.serverID = Convert.ToInt32(dropDownListUpitOdaberiDatasource.SelectedValue); // petljanje, ali kad se mora. tblDB dbase = (from d in db.tblDBs where d.serverid == upit.serverID select d).Single(); upit.dbID = dbase.id; db.tblUpits.InsertOnSubmit(upit); db.SubmitChanges(); } ListViewUpiti.DataBind(); menuUpdatePanel.Update(); }