private void BindTimeTransactions() { AccountsServiceClient accountsService = null; try { Guid logonId = ((LogonReturnValue)Session[SessionName.LogonSettings]).LogonId; accountsService = new AccountsServiceClient(); Guid projectId = (Guid)Session[SessionName.ProjectId]; DateTime dateTo; if (!DateTime.TryParse(this._ccUnbilledTimeUpto.DateText, out dateTo)) { throw new Exception("Unable to convert unbilled time up to value to a date"); } TimeTransactionReturnValue returnValue = accountsService.GetTimeTransaction(logonId, projectId); if (returnValue.Success) { this._grdUnBilledTime.DataSource = returnValue.Transactions.Rows.Where(transaction => transaction.Date <= dateTo); _grdUnBilledTime.DataBind(); } else { _grdUnBilledTime.DataSource = null; _grdUnBilledTime.DataBind(); throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } }