protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { CustomerWebService.CustomerBAL obj = new CustomerWebService.CustomerBAL(); obj.CustomerID = Convert.ToInt64(hdnCustomerID.Value); obj.FirstName = txtFirstName.Text.Trim(); obj.LastName = txtLastName.Text.Trim(); obj.BirthDate = Convert.ToDateTime(txtBirthDate.Text.Trim()); obj.Email = txtEmail.Text.Trim(); obj.Address = txtAddress.Text.Trim(); CustomerWebService.CustomerService ws = new CustomerWebService.CustomerService(); int retVal = ws.InsertUpdateCustomer(obj); ws = null; obj = null; if (retVal > 0) { BindGrid(); ClearControls(); Page.ClientScript.RegisterStartupScript(this.GetType(), "Saved", "<script>alert('Saved successfully.');</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Saved", "<script>alert('Error while saving.');</script>"); } } }
public int InsertUpdateCustomer(CustomerBAL obj) { object[] results = this.Invoke("InsertUpdateCustomer", new object[] { obj }); return((int)(results[0])); }
/// <remarks/> public void InsertUpdateCustomerAsync(CustomerBAL obj, object userState) { if ((this.InsertUpdateCustomerOperationCompleted == null)) { this.InsertUpdateCustomerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnInsertUpdateCustomerOperationCompleted); } this.InvokeAsync("InsertUpdateCustomer", new object[] { obj }, this.InsertUpdateCustomerOperationCompleted, userState); }
/// <remarks/> public void InsertUpdateCustomerAsync(CustomerBAL obj) { this.InsertUpdateCustomerAsync(obj, null); }