public void AddTransaction(DAL.Transaction model) { model.Id = Guid.NewGuid(); model.TransactionDateTime = DateTime.UtcNow; transactionRepository.Insert(model); transactionRepository.Save(); }
public void EditTransaction(int transactionId, DAL.Transaction newTransaction) { DAL.Transaction model = transactionRepository.GetById(transactionId); model.Amount = newTransaction.Amount; model.CurrencyCode = newTransaction.CurrencyCode; EditTransaction(model); }
public void DeleteTransaction(int areaId) { DAL.Transaction model = transactionRepository.GetById(areaId); if (model == null) { return; } Delete(areaId); }
public static DAL.Transaction TransactionBackendToDal(Backend.Transaction t) { DAL.Transaction temp = new DAL.Transaction(); temp.ID = t.transactionID; temp.dateTime = t.dateTime; temp.isAReturn = t.isAReturn; temp.paymentMethod = t.paymentMethod; temp.reciptID = t.receipt; temp.customerID = t.customerID; return(temp); }
public void Add(string transactionID, DateTime datetime, bool isAReturn, string receipt, string paymentMethod, string id) { DB.Add(new Backend.Transaction(transactionID, datetime, isAReturn, receipt, paymentMethod)); DAL.Transaction temp = Change.TransactionBackendToDal(new Backend.Transaction(transactionID, datetime, isAReturn, receipt, paymentMethod)); temp.customerID = id; emartDataContext.Transactions.InsertOnSubmit(temp); DAL.Recipt_Transaction rt = new Recipt_Transaction(); rt.reciptID = receipt; rt.transactionID = transactionID; emartDataContext.Recipt_Transactions.InsertOnSubmit(rt); emartDataContext.SubmitChanges(); Encryption.encryption(DB, path); }
public DataSet PaymentHistory() { try { DataSet dtResult = new DataSet(); transaction = new DAL.Transaction(); PopulateDataLayer(); dtResult = transaction.PaymentsHistory(); return(dtResult); } catch (Exception ex) { throw ex; } }
public DataSet TransactionGetByBillingNo() { try { transaction = new DAL.Transaction(); DataSet dataResult = new DataSet(); PopulateDataLayer(); dataResult = transaction.TransactionGetByBillingNo(); return(dataResult); } catch (Exception ex) { throw ex; } }
public DataSet RegisterMobileNumber() { try { DataSet dtResult = new DataSet(); transaction = new DAL.Transaction(); PopulateDataLayer(); dtResult = transaction.RegisterMobileNumber(); return(dtResult); } catch (Exception ex) { throw ex; } }
public DataSet LoadAccessNumber() { try { DataSet dtResult = new DataSet(); transaction = new DAL.Transaction(); PopulateDataLayer(); dtResult = transaction.LoadAccessCard(); return(dtResult); } catch (Exception ex) { throw ex; } }
public DataSet GetParticular() { try { DataSet dtResult = new DataSet(); transaction = new DAL.Transaction(); PopulateDataLayer(); dtResult = transaction.GetParticularList(); return(dtResult); } catch (Exception ex) { throw ex; } }
public DataSet GetBillingNumber() { try { DataSet dtResult = new DataSet(); transaction = new DAL.Transaction(); PopulateDataLayer(); dtResult = transaction.GetBillingNo(); return(dtResult); } catch (Exception ex) { throw ex; } }
public DataSet TransactionGetByKey() { try { DataSet dtResult = new DataSet(); transaction = new DAL.Transaction(); PopulateDataLayer(); dtResult = transaction.TransactionGetByID(); return(dtResult); } catch (Exception ex) { throw ex; } }
public Boolean Save() { try { Boolean status = false; transaction = new DAL.Transaction(); PopulateDataLayer(); transaction.Save(); status = true; return(status); } catch (Exception ex) { throw ex; } }
public void Remove(string id) { var transaction = from t in DB where t.transactionID == id select t; foreach (Backend.Transaction t in transaction) { DB.Remove(t); DAL.Transaction temp = Change.TransactionBackendToDal(t); emartDataContext.Transactions.DeleteOnSubmit(temp); emartDataContext.SubmitChanges(); Encryption.encryption(DB, path); return; } }
public Boolean TransactionDelete() { try { Boolean status = false; transaction = new DAL.Transaction(); PopulateDataLayer(); transaction.TransactionDelete(); MessageBox.Show("Record Successfully Deleted!", "Delete Record"); status = true; return(status); } catch (Exception ex) { throw ex; } }
public void CreateTransactions(string user) { var ctx = new DAL.BettingRoomEntities(); var account = ctx.AccountBalances.Where(a => a.UserId == user).FirstOrDefault(); for (int i = 1; i < 30; i++) { var transaction = new DAL.Transaction { AccountId = account.Id, Amount = GetAmount(), TransactionType = GetTransactionType(), TransactionTime = new DateTime(2015, 04, i) }; if (transaction.TransactionType == "Withdraw" || transaction.TransactionType == "Bet") { if (account.AmountInEuro >= transaction.Amount) { ctx.Transactions.Add(transaction); account.AmountInEuro = account.AmountInEuro - transaction.Amount; ctx.SaveChanges(); } } else if (transaction.TransactionType == "Winning" || transaction.TransactionType == "Deposit") { ctx.Transactions.Add(transaction); account.AmountInEuro = account.AmountInEuro + transaction.Amount; ctx.SaveChanges(); } } }
private static void CheckWinningBets(int gameId, DAL.BettingRoomEntities ctx, DAL.Game game) { var winningBets = ctx.BetOneGames.Where(b => b.GameId == gameId && b.C1X2 == game.Result1X2).ToList(); if (winningBets.Count > 0) { foreach (var bet in winningBets) { bet.WonOrLose = "WON"; var account = ctx.AccountBalances.Where(a => a.UserId == bet.UserId).FirstOrDefault(); account.AmountInEuro = account.AmountInEuro + (bet.BetAmount * bet.Odds); var transaction = new DAL.Transaction { AccountId = account.Id, TransactionType = "Winning", TransactionTime = game.GameTime.AddHours(2), Amount = bet.BetAmount * bet.Odds, }; ctx.Transactions.Add(transaction); ctx.SaveChanges(); } } }
private void EditTransaction(DAL.Transaction model) { transactionRepository.Update(model); transactionRepository.Save(); }