TransactionalNodeService.Common.TransactionOperations.SessionFinalisation.ExecuteIsCompletedQuery C# (CSharp) Method

ExecuteIsCompletedQuery() public method

public ExecuteIsCompletedQuery ( ) : bool
return bool
        public bool ExecuteIsCompletedQuery()
        {
            using (IDbConnectionAbstraction sessionDbConnection = GlymaSession.ConnectionFactory.CreateSessionDbConnection())
            {
                SqlCommand command = CreateQuerySessionCommand(sessionDbConnection.Connection);

                sessionDbConnection.Open();
                int numberOfCompleteRows = (int)command.ExecuteScalar();
                sessionDbConnection.Close();

                if (numberOfCompleteRows > 0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }

Usage Example

        public bool IsSessionCompleted(IGlymaSession glymaSession, Guid sessionId)
        {
            SessionFinalisation sessionFinalisation = new SessionFinalisation(glymaSession, sessionId);
            bool isSessionCompleted = sessionFinalisation.ExecuteIsCompletedQuery();

            return isSessionCompleted;
        }