Esempio n. 1
0
 public void AddTransaction(DAL.Transaction model)
 {
     model.Id = Guid.NewGuid();
     model.TransactionDateTime = DateTime.UtcNow;
     transactionRepository.Insert(model);
     transactionRepository.Save();
 }
Esempio n. 2
0
 public void EditTransaction(int transactionId, DAL.Transaction newTransaction)
 {
     DAL.Transaction model = transactionRepository.GetById(transactionId);
     model.Amount       = newTransaction.Amount;
     model.CurrencyCode = newTransaction.CurrencyCode;
     EditTransaction(model);
 }
Esempio n. 3
0
 public void DeleteTransaction(int areaId)
 {
     DAL.Transaction model = transactionRepository.GetById(areaId);
     if (model == null)
     {
         return;
     }
     Delete(areaId);
 }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
 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);
 }
Esempio n. 6
0
 public DataSet PaymentHistory()
 {
     try
     {
         DataSet dtResult = new DataSet();
         transaction = new DAL.Transaction();
         PopulateDataLayer();
         dtResult = transaction.PaymentsHistory();
         return(dtResult);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 7
0
 public DataSet TransactionGetByBillingNo()
 {
     try
     {
         transaction = new DAL.Transaction();
         DataSet dataResult = new DataSet();
         PopulateDataLayer();
         dataResult = transaction.TransactionGetByBillingNo();
         return(dataResult);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 8
0
 public DataSet RegisterMobileNumber()
 {
     try
     {
         DataSet dtResult = new DataSet();
         transaction = new DAL.Transaction();
         PopulateDataLayer();
         dtResult = transaction.RegisterMobileNumber();
         return(dtResult);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 9
0
 public DataSet LoadAccessNumber()
 {
     try
     {
         DataSet dtResult = new DataSet();
         transaction = new DAL.Transaction();
         PopulateDataLayer();
         dtResult = transaction.LoadAccessCard();
         return(dtResult);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 10
0
 public DataSet GetParticular()
 {
     try
     {
         DataSet dtResult = new DataSet();
         transaction = new DAL.Transaction();
         PopulateDataLayer();
         dtResult = transaction.GetParticularList();
         return(dtResult);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 11
0
 public DataSet GetBillingNumber()
 {
     try
     {
         DataSet dtResult = new DataSet();
         transaction = new DAL.Transaction();
         PopulateDataLayer();
         dtResult = transaction.GetBillingNo();
         return(dtResult);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 12
0
 public DataSet TransactionGetByKey()
 {
     try
     {
         DataSet dtResult = new DataSet();
         transaction = new DAL.Transaction();
         PopulateDataLayer();
         dtResult = transaction.TransactionGetByID();
         return(dtResult);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 13
0
 public Boolean Save()
 {
     try
     {
         Boolean status = false;
         transaction = new DAL.Transaction();
         PopulateDataLayer();
         transaction.Save();
         status = true;
         return(status);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 14
0
        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;
            }
        }
Esempio n. 15
0
 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;
     }
 }
Esempio n. 16
0
        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();
                }
            }
        }
Esempio n. 17
0
        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();
                }
            }
        }
Esempio n. 18
0
 private void EditTransaction(DAL.Transaction model)
 {
     transactionRepository.Update(model);
     transactionRepository.Save();
 }