Esempio n. 1
0
        public static GLSetupTDS LoadAAnalysisAttributes(Int32 ALedgerNumber, Boolean AActiveOnly = false)
        {
            GLSetupTDS CacheDS = new GLSetupTDS();
            bool NewTransaction;
            TDBTransaction Transaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted, out NewTransaction);

            AAnalysisTypeAccess.LoadAll(CacheDS, Transaction);

            if (!AActiveOnly)
            {
                AFreeformAnalysisAccess.LoadViaALedger(CacheDS, ALedgerNumber, Transaction);
                AAnalysisAttributeAccess.LoadViaALedger(CacheDS, ALedgerNumber, Transaction);
            }
            else
            {
                AFreeformAnalysisTable FFTable = new AFreeformAnalysisTable();
                AFreeformAnalysisRow TemplateFFRow = FFTable.NewRowTyped(false);
                TemplateFFRow.LedgerNumber = ALedgerNumber;
                TemplateFFRow.Active = true;

                AFreeformAnalysisAccess.LoadUsingTemplate(CacheDS, TemplateFFRow, Transaction);

                AAnalysisAttributeTable AATable = new AAnalysisAttributeTable();
                AAnalysisAttributeRow TemplateAARow = AATable.NewRowTyped(false);
                TemplateAARow.LedgerNumber = ALedgerNumber;
                TemplateAARow.Active = true;

                AAnalysisAttributeAccess.LoadUsingTemplate(CacheDS, TemplateAARow, Transaction);
            }

            if (NewTransaction)
            {
                DBAccess.GDBAccessObj.RollbackTransaction();
            }

            return CacheDS;
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="AGridCombo"></param>
        /// <param name="AAnalysisAttribute"></param>
        /// <param name="AAnalysisCode"></param>
        /// <param name="AAnalysisAttributeValue"></param>
        /// <returns></returns>
        public static bool AnalysisAttributeValueIsActive(ref SourceGrid.Cells.Editors.ComboBox AGridCombo, AFreeformAnalysisTable AAnalysisAttribute,
            String AAnalysisCode = "", String AAnalysisAttributeValue = "")
        {
            bool retVal = true;

            if ((AAnalysisCode == string.Empty) || (AAnalysisAttributeValue == string.Empty))
            {
                return retVal;
            }

            DataView dv = new DataView(AAnalysisAttribute);

            dv.RowFilter = String.Format("{0}='{1}' AND {2}='{3}' AND {4}=true",
                AFreeformAnalysisTable.GetAnalysisTypeCodeDBName(),
                AAnalysisCode,
                AFreeformAnalysisTable.GetAnalysisValueDBName(),
                AAnalysisAttributeValue,
                AFreeformAnalysisTable.GetActiveDBName());

            retVal = (dv.Count > 0);

            //Make sure the grid combobox has right font else it will adopt strikeout
            // for all items in the list.
            AGridCombo.Control.Font = new Font(FontFamily.GenericSansSerif, 8);

            return retVal;
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="AGridCombo"></param>
        /// <param name="AFreeformAnalysisTbl"></param>
        /// <param name="AAnalysisCode"></param>
        /// <param name="AAnalysisAttributeValue"></param>
        /// <returns></returns>
        public static bool AnalysisAttributeValueIsActive(ref SourceGrid.Cells.Editors.ComboBox AGridCombo,
            AFreeformAnalysisTable AFreeformAnalysisTbl,
            String AAnalysisCode = "",
            String AAnalysisAttributeValue = "")
        {
            #region Validate Arguments

            if ((AAnalysisCode == string.Empty) || (AAnalysisAttributeValue == string.Empty))
            {
                return true;
            }
            else if (AFreeformAnalysisTbl == null)
            {
                throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString(
                            "Function:{0} - The Freeform Analysis table is null!"),
                        Utilities.GetMethodName(true)));
            }

            #endregion Validate Arguments

            //Make sure the grid combobox has right font else it will adopt strikeout
            // for all items in the list.
            AGridCombo.Control.Font = new Font(FontFamily.GenericSansSerif, 8);

            DataView dv = new DataView(AFreeformAnalysisTbl);

            dv.RowFilter = String.Format("{0}='{1}' AND {2}='{3}' AND {4}=true",
                AFreeformAnalysisTable.GetAnalysisTypeCodeDBName(),
                AAnalysisCode,
                AFreeformAnalysisTable.GetAnalysisValueDBName(),
                AAnalysisAttributeValue,
                AFreeformAnalysisTable.GetActiveDBName());

            return dv.Count > 0;
        }
Esempio n. 4
0
        public static GLSetupTDS LoadAAnalysisAttributes(Int32 ALedgerNumber, Boolean AActiveOnly = false)
        {
            #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);
            }

            #endregion Validate Arguments

            GLSetupTDS MainDS = new GLSetupTDS();
            TDBTransaction Transaction = null;

            try
            {
                DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                    TEnforceIsolationLevel.eilMinimum,
                    ref Transaction,
                    delegate
                    {
                        AAnalysisTypeAccess.LoadViaALedger(MainDS, ALedgerNumber, Transaction);

                        if (!AActiveOnly)
                        {
                            AFreeformAnalysisAccess.LoadViaALedger(MainDS, ALedgerNumber, Transaction);
                            AAnalysisAttributeAccess.LoadViaALedger(MainDS, ALedgerNumber, Transaction);
                        }
                        else
                        {
                            AFreeformAnalysisTable FFTable = new AFreeformAnalysisTable();
                            AFreeformAnalysisRow TemplateFFRow = FFTable.NewRowTyped(false);
                            TemplateFFRow.LedgerNumber = ALedgerNumber;
                            TemplateFFRow.Active = true;
                            AFreeformAnalysisAccess.LoadUsingTemplate(MainDS, TemplateFFRow, Transaction);

                            AAnalysisAttributeTable AATable = new AAnalysisAttributeTable();
                            AAnalysisAttributeRow TemplateAARow = AATable.NewRowTyped(false);
                            TemplateAARow.LedgerNumber = ALedgerNumber;
                            TemplateAARow.Active = true;
                            AAnalysisAttributeAccess.LoadUsingTemplate(MainDS, TemplateAARow, Transaction);
                        }
                    });

                MainDS.AcceptChanges();
            }
            catch (Exception ex)
            {
                TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}",
                        Utilities.GetMethodSignature(),
                        Environment.NewLine,
                        ex.Message));
                throw ex;
            }

            return MainDS;
        }
Esempio n. 5
0
        public static bool AccountAnalysisAttributeRequiresValues(Int32 ALedgerNumber, string AAnalysisTypeCode, bool AActiveOnly)
        {
            #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 (AAnalysisTypeCode.Length == 0)
            {
                throw new ArgumentException(String.Format(Catalog.GetString("Function:{0} - The Analysis Type code is empty!"),
                        Utilities.GetMethodName(true)));
            }

            #endregion Validate Arguments

            bool AccountAnalysisAttributeValueRequired = false;

            TDBTransaction Transaction = null;

            try
            {
                DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                    TEnforceIsolationLevel.eilMinimum,
                    ref Transaction,
                    delegate
                    {
                        AFreeformAnalysisTable FFATable = new AFreeformAnalysisTable();
                        AFreeformAnalysisRow TemplateFFARow = FFATable.NewRowTyped(false);
                        TemplateFFARow.LedgerNumber = ALedgerNumber;
                        TemplateFFARow.AnalysisTypeCode = AAnalysisTypeCode;

                        if (AActiveOnly)
                        {
                            TemplateFFARow.Active = AActiveOnly;
                        }

                        AFreeformAnalysisTable FreeformAnalysisTable = AFreeformAnalysisAccess.LoadUsingTemplate(TemplateFFARow, Transaction);

                        AccountAnalysisAttributeValueRequired = (FreeformAnalysisTable.Count > 0);
                    });
            }
            catch (Exception ex)
            {
                TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}",
                        Utilities.GetMethodSignature(),
                        Environment.NewLine,
                        ex.Message));
                throw ex;
            }

            return AccountAnalysisAttributeValueRequired;
        }
Esempio n. 6
0
        public static bool AccountAnalysisAttributeRequiresValues(Int32 ALedgerNumber, string AAnalysisTypeCode, bool AActiveOnly)
        {
            TDBTransaction Transaction = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.ReadCommitted);
            bool AccountAnalysisAttributeValueRequired = false;

            try
            {
                AFreeformAnalysisTable FFATable = new AFreeformAnalysisTable();
                AFreeformAnalysisRow TemplateFFARow = FFATable.NewRowTyped(false);
                TemplateFFARow.LedgerNumber = ALedgerNumber;
                TemplateFFARow.AnalysisTypeCode = AAnalysisTypeCode;

                if (AActiveOnly)
                {
                    TemplateFFARow.Active = AActiveOnly;
                }

                AFreeformAnalysisTable FreeformAnalysisTable = AFreeformAnalysisAccess.LoadUsingTemplate(TemplateFFARow, Transaction);

                AccountAnalysisAttributeValueRequired = (FreeformAnalysisTable.Count > 0);
            }
            catch (Exception ex)
            {
                TLogging.Log("Unexpected error in AccountAnalysisAttributeRequiresValues: " + ex.Message);
            }
            finally
            {
                DBAccess.GDBAccessObj.RollbackTransaction();
            }

            return AccountAnalysisAttributeValueRequired;
        }