private void InsertHelper() { if (GetAndSetBalance() >= 0) { InsertTransactionModel model = new InsertTransactionModel { Amount = _amountDecimal, Balance = GetAndSetBalance(), Title = _title, TransactionTypeId = _selectedTransactionType.TransactionTypeId, UserId = _selectedUser.UserId }; _queries.InsertTransaction(model); if (!string.IsNullOrWhiteSpace(Company) || !string.IsNullOrWhiteSpace(Invoice)) { InsertTransactionModelInfo infoModel = new InsertTransactionModelInfo { Company = _company, Invoice = _invoice, TransactionFullId = _queries.SelectLastTransactionFullId() }; _queries.InsertTransactionInfo(infoModel); } TryClose(); } else { MessageBox.Show("Saldo nie może być ujemne!", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void InsertTransactionInfo(InsertTransactionModelInfo model) { using (IDbConnection cnn = new SQLiteConnection(_sqlliteDataAcces.GetConnectionString())) { cnn.Execute(@"INSERT INTO TransactionInfo (Company, Invoice, TransactionFullId) VALUES (@Company, @Invoice, @TransactionFullId);", model); } }