private MainTransaction CreateCashTransactionEntity(MainTransaction cashTransaction, TransactionModel model) { cashTransaction.order_id = model.order_id; cashTransaction.original_price = model.original_price; cashTransaction.discount_percentage = model.discount_percentage; cashTransaction.original_currency = ConstantValues.S_CURRENCY_SGD; cashTransaction.currency = ConstantValues.S_CURRENCY_SGD; cashTransaction.gst = ConstantValues.D_GST; cashTransaction.service_charge = ConstantValues.D_SERVICE_CHARGE; cashTransaction.amount = model.cash_amount; cashTransaction.description = ConstantValues.S_TRANSACTION_TYPE_FOOD; cashTransaction.food_status = (int)GoEat.Models.TransactionStatus.Pending_reconcile; return cashTransaction; }
public bool CreateTokenTransaction(IDbConnection db, MainTransaction transaction) { string sql = @"UPDATE [dbo].[main_transaction] SET [order_id]=@order_id, [drink_status]=@drink_status, [token_amount] = @token_amount,[drinks] = @drinks,[gst] = @gst,[service_charge] =@service_charge,[description] = @description WHERE id=@id"; return 1 == db.Query<int>(sql, transaction).FirstOrDefault(); }
private MainTransaction CreateTokenTransactionEntity(MainTransaction tokenTransaction, TransactionModel model) { // tokenTransaction.currency = ConstantValues.S_CURRENCY_SGD; // tokenTransaction.gst = ConstantValues.D_GST; // tokenTransaction.service_charge = ConstantValues.D_SERVICE_CHARGE; tokenTransaction.order_id = model.order_id; tokenTransaction.description = ConstantValues.S_TRANSACTION_TYPE_DRINK; tokenTransaction.drink_status = (int)GoEat.Models.TransactionStatus.Pending; tokenTransaction.drinks = model.drinks_quantity; tokenTransaction.token_amount = model.drinks_quantity * ConstantValues.D_TRANSACTION_DRINK_PRICE; return tokenTransaction; }
public bool CreateCashTransaction(IDbConnection db, MainTransaction cashTransaction) { string sql = @"UPDATE [dbo].[main_transaction] SET [order_id]=@order_id, [food_status]=@food_status, [amount] = @amount,[original_currency] = @original_currency,[currency] = @currency,[original_price] = @original_price,[discount_percentage] = @discount_percentage,[gst] = @gst,[service_charge] =@service_charge,[description] = @description WHERE id=@id"; return 1 == db.Query<int>(sql, cashTransaction).FirstOrDefault(); }
public int CreatePaypalMainTransaction(IDbConnection db, MainTransaction mainTransaction) { string sql = @"INSERT INTO [dbo].[main_transaction] ([token_transaction_id],[status],[created_date],[amount],[method], [customer_id]) VALUES (@token_transaction_id, @status, @created_date, @amount, @method, @customer_id)"; sql += " SELECT CAST(SCOPE_IDENTITY() as int);"; return db.Query<int>(sql, mainTransaction).FirstOrDefault(); }
public int CreateMainTransaction(IDbConnection db, MainTransaction mainTransaction) { string sql = @"INSERT INTO [dbo].[main_transaction] ([cashier_id],[created_date],[method],[restaurant_id],[customer_id]) VALUES ( @cashier_id, @created_date, @method, @restaurant_id,@customer_id)"; sql += " SELECT CAST(SCOPE_IDENTITY() as int);"; return db.Query<int>(sql, mainTransaction).FirstOrDefault(); }
public bool UpdateTokenTransaction(MainTransaction transaction) { var repo = GoEatRepo.Instance; using (var db = repo.OpenConnectionFromPool()) { return repo.CreateTokenTransaction(db, transaction); } }
public int CreatePendingTransaction(int cashierId, int restaurantId, int customerId) { using (var transactionScope = new TransactionScope()) { try { var repo = GoEatRepo.Instance; using (var db = repo.OpenConnectionFromPool()) { MainTransaction mainTransaction = new MainTransaction { cashier_id = cashierId, created_date = DateTime.UtcNow, method = ConstantValues.S_MAKE_PAYMENT, restaurant_id = restaurantId, customer_id = customerId }; var mainTransactionId = repo.CreateMainTransaction(db, mainTransaction); transactionScope.Complete(); return mainTransactionId; } } catch { return 0; } } }