Пример #1
0
        /// <summary>
        /// Creates a collection of class list transactions
        /// </summary>
        /// <param name="transactionItems">The transaction delimited string</param>
        /// <param name="config">The configuration to use while importing raw data</param>
        /// <returns>A collection of bank transactions</returns>
        public static List <ClassListTransaction> Import(string transactionItems, Configuration config)
        {
            List <ClassListTransaction> result = new List <ClassListTransaction>();

            // Create a new bank transaction
            ClassListTransaction clt = new ClassListTransaction();

            // Split the string by new lines
            string[] sEntries = Regex.Split(transactionItems, "$", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);

            // Iterate over the array
            for (int i = 0; i < sEntries.Length; i++)
            {
                // Extract a line entry
                string sEntry = sEntries[i].Replace("\r", "").Replace("\n", "");

                // If the string has a value
                if (sEntry.Length > 0)
                {
                    // Test the first value of the string
                    switch (sEntry[0].ToString())
                    {
                    case ClassListFields.ClassName:
                        // Set the date value
                        clt.ClassName = sEntry.Substring(1);

                        // Stop processing
                        break;

                    case ClassListFields.Description:
                        // Set the amount value
                        clt.Description = sEntry.Substring(1);

                        // Stop processing
                        break;

                    case AccountInformationFields.EndOfEntry:
                        // Add the bank transaction instance to the collection
                        result.Add(clt);

                        // Call the destructor
                        clt = null;

                        // Create a new bank transaction
                        clt = new ClassListTransaction();

                        // Stop processing
                        break;
                    }
                }
            }

            return(result);
        }
Пример #2
0
 public void Yield(QifDocument document)
 {
     document.ClassListTransactions.Add(item);
     item = new ClassListTransaction();
 }
Пример #3
0
 public void Yield(QifDocument document)
 {
     document.AddTransaction(GetType().Name, item);
     item = new ClassListTransaction();
 }