/*This is the confirm deletion button which actually deletes the row in the database and displays * the updated table*/ protected void DeleteAccountButton_Click(object sender, EventArgs e) { bool returnValue; long accountToBeDeleted = GetSelectedRecord(); ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client(); returnValue = sc.DeleteAccount(accountToBeDeleted); if (returnValue) { Label2.Text = "Account deleted successfully"; DataSet ds = sc.GetCustomerId(int.Parse(CustomerIdTextBox.Text)); //This if-else displays the updated table after deletion if (ds.Tables[0].Rows.Count == 0) { Label2.Text = "No Accounts available"; GridView1.DataSource = ds; GridView1.DataBind(); } else { Label2.Text = "Accounts available are"; GridView1.DataSource = ds; GridView1.DataBind(); } } else { Label2.Text = "Account not deleted!!"; } }
/*This is the confirm deletion button which actually deletes the row in the database and displays * the updated table*/ protected void DeleteAccountButton_Click(object sender, EventArgs e) { bool returnValue; long accountToBeDeleted = GetSelectedRecord(); ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client(); returnValue = sc.DeleteAccount(accountToBeDeleted); if (returnValue) { Label2.Text = Resources.Resource.accountDeleted; IList <Account> aobj = sc.GetCustomerId(int.Parse(CustomerIdTextBox.Text)); //This if-else displays the updated table after deletion if (aobj.Count == 0) { Label2.Text = Resources.Resource.accountNotFound; GridView1.DataSource = aobj; GridView1.DataBind(); } else { Label2.Text = Resources.Resource.accountFound; GridView1.DataSource = aobj; GridView1.DataBind(); } } else { Label2.Text = Resources.Resource.accountNotDeleted; } }