Ejemplo n.º 1
0
        public List <MessageDispatch> GetDispatchesBetweenSenderReceiver(string senderEmailAddress,
                                                                         string receiverEmailAddress,
                                                                         long messageIdThreshold,
                                                                         int numberOfMessages)
        {
            try
            {
                QueryBody queryBody = GetDispathedBetweenSenderReceiverQuery(senderEmailAddress, receiverEmailAddress,
                                                                             messageIdThreshold);

                using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(queryBody.Query, queryBody.Parameters,
                                                                      connectionString))
                {
                    List <MessageDispatch> dispatches = new List <MessageDispatch>();
                    mssqlDbEngine.ExecuteReaderQuery(dispatches, OnPopulateResultListCallBack);
                    return(dispatches);
                }
            }
            catch (Exception exception)
            {
                string message = string.Format("Error encountered when executing {0} function in MessageDispatchRepositoryMsSql. Error\n{1}",
                                               "GetAlldispatchesBetweenSenderReceiver", exception.Message);
                WriteErrorLog(message);
                throw;
            }
        }
 public Authorisation GetAuthorisationMatchingId(long id)
 {
     try
     {
         QueryBody query = GetAuthorisationMatchingIdQuery(id);
         using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(query.Query, query.Parameters,
                                                               connectionString))
         {
             List <Authorisation> authorisations = new List <Authorisation>();
             mssqlDbEngine.ExecuteReaderQuery(authorisations, OnPopulateResultListCallBack);
             return(authorisations.FirstOrDefault());
         }
     }
     catch (Exception exception)
     {
         string message = string.Format("Error encountered when executing {0} function in AuthorsationRepositoryMsSql. Error\n{1}",
                                        "Get-Authorisation-Matching-Id", exception.ToString());
         WriteErrorLog(message);
         throw;
     }
 }
 public List <Authorisation> GetAuthorisationsGreaterThanEndTime(DateTime endtime)
 {
     try
     {
         QueryBody query = GetAuthorisationGreaterThanEndTimeQuery(endtime);
         using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(query.Query, query.Parameters,
                                                               connectionString))
         {
             List <Authorisation> authorisations = new List <Authorisation>();
             mssqlDbEngine.ExecuteReaderQuery(authorisations, OnPopulateResultListCallBack);
             return(authorisations);
         }
     }
     catch (Exception exception)
     {
         string message = string.Format("Error encountered when executing {0} function in AuthorsationRepositoryMsSql. Error\n{1}",
                                        "Get-Authorisation-Greater-Than-EndTime", exception.ToString());
         WriteErrorLog(message);
         throw;
     }
 }
 public OrganisationKey GetOrganisationKeyMatchingName(string name)
 {
     try
     {
         Tuple <string, SqlParameter[]> query = GetOrganisationKeyMatchingNameQuery(name);
         using (MssqlDbEngine dbEngine = GetMssqlDbEngine(query.Item1, query.Item2,
                                                          connectionString))
         {
             List <OrganisationKey> organisationKies = new List <OrganisationKey>();
             dbEngine.ExecuteReaderQuery(organisationKies, OnPopulateResultListCallBack);
             return(organisationKies.FirstOrDefault());
         }
     }
     catch (Exception exception)
     {
         string message = string.Format("Error encountered when executing {0} function in OrganisationKeyRepositoryMsSql. Error\n{1}",
                                        "Get-OrganisationKey-Matching-Name", exception.ToString());
         WriteErrorLog(message);
         throw;
     }
 }
Ejemplo n.º 5
0
 public Access GetAccessMatchingToken(string token)
 {
     try
     {
         QueryBody query = GetAccessMatchingTokenQuery(token);
         using (MssqlDbEngine dbEngine = GetMssqlDbEngine(query.Query, query.Parameters,
                                                          connectionString))
         {
             List <Access> accesses = new List <Access>();
             dbEngine.ExecuteReaderQuery(accesses, OnPopulateResultListCallBack);
             return(accesses.FirstOrDefault());
         }
     }
     catch (Exception exception)
     {
         string message = string.Format("Error encountered when executing {0} function in AccessRepositoryMsSql. Error\n{1}",
                                        "Get-Access-Matching-Token", exception.ToString());
         WriteErrorLog(message);
         throw;
     }
 }
Ejemplo n.º 6
0
 public List <Message> GetMessagesMatchingText(string text)
 {
     try
     {
         Tuple <string, SqlParameter[]> query = GetMessageMatchingTextQuery(text);
         using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(query.Item1, query.Item2,
                                                               connectionString))
         {
             List <Message> messages = new List <Message>();
             mssqlDbEngine.ExecuteReaderQuery(messages, OnPopulateResultListCallBack);
             return(messages);
         }
     }
     catch (Exception exception)
     {
         string message = string.Format("Error encountered when executing {0} function in MessageRepositoryMsSql. Error\n{1}",
                                        "GetMessagesMatchingText", exception.Message);
         WriteErrorLog(message);
         throw;
     }
 }
Ejemplo n.º 7
0
        public MessageDispatch GetDispatchMatchingId(long dispatchId)
        {
            try
            {
                QueryBody queryBody = GetdispatchMatchingIdQuery(dispatchId);

                using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(queryBody.Query, queryBody.Parameters,
                                                                      connectionString))
                {
                    List <MessageDispatch> dispatches = new List <MessageDispatch>();
                    mssqlDbEngine.ExecuteReaderQuery(dispatches, OnPopulateResultListCallBack);
                    return(dispatches.FirstOrDefault());
                }
            }
            catch (Exception exception)
            {
                string message = string.Format("Error encountered when executing {0} function in MessageDispatchRepositoryMsSql. Error\n{1}",
                                               "GetdispatchMatchingId", exception.Message);
                WriteErrorLog(message);
                throw;
            }
        }
Ejemplo n.º 8
0
        public List <MessageDispatch> GetDispatchesNotReceivedMatchingEmail(string email)
        {
            try
            {
                QueryBody queryBody = GetDispatchesNotReceivedMatchingEmailQuery(email);

                using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(queryBody.Query, queryBody.Parameters,
                                                                      connectionString))
                {
                    List <MessageDispatch> dispatches = new List <MessageDispatch>();
                    mssqlDbEngine.ExecuteReaderQuery(dispatches, OnPopulateResultListCallBack);
                    return(dispatches);
                }
            }
            catch (Exception exception)
            {
                string message = string.Format("Error encountered when executing {0} function in MessageDispatchRepositoryMsSql. Error\n{1}",
                                               "GetDispatchesNotReceivedMatchingEmail", exception.Message);
                WriteErrorLog(message);
                throw;
            }
        }
Ejemplo n.º 9
0
 public List <MessageDispatch> GetAllDispatches()
 {
     try
     {
         string columns = GetSelectColumns(dispatchIdColumn);
         string query   = string.Format("SELECT {0} FROM {1}", columns,
                                        TableName);
         using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(query, null,
                                                               connectionString))
         {
             List <MessageDispatch> dispatches = new List <MessageDispatch>();
             mssqlDbEngine.ExecuteReaderQuery(dispatches, OnPopulateResultListCallBack);
             return(dispatches);
         }
     }
     catch (Exception exception)
     {
         string message = string.Format("Error encountered when executing {0} function in MessageDispatchRepositoryMsSql. Error\n{1}",
                                        "GetAllDispatches", exception.Message);
         WriteErrorLog(message);
         throw;
     }
 }