protected void btnSave_Click(object sender, EventArgs e) { //Adding New Employee Records if ((ID.Text != "") || (ItemName.Text != "") || (Description.Text != "") || (ItemPrice.Text != "")) { try { ServiceReference1.Cart cart = new ServiceReference1.Cart(); cart.ID = Convert.ToInt32(ID.Text); cart.Item_Name = ItemName.Text; cart.Description = Description.Text; cart.Item_Price = ItemPrice.Text; ServiceReference1.Service1Client cl = new ServiceReference1.Service1Client(); // ServiceReference2.Service1Client client = new ServiceReference2.Service1Client(); lblMsg.Text = "Cart ID: " + cart.ID + ", " + cl.AddProdCart(cart); } catch (Exception ex) { lblMsg.Text = "Cart ID must be unique! " + ex; } } else { lblMsg.Text = "All fields are mandatory! "; lblMsg.ForeColor = System.Drawing.Color.Red; } }
protected void btnDelete_Click(object sender, EventArgs e) { ServiceReference1.Service1Client client = new ServiceReference1.Service1Client(); ServiceReference1.Cart cart = new ServiceReference1.Cart(); cart.ID = Convert.ToInt32(txtSearch.Text.Trim()); string result = client.DeleteRecords(cart); if (result == "Record Deleted Successfully!") { BindGridData(); lblSearchResult.Text = "Employee ID: " + txtSearch.Text.Trim() + "Deleted Successfully!"; } else { lblSearchResult.Text = "Employee ID: " + txtSearch.Text.Trim() + "Not Found!"; } }