Exemple #1
0
        public IQuickTransaction CreateQuickTransaction(IAccount account, ICategory category,
                                                        string name, decimal total, long id, decimal weight, bool askForTotal, bool askForWeight)
        {
            var quickTransaction = _quickTransactionFactory.CreateQuickTransaction(account, category, name, total, id, weight, askForTotal, askForWeight);

            return(CreateQuickTransaction(quickTransaction));
        }
Exemple #2
0
        public static IQuickTransaction Convert(IDictionary <string, object> line,
                                                IQuickTransactionFactory quickTransactionFactory, IAccountStorage accountStorage,
                                                ICategoryStorage categoryStorage)
        {
            var id           = (long)line["id"];
            var accountId    = (long)(line["accountId"] is DBNull?0L: line["accountId"]);
            var categoryId   = (long)(line["categoryId"] is DBNull ? 0L : line["categoryId"]);
            var name         = line["name"].ToString();
            var total        = decimal.Parse(line["total"].ToString());
            var account      = accountStorage.GetAllAccounts().FirstOrDefault(x => x?.Id == accountId);
            var category     = categoryStorage.GetAllCategories().FirstOrDefault(x => x?.Id == categoryId);
            var weight       = decimal.Parse(line["weight"].ToString());
            var askForTotal  = (long)line["askForTotal"] > 0;
            var askForWeight = (long)line["askForWeight"] > 0;

            var transaction = quickTransactionFactory.CreateQuickTransaction(account, category, name, total, id, weight, askForTotal, askForWeight);

            transaction.Id = id;

            return(transaction);
        }