private void BindData() { BookStoreClient.ServiceReference1.Service1Client bo = new BookStoreClient.ServiceReference1.Service1Client("BasicHttpBinding_IService1"); DataSet ds = bo.GetAllBooks(); GridView1.DataSource = ds; GridView1.DataBind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { BookStoreClient.ServiceReference1.Service1Client bo = new BookStoreClient.ServiceReference1.Service1Client("BasicHttpBinding_IService1"); int ID = (int)e.Keys["Id"]; bo.DeleteBook(ID); // Delete here the database record for the selected patientID BindData(); }
protected void Button1_Click(object sender, EventArgs e) { BookStoreClient.ServiceReference1.Service1Client bo = new BookStoreClient.ServiceReference1.Service1Client("BasicHttpBinding_IService1"); Books b = new Books(); b.Name = TextBox1.Text; b.Price = float.Parse(TextBox4.Text); b.Author = TextBox3.Text; bo.AddBook(b); Response.Redirect("HomePage.aspx"); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { BookStoreClient.ServiceReference1.Service1Client bo = new BookStoreClient.ServiceReference1.Service1Client("BasicHttpBinding_IService1"); int ID = (int)e.Keys["Id"]; Books b = new Books(); string name = (string)e.NewValues["Name"]; string author = (string)e.NewValues["Author"]; double price = float.Parse((string)e.NewValues["Price"]); Label1.Text = name; b.ID = ID; b.Name = name; b.Price = price; b.Author = author; bo.UpdateBook(b); GridView1.EditIndex = -1; BindData(); }