/// <summary> /// Updates the KeyCount on an Extract. /// </summary> /// <param name="AExtractId">ExtractId of the Extract that the KeyCount should /// get updated for.</param> /// <param name="ACount">New Key Count.</param> /// <param name="AVerificationResult">Contains errors or DB call exceptions, if there are any.</param> /// <returns>True if the updating was successful, otherwise false.</returns> public static bool UpdateExtractKeyCount(int AExtractId, int ACount, out TVerificationResultCollection AVerificationResult) { TDBTransaction Transaction = null; bool SubmissionOK = false; TVerificationResultCollection VerificationResult = new TVerificationResultCollection(); DBAccess.GDBAccessObj.GetNewOrExistingAutoTransaction(IsolationLevel.Serializable, ref Transaction, ref SubmissionOK, delegate { MExtractMasterTable ExtractMasterDT = MExtractMasterAccess.LoadByPrimaryKey(AExtractId, Transaction); if (ExtractMasterDT.Rows.Count == 1) { ExtractMasterDT[0].KeyCount = ACount; MExtractMasterAccess.SubmitChanges(ExtractMasterDT, Transaction); SubmissionOK = true; } else { VerificationResult.Add(new TVerificationResult( "TExtractsHandling.UpdateExtractCount", "Extract with Extract Id " + AExtractId.ToString() + " doesn't exist!", TResultSeverity.Resv_Critical)); } }); AVerificationResult = VerificationResult; return(SubmissionOK); }
/// <summary> /// Returns the Key Count of an Extract. /// </summary> /// <param name="AExtractId">ExtractId of the Extract that the KeyCount should /// get returned for.</param> /// <returns>The Key Count of the Extract, or -1 if the Extract with the given /// Extract Id doesn't exist.</returns> public static Int32 GetExtractKeyCount(int AExtractId) { Boolean NewTransaction; TDBTransaction ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, out NewTransaction); try { MExtractMasterTable ExtractDT = MExtractMasterAccess.LoadByPrimaryKey(AExtractId, ReadTransaction); if (ExtractDT.Rows.Count == 1) { return(ExtractDT[0].KeyCount); } else { return(-1); } } finally { if (NewTransaction) { DBAccess.GDBAccessObj.CommitTransaction(); TLogging.LogAtLevel(8, "TExtractsHandling.GetExtractKeyCount: committed own transaction."); } } }
public static Boolean GetExtractDescription(String AExtractName, out String AExtractDescription) { TDBTransaction ReadTransaction; Boolean NewTransaction; Boolean ReturnValue = false; AExtractDescription = "Can not retrieve description"; TLogging.LogAtLevel(9, "TPartnerServerLookups.GetExtractDescription called!"); MExtractMasterTable ExtractMasterDT = new MExtractMasterTable(); ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, out NewTransaction); // Load data MExtractMasterTable TemplateExtractDT = new MExtractMasterTable(); MExtractMasterRow TemplateRow = TemplateExtractDT.NewRowTyped(false); TemplateRow.ExtractName = AExtractName; try { ExtractMasterDT = MExtractMasterAccess.LoadUsingTemplate(TemplateRow, ReadTransaction); } finally { if (NewTransaction) { DBAccess.GDBAccessObj.CommitTransaction(); TLogging.LogAtLevel(7, "TPartnerServerLookups.GetExtractDescription: committed own transaction."); } } if (ExtractMasterDT.Rows.Count < 1) { ReturnValue = false; TLogging.LogAtLevel(7, "TPartnerServerLookups.TPartnerServerLookups.GetExtractDescription: m_extract_master DB Table is empty"); } else { MExtractMasterRow ExtractRow = ExtractMasterDT.Rows[0] as MExtractMasterRow; if (ExtractRow != null) { AExtractDescription = ExtractRow.ExtractDesc; ReturnValue = true; } } return(ReturnValue); }
/// <summary> /// Deletes an Extract. /// </summary> /// <param name="AExtractId">ExtractId of the Extract that should get /// deleted.</param> /// <param name="AExtractNotDeletable">True if the Deletable Flag of the /// Extract if false.</param> /// <param name="AVerificationResult">Nil if all verifications are OK, /// otherwise filled with a TVerificationResult object.</param> /// <returns>True if the Extract was deleted, otherwise false.</returns> public static bool DeleteExtract(int AExtractId, out bool AExtractNotDeletable, out TVerificationResult AVerificationResult) { TDBTransaction Transaction = null; bool SubmissionOK = false; MExtractMasterTable ExtractMasterDT; Boolean ExtractNotDeletable = false; TVerificationResult VerificationResult = null; DBAccess.GDBAccessObj.GetNewOrExistingAutoTransaction(IsolationLevel.Serializable, ref Transaction, ref SubmissionOK, delegate { ExtractMasterDT = MExtractMasterAccess.LoadByPrimaryKey(AExtractId, Transaction); if (ExtractMasterDT.Rows.Count == 1) { if (ExtractMasterDT[0].Deletable) { MExtractMasterCascading.DeleteByPrimaryKey(AExtractId, Transaction, true); SubmissionOK = true; } else { ExtractNotDeletable = true; SubmissionOK = false; } } else { VerificationResult = new TVerificationResult( "TExtractsHandling.DeleteExtract", "Extract with Extract Id " + AExtractId.ToString() + "doesn't exist!", TResultSeverity.Resv_Critical); SubmissionOK = false; } }); AVerificationResult = VerificationResult; AExtractNotDeletable = ExtractNotDeletable; return(SubmissionOK); }
/// <summary> /// Checks whether an Extract with a certain Extract Name exists. /// </summary> /// <param name="AExtractName">Name of the Extract to check for.</param> /// <returns>True if an Extract with the specified Extract Name exists, /// otherwise false.</returns> public static bool CheckExtractExists(string AExtractName) { TDBTransaction ReadTransaction; Boolean NewTransaction; Boolean ReturnValue = false; MExtractMasterRow TemplateRow; ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, out NewTransaction); // Check if there is already an extract with the extract name try { TemplateRow = new MExtractMasterTable().NewRowTyped(false); TemplateRow.ExtractName = AExtractName; if (MExtractMasterAccess.CountUsingTemplate(TemplateRow, null, ReadTransaction) > 0) { ReturnValue = true; } if (NewTransaction) { DBAccess.GDBAccessObj.CommitTransaction(); TLogging.LogAtLevel(8, "TExtractsHandling.CheckExtractExists: committed own transaction!"); } } catch (Exception Exc) { TLogging.Log("An Exception occured during the checking whether an Extract exists:" + Environment.NewLine + Exc.ToString()); if (NewTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); } throw; } return(ReturnValue); }
/// <summary> /// Checks whether an Extract with a certain Extract Name exists. /// </summary> /// <param name="AExtractName">Name of the Extract to check for.</param> /// <returns>True if an Extract with the specified Extract Name exists, /// otherwise false.</returns> public static bool CheckExtractExists(string AExtractName) { TDBTransaction Transaction = new TDBTransaction(); Boolean ReturnValue = false; MExtractMasterRow TemplateRow; DBAccess.ReadTransaction( ref Transaction, delegate { // Check if there is already an extract with the extract name TemplateRow = new MExtractMasterTable().NewRowTyped(false); TemplateRow.ExtractName = AExtractName; if (MExtractMasterAccess.CountUsingTemplate(TemplateRow, null, Transaction) > 0) { ReturnValue = true; } }); return(ReturnValue); }
/// <summary> /// Checks whether an Extract with a certain Extract Name exists. /// </summary> /// <param name="AExtractName">Name of the Extract to check for.</param> /// <returns>True if an Extract with the specified Extract Name exists, /// otherwise false.</returns> public static bool CheckExtractExists(string AExtractName) { TDBTransaction Transaction = null; Boolean ReturnValue = false; MExtractMasterRow TemplateRow; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref Transaction, delegate { // Check if there is already an extract with the extract name TemplateRow = new MExtractMasterTable().NewRowTyped(false); TemplateRow.ExtractName = AExtractName; if (MExtractMasterAccess.CountUsingTemplate(TemplateRow, null, Transaction) > 0) { ReturnValue = true; } }); return(ReturnValue); }
/// <summary> /// Returns the Key Count of an Extract. /// </summary> /// <param name="AExtractId">ExtractId of the Extract that the KeyCount should /// get returned for.</param> /// <returns>The Key Count of the Extract, or -1 if the Extract with the given /// Extract Id doesn't exist.</returns> public static Int32 GetExtractKeyCount(int AExtractId) { TDBTransaction Transaction = new TDBTransaction(); Int32 KeyCount = 0; DBAccess.ReadTransaction( ref Transaction, delegate { MExtractMasterTable ExtractDT = MExtractMasterAccess.LoadByPrimaryKey(AExtractId, Transaction); if (ExtractDT.Rows.Count == 1) { KeyCount = ExtractDT[0].KeyCount; } else { KeyCount = -1; } }); return(KeyCount); }
/// <summary> /// Returns the Key Count of an Extract. /// </summary> /// <param name="AExtractId">ExtractId of the Extract that the KeyCount should /// get returned for.</param> /// <returns>The Key Count of the Extract, or -1 if the Extract with the given /// Extract Id doesn't exist.</returns> public static Int32 GetExtractKeyCount(int AExtractId) { TDBTransaction Transaction = null; Int32 KeyCount = 0; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref Transaction, delegate { MExtractMasterTable ExtractDT = MExtractMasterAccess.LoadByPrimaryKey(AExtractId, Transaction); if (ExtractDT.Rows.Count == 1) { KeyCount = ExtractDT[0].KeyCount; } else { KeyCount = -1; } }); return(KeyCount); }
/// <summary> /// extend an extract from a list of best addresses /// </summary> /// <param name="AExtractId">Extract Id of the Extract to extend</param> /// <param name="APartnerKeysTable"></param> /// <param name="APartnerKeyColumn">number of the column that contains the partner keys</param> /// <param name="ASiteKeyColumn">number of the column that contains the site keys</param> /// <param name="ALocationKeyColumn">number of the column that contains the location keys</param> /// <param name="AIgnoreDuplicates">true if duplicates should be looked out for. Can be set to false if called only once and not several times per extract.</param> public static void ExtendExtractFromListOfPartnerKeys( Int32 AExtractId, DataTable APartnerKeysTable, Int32 APartnerKeyColumn, Int32 ASiteKeyColumn, Int32 ALocationKeyColumn, bool AIgnoreDuplicates) { int RecordCounter = 0; PPartnerLocationTable PartnerLocationKeysTable; Int64 PartnerKey; TDBTransaction Transaction = null; bool SubmissionOK = true; DBAccess.GDBAccessObj.GetNewOrExistingAutoTransaction(IsolationLevel.Serializable, ref Transaction, ref SubmissionOK, delegate { MExtractTable ExtractTable = new MExtractTable(); ExtractTable = MExtractAccess.LoadViaMExtractMaster(AExtractId, Transaction); // Location Keys need to be determined as extracts do not only need partner keys but // also Location Keys. DetermineBestLocationKeys(APartnerKeysTable, APartnerKeyColumn, ASiteKeyColumn, ALocationKeyColumn, out PartnerLocationKeysTable, Transaction); // use the returned table which contains partner and location keys to build the extract foreach (PPartnerLocationRow PartnerLocationRow in PartnerLocationKeysTable.Rows) { PartnerKey = Convert.ToInt64(PartnerLocationRow[PPartnerLocationTable.GetPartnerKeyDBName()]); if (PartnerKey > 0) { RecordCounter += 1; TLogging.LogAtLevel(1, "Preparing Partner " + PartnerKey + " (Record Number " + RecordCounter + ")"); // add row for partner to extract and fill with contents MExtractRow NewRow = ExtractTable.NewRowTyped(); NewRow.ExtractId = AExtractId; NewRow.PartnerKey = PartnerKey; NewRow.SiteKey = Convert.ToInt64(PartnerLocationRow[PPartnerLocationTable.GetSiteKeyDBName()]); NewRow.LocationKey = Convert.ToInt32(PartnerLocationRow[PPartnerLocationTable.GetLocationKeyDBName()]); // only add row if it does not already exist for this partner if (AIgnoreDuplicates || !ExtractTable.Rows.Contains(new object[] { NewRow.ExtractId, NewRow.PartnerKey, NewRow.SiteKey })) { ExtractTable.Rows.Add(NewRow); } } } if (ExtractTable.Rows.Count > 0) { // update field in extract master for quick access to number of partners in extract MExtractMasterTable ExtractMaster = MExtractMasterAccess.LoadByPrimaryKey(AExtractId, Transaction); ExtractMaster[0].KeyCount = ExtractTable.Rows.Count; ExtractTable.ThrowAwayAfterSubmitChanges = true; // no need to keep data as this increases speed significantly MExtractAccess.SubmitChanges(ExtractTable, Transaction); MExtractMasterAccess.SubmitChanges(ExtractMaster, Transaction); } }); }
/// <summary> /// Creates a new extract with the given extract name and extract description in the /// m_extract_master data table. The Extract Id and the Extract Name must both be /// unique in the Petra Database. /// </summary> /// <param name="AExtractName">Name of the Extract to be created.</param> /// <param name="AExtractDescription">Description of the Extract to be created.</param> /// <param name="ANewExtractId">Extract Id of the created Extract, or -1 if the /// creation of the Extract was not successful.</param> /// <param name="AExtractAlreadyExists">True if there is already an extract with /// the given name, otherwise false.</param> /// <returns>True if the new Extract was created, otherwise false.</returns> public static bool CreateNewExtract(String AExtractName, String AExtractDescription, out Int32 ANewExtractId, out Boolean AExtractAlreadyExists) { TDBTransaction Transaction = null; Boolean ReturnValue = false; bool SubmissionOK = false; MExtractMasterTable NewExtractMasterDT = null; MExtractMasterRow TemplateRow = null; Boolean ExtractAlreadyExists = false; Int32 NewExtractId = -1; TLogging.LogAtLevel(9, "CreateNewExtract called!"); DBAccess.GDBAccessObj.GetNewOrExistingAutoTransaction(IsolationLevel.Serializable, ref Transaction, ref SubmissionOK, delegate { // Check if there is already an extract with the extract name if (!CheckExtractExists(AExtractName)) { // The extract name is unique. So create the new extract... NewExtractMasterDT = new MExtractMasterTable(); TemplateRow = (MExtractMasterRow)NewExtractMasterDT.NewRowTyped(true); TemplateRow.ExtractName = AExtractName; TemplateRow.ExtractDesc = AExtractDescription; TemplateRow.ExtractId = -1; // initialize id negative so sequence can be used NewExtractMasterDT.Rows.Add(TemplateRow); MExtractMasterAccess.SubmitChanges(NewExtractMasterDT, Transaction); // Get the Extract Id TemplateRow = (MExtractMasterRow)NewExtractMasterDT.Rows[0]; NewExtractId = TemplateRow.ExtractId; SubmissionOK = true; ReturnValue = true; } else { ExtractAlreadyExists = true; ReturnValue = false; } if (ReturnValue) { SubmissionOK = true; } else { SubmissionOK = false; } }); // Get the Extract Id // if (NewExtractMasterDT != null) // { // TemplateRow = (MExtractMasterRow)NewExtractMasterDT.Rows[0]; // ANewExtractId = TemplateRow.ExtractId; // } ANewExtractId = NewExtractId; AExtractAlreadyExists = ExtractAlreadyExists; return(ReturnValue); }
/// <summary> /// Updates the KeyCount on an Extract. /// </summary> /// <param name="AExtractId">ExtractId of the Extract that the KeyCount should /// get updated for.</param> /// <param name="ACount">New Key Count.</param> /// <param name="AVerificationResult">Contains errors or DB call exceptions, if there are any.</param> /// <returns>True if the updating was successful, otherwise false.</returns> public static bool UpdateExtractKeyCount(int AExtractId, int ACount, out TVerificationResultCollection AVerificationResult) { Boolean NewTransaction; Boolean Success = true; AVerificationResult = null; TDBTransaction WriteTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction( IsolationLevel.Serializable, TEnforceIsolationLevel.eilMinimum, out NewTransaction); try { MExtractMasterTable ExtractMasterDT = MExtractMasterAccess.LoadByPrimaryKey(AExtractId, WriteTransaction); if (ExtractMasterDT.Rows.Count == 1) { ExtractMasterDT[0].KeyCount = ACount; MExtractMasterAccess.SubmitChanges(ExtractMasterDT, WriteTransaction); } else { AVerificationResult.Add(new TVerificationResult( "TExtractsHandling.UpdateExtractCount", "Extract with Extract Id " + AExtractId.ToString() + " doesn't exist!", TResultSeverity.Resv_Critical)); Success = false; } if (Success) { if (NewTransaction) { DBAccess.GDBAccessObj.CommitTransaction(); TLogging.LogAtLevel(8, "TExtractsHandling.UpdateExtractCount: committed own transaction!"); } } else { if (NewTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); TLogging.LogAtLevel(8, "TExtractsHandling.UpdateExtractCount: ROLLED BACK own transaction!"); } } } catch (Exception Exc) { TLogging.Log("An Exception occured during the updating of an Extracts' Key Count:" + Environment.NewLine + Exc.ToString()); if (NewTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); } throw; } return(Success); }
/// <summary> /// Deletes an Extract. /// </summary> /// <param name="AExtractId">ExtractId of the Extract that should get /// deleted.</param> /// <param name="AExtractNotDeletable">True if the Deletable Flag of the /// Extract if false.</param> /// <param name="AVerificationResult">Nil if all verifications are OK, /// otherwise filled with a TVerificationResult object.</param> /// <returns>True if the Extract was deleted, otherwise false.</returns> public static bool DeleteExtract(int AExtractId, out bool AExtractNotDeletable, out TVerificationResult AVerificationResult) { TDBTransaction WriteTransaction; MExtractMasterTable ExtractMasterDT; Boolean NewTransaction; Boolean Success = false; AVerificationResult = null; AExtractNotDeletable = false; WriteTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction( IsolationLevel.Serializable, TEnforceIsolationLevel.eilMinimum, out NewTransaction); try { ExtractMasterDT = MExtractMasterAccess.LoadByPrimaryKey(AExtractId, WriteTransaction); if (ExtractMasterDT.Rows.Count == 1) { if (ExtractMasterDT[0].Deletable) { MExtractMasterCascading.DeleteByPrimaryKey(AExtractId, WriteTransaction, true); Success = true; } else { AExtractNotDeletable = true; Success = false; } } else { AVerificationResult = new TVerificationResult( "TExtractsHandling.DeleteExtract", "Extract with Extract Id " + AExtractId.ToString() + "doesn't exist!", TResultSeverity.Resv_Critical); Success = false; } } catch (Exception Exp) { TLogging.LogAtLevel(8, "TExtractsHandling.DeleteExtract: Exception occured: " + Exp.ToString()); throw; } finally { if (Success) { if (NewTransaction) { DBAccess.GDBAccessObj.CommitTransaction(); TLogging.LogAtLevel(8, "TExtractsHandling.DeleteExtract: committed own transaction!"); } } else { if (NewTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); TLogging.LogAtLevel(8, "TExtractsHandling.DeleteExtract: ROLLED BACK own transaction!"); } } } return(Success); }
public static bool GetData(string ATablename, TSearchCriteria[] ASearchCriteria, out TTypedDataTable AResultTable) { // TODO: check access permissions for the current user TDBTransaction ReadTransaction = null; TTypedDataTable tempTable = null; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.RepeatableRead, TEnforceIsolationLevel.eilMinimum, ref ReadTransaction, delegate { // TODO: auto generate if (ATablename == AApSupplierTable.GetTableDBName()) { tempTable = AApSupplierAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == AApDocumentTable.GetTableDBName()) { tempTable = AApDocumentAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == ATransactionTypeTable.GetTableDBName()) { tempTable = ATransactionTypeAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == ACurrencyTable.GetTableDBName()) { tempTable = ACurrencyAccess.LoadAll(ReadTransaction); } else if (ATablename == ADailyExchangeRateTable.GetTableDBName()) { tempTable = ADailyExchangeRateAccess.LoadAll(ReadTransaction); } else if (ATablename == ACorporateExchangeRateTable.GetTableDBName()) { tempTable = ACorporateExchangeRateAccess.LoadAll(ReadTransaction); } else if (ATablename == ACurrencyLanguageTable.GetTableDBName()) { tempTable = ACurrencyLanguageAccess.LoadAll(ReadTransaction); } else if (ATablename == AFeesPayableTable.GetTableDBName()) { tempTable = AFeesPayableAccess.LoadAll(ReadTransaction); } else if (ATablename == AFeesReceivableTable.GetTableDBName()) { tempTable = AFeesReceivableAccess.LoadAll(ReadTransaction); } else if (ATablename == AAnalysisTypeTable.GetTableDBName()) { tempTable = AAnalysisTypeAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == AGiftBatchTable.GetTableDBName()) { tempTable = AGiftBatchAccess.LoadAll(ReadTransaction); } else if (ATablename == AJournalTable.GetTableDBName()) { tempTable = AJournalAccess.LoadAll(ReadTransaction); } else if (ATablename == ALedgerTable.GetTableDBName()) { tempTable = ALedgerAccess.LoadAll(ReadTransaction); } else if (ATablename == MExtractMasterTable.GetTableDBName()) { if (ASearchCriteria == null) { tempTable = MExtractMasterAccess.LoadAll(ReadTransaction); } else { tempTable = MExtractMasterAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } } else if (ATablename == MExtractTable.GetTableDBName()) { // it does not make sense to load ALL extract rows for all extract masters so search criteria needs to be set if (ASearchCriteria != null) { tempTable = MExtractAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } } else if (ATablename == PcAttendeeTable.GetTableDBName()) { tempTable = PcAttendeeAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == PcConferenceCostTable.GetTableDBName()) { tempTable = PcConferenceCostAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == PcEarlyLateTable.GetTableDBName()) { tempTable = PcEarlyLateAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == PcSupplementTable.GetTableDBName()) { tempTable = PcSupplementAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == PcDiscountTable.GetTableDBName()) { tempTable = PcDiscountAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == PFormTable.GetTableDBName()) { string[] columns = TTypedDataTable.GetColumnStringList(PFormTable.TableId); StringCollection fieldList = new StringCollection(); for (int i = 0; i < columns.Length; i++) { // Do not load the template document - we don't display it and it is big! if (columns[i] != PFormTable.GetTemplateDocumentDBName()) { fieldList.Add(columns[i]); } } tempTable = PFormAccess.LoadAll(fieldList, ReadTransaction); } else if (ATablename == PInternationalPostalTypeTable.GetTableDBName()) { tempTable = PInternationalPostalTypeAccess.LoadAll(ReadTransaction); } else if (ATablename == PtApplicationTypeTable.GetTableDBName()) { tempTable = PtApplicationTypeAccess.LoadAll(ReadTransaction); } else if (ATablename == PFormalityTable.GetTableDBName()) { tempTable = PFormalityAccess.LoadAll(ReadTransaction); } else if (ATablename == PMailingTable.GetTableDBName()) { tempTable = PMailingAccess.LoadAll(ReadTransaction); } else if (ATablename == PPartnerGiftDestinationTable.GetTableDBName()) { tempTable = PPartnerGiftDestinationAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == PmDocumentTypeTable.GetTableDBName()) { tempTable = PmDocumentTypeAccess.LoadAll(ReadTransaction); } else if (ATablename == SGroupTable.GetTableDBName()) { tempTable = SGroupAccess.LoadAll(ReadTransaction); } else { throw new Exception("TCommonDataReader.GetData: unknown table " + ATablename); } }); // Accept row changes here so that the Client gets 'unmodified' rows tempTable.AcceptChanges(); // return the table AResultTable = tempTable; return(true); }
/// <summary> /// extend an extract from a list of best addresses /// </summary> /// <param name="AExtractId">Extract Id of the Extract to extend</param> /// <param name="APartnerKeysTable"></param> /// <param name="APartnerKeyColumn">number of the column that contains the partner keys</param> /// <param name="ASiteKeyColumn">number of the column that contains the site keys</param> /// <param name="ALocationKeyColumn">number of the column that contains the location keys</param> /// <param name="AIgnoreDuplicates">true if duplicates should be looked out for. Can be set to false if called only once and not several times per extract.</param> /// <param name="ACommitTransaction">true if transaction should be committed at end of method</param> public static void ExtendExtractFromListOfPartnerKeys( Int32 AExtractId, DataTable APartnerKeysTable, Int32 APartnerKeyColumn, Int32 ASiteKeyColumn, Int32 ALocationKeyColumn, bool AIgnoreDuplicates, bool ACommitTransaction) { Boolean NewTransaction; int RecordCounter = 0; PPartnerLocationTable PartnerLocationKeysTable; Int64 PartnerKey; TDBTransaction WriteTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.Serializable, TEnforceIsolationLevel.eilMinimum, out NewTransaction); try { MExtractTable ExtractTable = new MExtractTable(); ExtractTable = MExtractAccess.LoadViaMExtractMaster(AExtractId, WriteTransaction); // Location Keys need to be determined as extracts do not only need partner keys but // also Location Keys. DetermineBestLocationKeys(APartnerKeysTable, APartnerKeyColumn, ASiteKeyColumn, ALocationKeyColumn, out PartnerLocationKeysTable, WriteTransaction); // use the returned table which contains partner and location keys to build the extract foreach (PPartnerLocationRow PartnerLocationRow in PartnerLocationKeysTable.Rows) { PartnerKey = Convert.ToInt64(PartnerLocationRow[PPartnerLocationTable.GetPartnerKeyDBName()]); if (PartnerKey > 0) { RecordCounter += 1; TLogging.Log("Preparing Partner " + PartnerKey.ToString() + " (Record Number " + RecordCounter.ToString() + ")"); // add row for partner to extract and fill with contents MExtractRow NewRow = ExtractTable.NewRowTyped(); NewRow.ExtractId = AExtractId; NewRow.PartnerKey = PartnerKey; NewRow.SiteKey = Convert.ToInt64(PartnerLocationRow[PPartnerLocationTable.GetSiteKeyDBName()]); NewRow.LocationKey = Convert.ToInt32(PartnerLocationRow[PPartnerLocationTable.GetLocationKeyDBName()]); // only add row if it does not already exist for this partner if (AIgnoreDuplicates || !ExtractTable.Rows.Contains(new object[] { NewRow.ExtractId, NewRow.PartnerKey, NewRow.SiteKey })) { ExtractTable.Rows.Add(NewRow); } } } if (ExtractTable.Rows.Count > 0) { // update field in extract master for quick access to number of partners in extract MExtractMasterTable ExtractMaster = MExtractMasterAccess.LoadByPrimaryKey(AExtractId, WriteTransaction); ExtractMaster[0].KeyCount = ExtractTable.Rows.Count; ExtractTable.ThrowAwayAfterSubmitChanges = true; // no need to keep data as this increases speed significantly MExtractAccess.SubmitChanges(ExtractTable, WriteTransaction); MExtractMasterAccess.SubmitChanges(ExtractMaster, WriteTransaction); } if (ACommitTransaction) { DBAccess.GDBAccessObj.CommitTransaction(); } } catch (Exception Exc) { TLogging.Log("An Exception occured while extending an Extract from a list of Partner Keys:" + Environment.NewLine + Exc.ToString()); if (NewTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); } throw; } }
/// <summary> /// extend an extract from a list of best addresses /// </summary> /// <param name="AExtractId">Extract Id of the Extract to extend</param> /// <param name="APartnerKeysTable"></param> /// <param name="APartnerKeyColumn">number of the column that contains the partner keys</param> /// <param name="ASiteKeyColumn">number of the column that contains the site keys</param> /// <param name="ALocationKeyColumn">number of the column that contains the location keys</param> /// <param name="AKeyCount">The number of keys that were actually added to the extract (any duplicates are excluded)</param> /// <param name="AIgnoredKeyList">A reference to a List of long. If not null the server will fill it with the partner keys that were ignored. Does not include duplicates.</param> /// <param name="AIgnoreDuplicates">true if duplicates should be looked out for. Can be set to false if called only once and not several times per extract.</param> /// <param name="AIgnoreInactive">true if inactive partners should be ignored</param> /// <param name="AIgnoreNonMailingLocations">true to ignore if the partner's best address is a non-mailing location</param> /// <param name="AIgnoreNoSolicitations">true to ignore partners where the No Solicitations flag is set</param> public static void ExtendExtractFromListOfPartnerKeys( Int32 AExtractId, DataTable APartnerKeysTable, Int32 APartnerKeyColumn, Int32 ASiteKeyColumn, Int32 ALocationKeyColumn, out Int32 AKeyCount, out List <long> AIgnoredKeyList, bool AIgnoreDuplicates, bool AIgnoreInactive, bool AIgnoreNonMailingLocations, bool AIgnoreNoSolicitations) { int RecordCounter = 0; PPartnerLocationTable PartnerLocationKeysTable; Int64 PartnerKey; List <long> ignoredKeyList = new List <long>(); TDBTransaction Transaction = null; bool SubmissionOK = true; DBAccess.GDBAccessObj.GetNewOrExistingAutoTransaction(IsolationLevel.Serializable, ref Transaction, ref SubmissionOK, delegate { // Pre-process the table to remove partner rows that do not match the filter requirements for (int i = APartnerKeysTable.Rows.Count - 1; i >= 0; i--) { DataRow dr = APartnerKeysTable.Rows[i]; Int64 partnerKey = Convert.ToInt64(dr[APartnerKeyColumn]); // Get a partner record containing our fields of interest StringCollection fields = new StringCollection(); fields.Add(PPartnerTable.GetStatusCodeDBName()); fields.Add(PPartnerTable.GetNoSolicitationsDBName()); DataTable dt = PPartnerAccess.LoadByPrimaryKey(partnerKey, fields, Transaction); if (dt.Rows.Count > 0) { if (AIgnoreInactive || AIgnoreNoSolicitations) { bool isActive = false; bool isNoSolicitation = false; object o = dt.Rows[0][PPartnerTable.GetStatusCodeDBName()]; if (o != null) { TStdPartnerStatusCode statusCode = SharedTypes.StdPartnerStatusCodeStringToEnum(o.ToString()); isActive = (statusCode == TStdPartnerStatusCode.spscACTIVE); } o = dt.Rows[0][PPartnerTable.GetNoSolicitationsDBName()]; if (o != null) { isNoSolicitation = Convert.ToBoolean(o); } if ((AIgnoreInactive && !isActive) || (AIgnoreNoSolicitations && isNoSolicitation)) { ignoredKeyList.Add(partnerKey); APartnerKeysTable.Rows.Remove(dr); } } } else { ignoredKeyList.Add(partnerKey); } } MExtractTable ExtractTable = new MExtractTable(); ExtractTable = MExtractAccess.LoadViaMExtractMaster(AExtractId, Transaction); // Location Keys need to be determined as extracts do not only need partner keys but // also Location Keys. DetermineBestLocationKeys(APartnerKeysTable, APartnerKeyColumn, ASiteKeyColumn, ALocationKeyColumn, out PartnerLocationKeysTable, Transaction); // use the returned table which contains partner and location keys to build the extract foreach (PPartnerLocationRow PartnerLocationRow in PartnerLocationKeysTable.Rows) { PartnerKey = PartnerLocationRow.PartnerKey; if (PartnerKey > 0) { if (AIgnoreNonMailingLocations) { // The PartnerLocationRow only contains the PK fields so now we need to get the SendMail column StringCollection fields = new StringCollection(); fields.Add(PPartnerLocationTable.GetSendMailDBName()); PPartnerLocationTable t = PPartnerLocationAccess.LoadByPrimaryKey(PartnerKey, PartnerLocationRow.SiteKey, PartnerLocationRow.LocationKey, fields, Transaction); if ((t != null) && (t.Rows.Count > 0) && (((PPartnerLocationRow)t.Rows[0]).SendMail == false)) { ignoredKeyList.Add(PartnerKey); continue; } } RecordCounter += 1; TLogging.LogAtLevel(1, "Preparing Partner " + PartnerKey + " (Record Number " + RecordCounter + ")"); // add row for partner to extract and fill with contents MExtractRow NewRow = ExtractTable.NewRowTyped(); NewRow.ExtractId = AExtractId; NewRow.PartnerKey = PartnerKey; NewRow.SiteKey = Convert.ToInt64(PartnerLocationRow[PPartnerLocationTable.GetSiteKeyDBName()]); NewRow.LocationKey = Convert.ToInt32(PartnerLocationRow[PPartnerLocationTable.GetLocationKeyDBName()]); // only add row if it does not already exist for this partner if (AIgnoreDuplicates || !ExtractTable.Rows.Contains(new object[] { NewRow.ExtractId, NewRow.PartnerKey, NewRow.SiteKey })) { ExtractTable.Rows.Add(NewRow); } } } if (ExtractTable.Rows.Count > 0) { // update field in extract master for quick access to number of partners in extract MExtractMasterTable ExtractMaster = MExtractMasterAccess.LoadByPrimaryKey(AExtractId, Transaction); ExtractMaster[0].KeyCount = ExtractTable.Rows.Count; ExtractTable.ThrowAwayAfterSubmitChanges = true; // no need to keep data as this increases speed significantly MExtractAccess.SubmitChanges(ExtractTable, Transaction); MExtractMasterAccess.SubmitChanges(ExtractMaster, Transaction); } }); AKeyCount = RecordCounter; AIgnoredKeyList = ignoredKeyList; }
/// <summary> /// Creates a new extract with the given extract name and extract description in the /// m_extract_master data table. The Extract Id and the Extract Name must both be /// unique in the Petra Database. /// </summary> /// <param name="AExtractName">Name of the Extract to be created.</param> /// <param name="AExtractDescription">Description of the Extract to be created.</param> /// <param name="ANewExtractId">Extract Id of the created Extract, or -1 if the /// creation of the Extract was not successful.</param> /// <param name="AExtractAlreadyExists">True if there is already an extract with /// the given name, otherwise false.</param> /// <returns>True if the new Extract was created, otherwise false.</returns> public static bool CreateNewExtract(String AExtractName, String AExtractDescription, out Int32 ANewExtractId, out Boolean AExtractAlreadyExists) { TDBTransaction WriteTransaction; Boolean NewTransaction; Boolean ReturnValue = false; ANewExtractId = -1; AExtractAlreadyExists = false; TLogging.LogAtLevel(9, "CreateNewExtract called!"); WriteTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.Serializable, TEnforceIsolationLevel.eilMinimum, out NewTransaction); try { // Check if there is already an extract with the extract name if (!CheckExtractExists(AExtractName)) { // The extract name is unique. So create the new extract... MExtractMasterTable NewExtractMasterDT = new MExtractMasterTable(); MExtractMasterRow TemplateRow = (MExtractMasterRow)NewExtractMasterDT.NewRowTyped(true); TemplateRow.ExtractName = AExtractName; TemplateRow.ExtractDesc = AExtractDescription; TemplateRow.ExtractId = -1; // initialize id negative so sequence can be used NewExtractMasterDT.Rows.Add(TemplateRow); MExtractMasterAccess.SubmitChanges(NewExtractMasterDT, WriteTransaction); // Get the Extract Id TemplateRow = (MExtractMasterRow)NewExtractMasterDT.Rows[0]; ANewExtractId = TemplateRow.ExtractId; ReturnValue = true; } else { AExtractAlreadyExists = true; ReturnValue = false; } if (ReturnValue && NewTransaction) { DBAccess.GDBAccessObj.CommitTransaction(); } else if (NewTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); } } catch (Exception Exc) { TLogging.Log("An Exception occured during the creation of a new Extract:" + Environment.NewLine + Exc.ToString()); if (NewTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); } throw; } return(ReturnValue); }
public static void GetData(string ATablename, TSearchCriteria[] ASearchCriteria, out TTypedDataTable AResultTable, TDBTransaction AReadTransaction) { AResultTable = null; string context = string.Format("GetData {0}", SharedConstants.MODULE_ACCESS_MANAGER); // check access permissions for the current user TModuleAccessManager.CheckUserPermissionsForTable(ATablename, TTablePermissionEnum.eCanRead); // TODO: auto generate if (ATablename == AApSupplierTable.GetTableDBName()) { AResultTable = AApSupplierAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == AApDocumentTable.GetTableDBName()) { AResultTable = AApDocumentAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == ATransactionTypeTable.GetTableDBName()) { AResultTable = ATransactionTypeAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == ACurrencyTable.GetTableDBName()) { AResultTable = ACurrencyAccess.LoadAll(AReadTransaction); } else if (ATablename == ADailyExchangeRateTable.GetTableDBName()) { AResultTable = ADailyExchangeRateAccess.LoadAll(AReadTransaction); } else if (ATablename == ACorporateExchangeRateTable.GetTableDBName()) { AResultTable = ACorporateExchangeRateAccess.LoadAll(AReadTransaction); } else if (ATablename == ACurrencyLanguageTable.GetTableDBName()) { AResultTable = ACurrencyLanguageAccess.LoadAll(AReadTransaction); } else if (ATablename == AFeesPayableTable.GetTableDBName()) { AResultTable = AFeesPayableAccess.LoadAll(AReadTransaction); } else if (ATablename == AFeesReceivableTable.GetTableDBName()) { AResultTable = AFeesReceivableAccess.LoadAll(AReadTransaction); } else if (ATablename == AAnalysisTypeTable.GetTableDBName()) { AResultTable = AAnalysisTypeAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == AGiftBatchTable.GetTableDBName()) { AResultTable = AGiftBatchAccess.LoadAll(AReadTransaction); } else if (ATablename == AJournalTable.GetTableDBName()) { AResultTable = AJournalAccess.LoadAll(AReadTransaction); } else if (ATablename == ALedgerTable.GetTableDBName()) { AResultTable = ALedgerAccess.LoadAll(AReadTransaction); } else if (ATablename == MExtractMasterTable.GetTableDBName()) { if (ASearchCriteria == null) { AResultTable = MExtractMasterAccess.LoadAll(AReadTransaction); } else { AResultTable = MExtractMasterAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } } else if (ATablename == MExtractTable.GetTableDBName()) { // it does not make sense to load ALL extract rows for all extract masters so search criteria needs to be set if (ASearchCriteria != null) { AResultTable = MExtractAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } } else if (ATablename == PcAttendeeTable.GetTableDBName()) { AResultTable = PcAttendeeAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == PcConferenceCostTable.GetTableDBName()) { AResultTable = PcConferenceCostAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == PcEarlyLateTable.GetTableDBName()) { AResultTable = PcEarlyLateAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == PcSupplementTable.GetTableDBName()) { AResultTable = PcSupplementAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == PcDiscountTable.GetTableDBName()) { AResultTable = PcDiscountAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == PCountryTable.GetTableDBName()) { AResultTable = PCountryAccess.LoadAll(AReadTransaction); } else if (ATablename == PFormTable.GetTableDBName()) { string[] columns = TTypedDataTable.GetColumnStringList(PFormTable.TableId); StringCollection fieldList = new StringCollection(); for (int i = 0; i < columns.Length; i++) { // Do not load the template document - we don't display it and it is big! if (columns[i] != PFormTable.GetTemplateDocumentDBName()) { fieldList.Add(columns[i]); } } AResultTable = PFormAccess.LoadAll(fieldList, AReadTransaction); } else if (ATablename == PInternationalPostalTypeTable.GetTableDBName()) { AResultTable = PInternationalPostalTypeAccess.LoadAll(AReadTransaction); } else if (ATablename == PtApplicationTypeTable.GetTableDBName()) { AResultTable = PtApplicationTypeAccess.LoadAll(AReadTransaction); } else if (ATablename == PFormalityTable.GetTableDBName()) { AResultTable = PFormalityAccess.LoadAll(AReadTransaction); } else if (ATablename == PMailingTable.GetTableDBName()) { AResultTable = PMailingAccess.LoadAll(AReadTransaction); } else if (ATablename == PPartnerGiftDestinationTable.GetTableDBName()) { AResultTable = PPartnerGiftDestinationAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == PmDocumentTypeTable.GetTableDBName()) { AResultTable = PmDocumentTypeAccess.LoadAll(AReadTransaction); } else if (ATablename == SGroupTable.GetTableDBName()) { TSecurityChecks.CheckUserModulePermissions(SharedConstants.PETRAMODULE_SYSADMIN, context); AResultTable = SGroupAccess.LoadAll(AReadTransaction); } else if (ATablename == SSystemDefaultsTable.GetTableDBName()) { TSecurityChecks.CheckUserModulePermissions(SharedConstants.PETRAMODULE_SYSADMIN, context); AResultTable = SSystemDefaultsAccess.LoadAll(AReadTransaction); } else if (ATablename == SSystemDefaultsGuiTable.GetTableDBName()) { AResultTable = SSystemDefaultsGuiAccess.LoadAll(AReadTransaction); } else { throw new Exception("TCommonDataReader.GetData: unknown table " + ATablename); } // Accept row changes here so that the Client gets 'unmodified' rows AResultTable.AcceptChanges(); }
public static bool GetData(string ATablename, TSearchCriteria[] ASearchCriteria, out TTypedDataTable AResultTable) { // TODO: check access permissions for the current user bool NewTransaction = false; TDBTransaction ReadTransaction; TTypedDataTable tempTable = null; try { ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.RepeatableRead, TEnforceIsolationLevel.eilMinimum, out NewTransaction); // TODO: auto generate if (ATablename == AApSupplierTable.GetTableDBName()) { tempTable = AApSupplierAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == AApDocumentTable.GetTableDBName()) { tempTable = AApDocumentAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == ATransactionTypeTable.GetTableDBName()) { tempTable = ATransactionTypeAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == ACurrencyTable.GetTableDBName()) { tempTable = ACurrencyAccess.LoadAll(ReadTransaction); } else if (ATablename == ADailyExchangeRateTable.GetTableDBName()) { tempTable = ADailyExchangeRateAccess.LoadAll(ReadTransaction); } else if (ATablename == ACorporateExchangeRateTable.GetTableDBName()) { tempTable = ACorporateExchangeRateAccess.LoadAll(ReadTransaction); } else if (ATablename == ACurrencyLanguageTable.GetTableDBName()) { tempTable = ACurrencyLanguageAccess.LoadAll(ReadTransaction); } else if (ATablename == AFeesPayableTable.GetTableDBName()) { tempTable = AFeesPayableAccess.LoadAll(ReadTransaction); } else if (ATablename == AFeesReceivableTable.GetTableDBName()) { tempTable = AFeesReceivableAccess.LoadAll(ReadTransaction); } else if (ATablename == AAnalysisTypeTable.GetTableDBName()) { tempTable = AAnalysisTypeAccess.LoadAll(ReadTransaction); } else if (ATablename == AGiftBatchTable.GetTableDBName()) { tempTable = AGiftBatchAccess.LoadAll(ReadTransaction); } else if (ATablename == AJournalTable.GetTableDBName()) { tempTable = AJournalAccess.LoadAll(ReadTransaction); } else if (ATablename == ALedgerTable.GetTableDBName()) { tempTable = ALedgerAccess.LoadAll(ReadTransaction); } else if (ATablename == MExtractMasterTable.GetTableDBName()) { if (ASearchCriteria == null) { tempTable = MExtractMasterAccess.LoadAll(ReadTransaction); } else { tempTable = MExtractMasterAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } } else if (ATablename == MExtractTable.GetTableDBName()) { // it does not make sense to load ALL extract rows for all extract masters so search criteria needs to be set if (ASearchCriteria != null) { tempTable = MExtractAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } } else if (ATablename == PcAttendeeTable.GetTableDBName()) { tempTable = PcAttendeeAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == PcConferenceCostTable.GetTableDBName()) { tempTable = PcConferenceCostAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == PcEarlyLateTable.GetTableDBName()) { tempTable = PcEarlyLateAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == PcSupplementTable.GetTableDBName()) { tempTable = PcSupplementAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == PcDiscountTable.GetTableDBName()) { tempTable = PcDiscountAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == PInternationalPostalTypeTable.GetTableDBName()) { tempTable = PInternationalPostalTypeAccess.LoadAll(ReadTransaction); } else if (ATablename == PtApplicationTypeTable.GetTableDBName()) { tempTable = PtApplicationTypeAccess.LoadAll(ReadTransaction); } else if (ATablename == PMailingTable.GetTableDBName()) { tempTable = PMailingAccess.LoadAll(ReadTransaction); } else if (ATablename == PPartnerGiftDestinationTable.GetTableDBName()) { tempTable = PPartnerGiftDestinationAccess.LoadUsingTemplate(ASearchCriteria, ReadTransaction); } else if (ATablename == PmDocumentTypeTable.GetTableDBName()) { tempTable = PmDocumentTypeAccess.LoadAll(ReadTransaction); } else if (ATablename == SGroupTable.GetTableDBName()) { tempTable = SGroupAccess.LoadAll(ReadTransaction); } else { throw new Exception("TCommonDataReader.GetData: unknown table " + ATablename); } } catch (Exception Exp) { DBAccess.GDBAccessObj.RollbackTransaction(); TLogging.Log("TCommonDataReader.GetData exception: " + Exp.ToString(), TLoggingType.ToLogfile); TLogging.Log(Exp.StackTrace, TLoggingType.ToLogfile); throw; } finally { if (NewTransaction) { DBAccess.GDBAccessObj.CommitTransaction(); TLogging.LogAtLevel(7, "TCommonDataReader.GetData: committed own transaction."); } } // Accept row changes here so that the Client gets 'unmodified' rows tempTable.AcceptChanges(); // return the table AResultTable = tempTable; return(true); }