Esempio n. 1
0
        /// <summary>
        /// Used for the validation of Analysis Attributes
        /// </summary>
        /// <param name="ATransactionNumber"></param>
        /// <param name="AAccountCode"></param>
        /// <param name="AGLBatchDS"></param>
        /// <param name="AIsUnposted"></param>
        /// <returns></returns>
        public bool AccountAnalysisAttributeCountIsCorrect(int ATransactionNumber,
                                                           string AAccountCode,
                                                           GLBatchTDS AGLBatchDS,
                                                           bool AIsUnposted = true)
        {
            bool RetVal = true;

            if (!AIsUnposted || string.IsNullOrEmpty(AAccountCode))
            {
                return(RetVal);
            }

            int NumberOfAttributes = 0;

            TRemote.MFinance.Setup.WebConnectors.AccountHasAnalysisAttributes(FLedgerNumber, AAccountCode, out NumberOfAttributes, true);

            if (NumberOfAttributes == 0)
            {
                return(RetVal);
            }

            DataView analAttrib = new DataView(AGLBatchDS.ATransAnalAttrib);

            analAttrib.RowFilter = String.Format("{0}={1} AND {2}={3} AND {4}={5} AND {6}={7}",
                                                 ATransAnalAttribTable.GetBatchNumberDBName(),
                                                 FBatchNumber,
                                                 ATransAnalAttribTable.GetJournalNumberDBName(),
                                                 FJournalNumber,
                                                 ATransAnalAttribTable.GetTransactionNumberDBName(),
                                                 ATransactionNumber,
                                                 ATransAnalAttribTable.GetAccountCodeDBName(),
                                                 AAccountCode);

            RetVal = (analAttrib.Count == NumberOfAttributes);

            return(RetVal);
        }