public void UpdateCharityEvent(CharityEvents incEvent) { DatabaseWork work; object[] parameters; try { // Call the database transaction work = new DatabaseWork(UpdateCharityEventTransaction); parameters = new object[1] { incEvent }; PerformDatabaseTransaction(work, ref parameters); } catch (Exception ex) { throw ex; } finally { parameters = null; work = null; } }
public CharityEvents GetEventByEgiftId(string id, string program) { DatabaseWork work; object[] parameters; CharityEvents result = null; try { // Call the database transaction work = new DatabaseWork(GetEventByEgiftIdTransaction); parameters = new object[3] { id, program, null }; PerformDatabaseTransaction(work, ref parameters); if (parameters[2] != null) { result = (CharityEvents)parameters[2]; } } catch (Exception ex) { throw ex; } finally { parameters = null; work = null; } return result; }
private void PerformDatabaseTransaction(DatabaseWork performDatabaseWork, ref object[] parameters) { try { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); performDatabaseWork(connection, null, parameters); } } catch (Exception ex) { //LogService.LogService.Log(LogEvent.enmEventType.Error, ex.Message, ex.StackTrace); throw; } }
public int? CheckForFund(Guid userid) { DatabaseWork work; object[] parameters; int? result = null; try { // Call the database transaction work = new DatabaseWork(CheckForFundTransaction); parameters = new object[2] { userid, null }; PerformDatabaseTransaction(work, ref parameters); if(parameters[1] != null) { result = (int)parameters[1]; } } catch (Exception ex) { throw ex; } finally { parameters = null; work = null; } return result; }