Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
 private void NewReciept()
 {
     receipt = new Receipt(user.ID);
     mainData.Items.Clear();
     txtItemCode.Focus();
 }