public static bool PayByCash(Receipt receipt) { SQLiteConnection connection = new SQLiteConnection(DatabaseManager.CONNECTION_STRING); SQLiteCommand command = new SQLiteCommand(@"INSERT INTO cash_transactions(transaction_time,receipt_it, amount) VALUES(CURRENT_TIMESTAMP, @receiptId, @amount);", connection); command.Parameters.AddWithValue("@amount", receipt.Total); command.Parameters.AddWithValue("@receiptId", receipt.ID); try { connection.Open(); } catch (SQLiteException ex) { return false; } try { command.ExecuteNonQuery(); } catch (SQLiteException ex) { return false; } return true; }
private void NewReciept() { receipt = new Receipt(user.ID); mainData.Items.Clear(); txtItemCode.Focus(); }