Пример #1
0
        //public SqLiteTransactionStorage(ITransactionFactory transactionFactory) : base(transactionFactory)
        //{
        //}

        public override ITransaction CreateTransaction(ITransaction transaction)
        {
            _table.InitializeDatabase();
            if (transaction.Id == 0)
            {
                transaction.Id = _table.AddData(ObjectToITransactionConverter.ConvertToKeyPairList(transaction));
            }
            else
            {
                _table.AddData(ObjectToITransactionConverter.ConvertToKeyPairListWithId(transaction));
            }
            return(transaction);
        }
Пример #2
0
 public override void UpdateTransaction(ITransaction transaction)
 {
     _table.InitializeDatabase();
     //var allData = GetAllTransactions();
     //var children = allData.Where(x => x.ParentTransaction?.Id == transaction.Id);
     //foreach (var child in children)
     //{
     //    _table.DeleteRecordById(child.Id);
     //}
     _table.UpdateData(ObjectToITransactionConverter.ConvertToKeyPairList(transaction), transaction.Id);
     //foreach (var childrenTransaction in transaction.ChildrenTransactions)
     //{
     //    _table.AddData(ObjectToITransactionConverter.ConvertToKeyPairList(childrenTransaction));
     //}
 }