コード例 #1
0
ファイル: Extracts.cs プロジェクト: jsuen123/openpetragit
        /// <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);
        }
コード例 #2
0
ファイル: Extracts.cs プロジェクト: weiplanet/openpetra
        /// <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);
        }
コード例 #3
0
ファイル: Extracts.cs プロジェクト: merbst/openpetra
        /// <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);
        }