public void DeleteOrganisationKey(OrganisationKey organisationKey)
 {
     try
     {
         SqlParameter[] sqlParameters = new SqlParameter[]
         {
             new SqlParameter(OrganisationKeyParameter.ID, GetDBValue(organisationKey.Id))
         };
         string sqlQuery = string.Format("DELETE FROM {0} WHERE {1} = {2}", TableName,
                                         OrganisationKeyColumn.ID,
                                         OrganisationKeyParameter.ID);
         using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(sqlQuery, sqlParameters,
                                                               connectionString))
         {
             mssqlDbEngine.ExecuteQuery();
         }
     }
     catch (Exception exception)
     {
         string eMessage = string.Format("Error encountered when executing {0} function in OrganisationKeyRepositoryMsSql. Error\n{1}",
                                         "Delete-OrganisationKey", exception.Message);
         WriteErrorLog(eMessage);
         throw;
     }
 }
Beispiel #2
0
        public void DeleteDispatch(MessageDispatch dispatch)
        {
            try
            {
                SqlParameter[] sqlParameters = new SqlParameter[]
                {
                    new SqlParameter(MessageDispatchParameter.ID, GetDBValue(dispatch.Id))
                };

                string sqlQuery = string.Format("DELETE FROM {0} WHERE {1} = {2}", TableName,
                                                MessageDispatchColumn.ID,
                                                MessageDispatchParameter.ID);

                using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(sqlQuery, sqlParameters,
                                                                      connectionString))
                {
                    mssqlDbEngine.ExecuteQuery();
                }
            }
            catch (Exception exception)
            {
                string message = string.Format("Error encountered when executing {0} function in MessageDispatchRepositoryMsSql. Error\n{1}",
                                               "Deletedispatch", exception.Message);
                WriteErrorLog(message);
                throw;
            }
        }
 public void UpdateOrganisationKey(OrganisationKey organisationKey)
 {
     try
     {
         Tuple <string, SqlParameter[]> query = GetUpdateOrganisationKeyQuery(organisationKey);
         using (MssqlDbEngine dbEngine = GetMssqlDbEngine(query.Item1, query.Item2,
                                                          connectionString))
         {
             dbEngine.ExecuteQuery();
         }
     }
     catch (Exception exception)
     {
         string message = string.Format("Error encountered when executing {0} function in OrganisationKeyRepositoryMsSql. Error\n{1}",
                                        "Update-OrganisationKey", exception.ToString());
         WriteErrorLog(message);
         throw;
     }
 }
Beispiel #4
0
 public void UpdateAccess(Access access)
 {
     try
     {
         QueryBody query = GetUpdateAccessQuery(access);
         using (MssqlDbEngine dbEngine = GetMssqlDbEngine(query.Query, query.Parameters,
                                                          connectionString))
         {
             dbEngine.ExecuteQuery();
         }
     }
     catch (Exception exception)
     {
         string message = string.Format("Error encountered when executing {0} function in AccessRepositoryMsSql. Error\n{1}",
                                        "Update-Access", exception.ToString());
         WriteErrorLog(message);
         throw;
     }
 }
Beispiel #5
0
 public void UpdateMessage(Message message) // Tuple<string, TParameter[]> query where TParameter : IDbDataParameter
 {
     try
     {
         Tuple <string, SqlParameter[]> query = GetUpdateQuery(message);
         using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(query.Item1, query.Item2,
                                                               connectionString))
         {
             mssqlDbEngine.ExecuteQuery();
         }
     }
     catch (Exception exception)
     {
         string eMessage = string.Format("Error encountered when executing {0} function in MessageRepositoryMsSql. Error\n{1}",
                                         "UpdateMessage", exception.Message);
         WriteErrorLog(eMessage);
         throw;
     }
 }
 public void DeleteAuthorisation(Authorisation authorisation)
 {
     try
     {
         QueryBody query = GetDeletionAuthorisationQuery(authorisation);
         using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(query.Query, query.Parameters,
                                                               connectionString))
         {
             mssqlDbEngine.ExecuteQuery();
         }
     }
     catch (Exception exception)
     {
         string message = string.Format("Error encountered when executing {0} in AuthorisationRepositoryMsSql. Error\n{1}",
                                        "Delete-Authorisation",
                                        exception.ToString());
         WriteErrorLog(message);
         throw;
     }
 }
Beispiel #7
0
        public void UpdateDispatch(MessageDispatch dispatch) // Tuple<string, IDbDataParameter[]> query where TParameter : IDbDataParameter
        {
            try
            {
                QueryBody queryBody = GetDefaultDispatchUpdateQuery(dispatch);

                using (MssqlDbEngine mssqlDbEngine = GetMssqlDbEngine(queryBody.Query, queryBody.Parameters,
                                                                      connectionString))
                {
                    mssqlDbEngine.ExecuteQuery();
                }
            }
            catch (Exception exception)
            {
                string message = string.Format("Error encountered when executing {0} function in MessageDispatchRepositoryMsSql. Error\n{1}",
                                               "Updatedispatch", exception.Message);
                WriteErrorLog(message);
                throw;
            }
        }