Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ALedgerNumber"></param>
        /// <param name="AFlag"></param>
        /// <param name="AValue"></param>
        /// <param name="ADataBase"></param>
        public static void SetFlagValue(int ALedgerNumber, String AFlag, String AValue, TDataBase ADataBase = null)
        {
            TDBTransaction ReadWriteTransaction = null;
            Boolean        SubmissionOK         = false;

            DBAccess.GetDBAccessObj(ADataBase).GetNewOrExistingAutoTransaction(IsolationLevel.Serializable,
                                                                               TEnforceIsolationLevel.eilMinimum,
                                                                               ref ReadWriteTransaction,
                                                                               ref SubmissionOK,
                                                                               delegate
            {
                ALedgerInitFlagTable ledgerInitFlagTable = ALedgerInitFlagAccess.LoadByPrimaryKey(
                    ALedgerNumber, AFlag, ReadWriteTransaction);

                ALedgerInitFlagRow ledgerInitFlagRow =
                    ledgerInitFlagTable.Rows.Count == 0 ?
                    ledgerInitFlagTable.NewRowTyped()
                        : ledgerInitFlagTable[0];
                ledgerInitFlagRow.LedgerNumber   = ALedgerNumber;
                ledgerInitFlagRow.InitOptionName = AFlag;
                ledgerInitFlagRow.Value          = AValue;

                if (ledgerInitFlagTable.Rows.Count == 0)
                {
                    ledgerInitFlagTable.Rows.Add(ledgerInitFlagRow);
                }

                ALedgerInitFlagAccess.SubmitChanges(ledgerInitFlagTable, ReadWriteTransaction);

                SubmissionOK = true;
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="AFlag"></param>
        /// <param name="AValue"></param>
        public void SetFlagValue(String AFlag, String AValue)
        {
            TDBTransaction ReadWriteTransaction = new TDBTransaction();
            TDataBase      db           = DBAccess.Connect("SetFlagValue", FDataBase);
            Boolean        SubmissionOK = false;

            db.WriteTransaction(
                ref ReadWriteTransaction,
                ref SubmissionOK,
                delegate
            {
                ALedgerInitFlagTable ledgerInitFlagTable = ALedgerInitFlagAccess.LoadByPrimaryKey(
                    FLedgerNumber, AFlag, ReadWriteTransaction);

                ALedgerInitFlagRow ledgerInitFlagRow =
                    ledgerInitFlagTable.Rows.Count == 0 ?
                    ledgerInitFlagTable.NewRowTyped()
                        : ledgerInitFlagTable[0];
                ledgerInitFlagRow.LedgerNumber   = FLedgerNumber;
                ledgerInitFlagRow.InitOptionName = AFlag;
                ledgerInitFlagRow.Value          = AValue;

                if (ledgerInitFlagTable.Rows.Count == 0)
                {
                    ledgerInitFlagTable.Rows.Add(ledgerInitFlagRow);
                }

                ALedgerInitFlagAccess.SubmitChanges(ledgerInitFlagTable, ReadWriteTransaction);

                SubmissionOK = true;
            });

            if (FDataBase == null)
            {
                db.CloseDBConnection();
            }
        }
Ejemplo n.º 3
0
        private static void AddOrRemoveLedgerInitFlag(Int32 ALedgerNumber, String AInitFlagName,
            Boolean AAdd, TDBTransaction ATransaction)
        {
            #region Validate Arguments

            if (ALedgerNumber <= 0)
            {
                throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString(
                            "Function:{0} - The Ledger number must be greater than 0!"),
                        Utilities.GetMethodName(true)), ALedgerNumber);
            }
            else if (AInitFlagName.Length == 0)
            {
                throw new ArgumentException(String.Format(Catalog.GetString("Function:{0} - The Init Flag name is empty!"),
                        Utilities.GetMethodName(true)));
            }
            else if (ATransaction == null)
            {
                throw new EFinanceSystemDBTransactionNullException(String.Format(Catalog.GetString(
                            "Function:{0} - Database Transaction must not be NULL!"),
                        Utilities.GetMethodName(true)));
            }

            #endregion Validate Arguments

            if (AAdd)
            {
                // add flag if not there yet
                if (!ALedgerInitFlagAccess.Exists(ALedgerNumber, AInitFlagName, ATransaction))
                {
                    ALedgerInitFlagTable InitFlagTable = new ALedgerInitFlagTable();

                    ALedgerInitFlagRow InitFlagRow = InitFlagTable.NewRowTyped();
                    InitFlagRow.LedgerNumber = ALedgerNumber;
                    InitFlagRow.InitOptionName = AInitFlagName;
                    InitFlagTable.Rows.Add(InitFlagRow);

                    ALedgerInitFlagAccess.SubmitChanges(InitFlagTable, ATransaction);
                }
            }
            else
            {
                // remove flag from table if it exists
                if (ALedgerInitFlagAccess.Exists(ALedgerNumber, AInitFlagName, ATransaction))
                {
                    ALedgerInitFlagAccess.DeleteByPrimaryKey(ALedgerNumber, AInitFlagName, ATransaction);
                }
            }
        }
Ejemplo n.º 4
0
        private static void AddOrRemoveLedgerInitFlag(Int32 ALedgerNumber, String AInitFlagName,
            Boolean AAdd, TDBTransaction ATransaction)
        {
            if (AAdd)
            {
                // add flag if not there yet
                if (!ALedgerInitFlagAccess.Exists(ALedgerNumber, AInitFlagName, ATransaction))
                {
                    ALedgerInitFlagTable InitFlagTable = new ALedgerInitFlagTable();

                    ALedgerInitFlagRow InitFlagRow = InitFlagTable.NewRowTyped();
                    InitFlagRow.LedgerNumber = ALedgerNumber;
                    InitFlagRow.InitOptionName = AInitFlagName;
                    InitFlagTable.Rows.Add(InitFlagRow);

                    ALedgerInitFlagAccess.SubmitChanges(InitFlagTable, ATransaction);
                }
            }
            else
            {
                // remove flag from table if it exists
                if (ALedgerInitFlagAccess.Exists(ALedgerNumber, AInitFlagName, ATransaction))
                {
                    ALedgerInitFlagAccess.DeleteByPrimaryKey(ALedgerNumber, AInitFlagName, ATransaction);
                }
            }
        }