예제 #1
0
 public void Yield(QifDocument document)
 {
     document.AddTransaction(GetType().Name, item);
     item = new CategoryListTransaction();
 }
예제 #2
0
        /// <summary>
        /// Creates a collection of category list transactions
        /// </summary>
        /// <param name="transactionItems">The transaction delimited string</param>
        /// <returns>A collection of bank transactions</returns>
        public static List <CategoryListTransaction> Import(string transactionItems)
        {
            List <CategoryListTransaction> result = new List <CategoryListTransaction>();

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

            // 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 CategoryListFields.BudgetAmount:
                        // Set the date value
                        clt.BudgetAmount = Common.GetDecimal(sEntry.Substring(1));

                        // Stop processing
                        break;

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

                        // Stop processing
                        break;

                    case CategoryListFields.Description:
                        // Set the cleared status value
                        clt.Description = sEntry.Substring(1);

                        // Stop processing
                        break;

                    case CategoryListFields.ExpenseCategory:
                        // Set the number value
                        clt.ExpenseCategory = Common.GetBoolean(sEntry.Substring(1));

                        // Stop processing
                        break;

                    case CategoryListFields.IncomeCategory:
                        // Set the payee value
                        clt.IncomeCategory = Common.GetBoolean(sEntry.Substring(1));

                        // Stop processing
                        break;

                    case CategoryListFields.TaxRelated:
                        // Set the memo value
                        clt.TaxRelated = Common.GetBoolean(sEntry.Substring(1));

                        // Stop processing
                        break;

                    case CategoryListFields.TaxSchedule:
                        // Set the memo value
                        clt.TaxSchedule = 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 CategoryListTransaction();

                        // Stop processing
                        break;
                    }
                }
            }

            return(result);
        }
예제 #3
0
 public void Yield(QifDocument document)
 {
     document.CategoryListTransactions.Add(item);
     item = new CategoryListTransaction();
 }