protected void btn_uredidom_Click(object sender, EventArgs e) { bool uspesnost = false; int id = int.Parse(TextBox1.Text); int stevilka = int.Parse(TextBox2.Text); string ime = TextBox3.Text; ServiceReference1.Studentski_dom dom = new ServiceReference1.Studentski_dom(); dom.Id = id; dom.Stevilka_Doma = stevilka; dom.Ime = ime; if (id.ToString() != "" && stevilka.ToString() != "" && ime != "") { uspesnost = StudentskiDomovi.UrediDom(dom.Id, dom.Ime, dom.Stevilka_Doma); } if (uspesnost == true) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Uspešno dodano!');", true); TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; } else { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Prišlo je do napake!');", true); TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; } }
protected void button_potrdi_Click(object sender, EventArgs e) { bool uspesnost = false; string ime = textime.Text; int stevilka = int.Parse(textstevilka.Text); int letonastanka = int.Parse(textletonastanka.Text); ServiceReference1.Studentski_dom dom = new ServiceReference1.Studentski_dom(); dom.Stevilka_Doma = stevilka; dom.Ime = ime; dom.Leto_Nastanka = letonastanka; if (stevilka.ToString() != "" && ime != "" && letonastanka.ToString() != "") { uspesnost = StudentskiDomovi.DodajStudentskiDom(dom); } if (uspesnost == true) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Uspešno dodano!');", true); textstevilka.Text = ""; textime.Text = ""; textletonastanka.Text = ""; } else { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Prišlo je do napake!');", true); textstevilka.Text = ""; textime.Text = ""; textletonastanka.Text = ""; } }