/// <summary> /// Sets the vat based on the branch for the project. /// </summary> /// <param name="projectId">The project id.</param> private void SetVat(Guid projectId) { AccountsServiceClient accountsService = null; try { accountsService = new AccountsServiceClient(); BranchVatReturnValue returnValue = accountsService.GetBranchVatForProject(_logonSettings.LogonId, projectId); if (returnValue.Success) { if (returnValue.BranchNoVat) { _ddlVATRate.Visible = false; _txtVAT.Visible = false; _txtVAT.Text = "0.00"; } else { _ddlVATRate.Visible = true; _txtVAT.Visible = true; } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } }