public List <StatementModel> GetStatement(long Accountno)
        {
            TransactionDataAccess tranDac = new TransactionDataAccess();
            DataSet ds = tranDac.Read(Accountno);
            List <StatementModel> Transactionlist = new List <StatementModel>();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                StatementModel uobj = new StatementModel();
                uobj.TransactionId        = Convert.ToInt32(ds.Tables[0].Rows[i]["transaction_id"].ToString());
                uobj.DebitAccount         = Convert.ToInt64(ds.Tables[0].Rows[i]["debit_account_no"].ToString());
                uobj.CreditAccount        = Convert.ToInt64(ds.Tables[0].Rows[i]["credit_account_no"].ToString());
                uobj.DebitAccountBalance  = Convert.ToInt64(ds.Tables[0].Rows[i]["debit_account_balance"].ToString());
                uobj.CreditAccountBalance = Convert.ToInt64(ds.Tables[0].Rows[i]["credit_account_balance"].ToString());
                uobj.Amount = Convert.ToInt32(ds.Tables[0].Rows[i]["amount"].ToString());

                uobj.TransactionDate = ds.Tables[0].Rows[i]["transaction_date_time"].ToString();


                Transactionlist.Add(uobj);
            }

            TransactionDataAccess.sqlCon.Close();
            return(Transactionlist);
        }
예제 #2
0
 public string GetMsgContent(int transactionID)
 {
     using (TransactionDataAccess transactionDA = new TransactionDataAccess())
     {
         return(transactionDA.GetMsgContent(transactionID));
     }
 }
        public void LoadRecurringList_ListWithRecurringTransaction()
        {
            var dbHelper = new SqliteConnectionCreator(new WindowsSqliteConnectionFactory());

            var transactionDataAccess =
                new TransactionDataAccess(dbHelper);
            var recTransactionDataAccess =
                new RecurringTransactionDataAccess(dbHelper);
            var repository = new TransactionRepository(transactionDataAccess, recTransactionDataAccess);

            transactionDataAccess.SaveItem(new FinancialTransaction {Amount = 999, IsRecurring = false});
            transactionDataAccess.SaveItem(new FinancialTransaction
            {
                Amount = 123,
                IsRecurring = true,
                RecurringTransaction = new RecurringTransaction {IsEndless = true}
            });

            repository.Load();
            var result = repository.LoadRecurringList().ToList();

            result.Count.ShouldBe(1);

            result.First().Id.ShouldBe(2);
            result.First().RecurringTransaction.Id.ShouldBe(1);
        }
예제 #4
0
 public int GetMsgNumbers(string getTeaNumber)
 {
     using (TransactionDataAccess transactionDA = new TransactionDataAccess())
     {
         return(transactionDA.GetMsgNumbers(getTeaNumber));
     }
 }
예제 #5
0
 public DataSet TranSearch(string getNumber, string sendFrom, string content, string title, string timeType, string readType)
 {
     using (TransactionDataAccess transactionDA = new TransactionDataAccess())
     {
         return(transactionDA.TranSearch(getNumber, sendFrom, content, title, timeType, readType));
     }
 }
예제 #6
0
 public void DeleteTransaction(int tranID)
 {
     using (TransactionDataAccess transactionDA = new TransactionDataAccess())
     {
         transactionDA.DeleteTransaction(tranID);
     }
 }
예제 #7
0
 public DataSet GetTeaInfoListForTran(string getDept, string getDuty, string getName, string getNumber)
 {
     using (TransactionDataAccess transactionDA = new TransactionDataAccess())
     {
         return(transactionDA.GetTeaInfoListForTran(getDept, getDuty, getName, getNumber));
     }
 }
예제 #8
0
 public DataSet GetTransactionByTNumber(string TNumber)
 {
     using (TransactionDataAccess transactionDA = new TransactionDataAccess())
     {
         return(transactionDA.GetTransactionByTNumber(TNumber));
     }
 }
예제 #9
0
 public TransactionService()
 {
     if (TransactionService.transactionDataAccess == null)
     {
         TransactionService.transactionDataAccess = new TransactionDataAccess();
     }
 }
예제 #10
0
        public ActionResult PartialTransactionReport(DateTime?startDate, DateTime?endDate)
        {
            var minStartDate = startDate == null ? startDate : CustomHelper.ConvertToMinDate(startDate);
            var maxEndDate   = endDate == null ? endDate : CustomHelper.ConvertToMaxDate(endDate);
            var viewModel    = new TransactionDataAccess().GetTransactions(minStartDate, maxEndDate);

            return(PartialView("_partialTransactionReport", viewModel));
        }
예제 #11
0
 public int InsertTransaction(string sendFrom, string sendTo,
                              DateTime sendDate, string content, string sendTitle)
 {
     using (TransactionDataAccess transactionDA = new TransactionDataAccess())
     {
         return(transactionDA.InsertTransaction(sendFrom, sendTo,
                                                sendDate, content, sendTitle));
     }
 }
예제 #12
0
        public TransactionController()
        {
            string dataFilePath = Path.Combine(Directory.GetCurrentDirectory(), "Data", "transactions.csv");

            CsvDataAccessStrategy dataAccess            = new CsvDataAccessStrategy(dataFilePath);
            CsvDataParserStrategy <ITransaction> parser = new CsvDataParserStrategy <ITransaction>(';');

            TransactionDataAccess = new TransactionDataAccess(parser, dataAccess);
        }
예제 #13
0
        public IActionResult Post([FromBody] TransactionModel dataViewModel)
        {
            var model = dataViewModel;

            model.ID               = DateTime.UtcNow.Ticks.ToString();
            model.CreatedOn        = DateTime.UtcNow;
            model.ModifiedOn       = DateTime.UtcNow;
            model.TransactionState = TransactionState.PROCESSING;

            var transactionDA = new TransactionDataAccess();

            transactionDA.SaveToDatabase(model);
            return(Ok("Done"));
        }
예제 #14
0
        public ActionResult Payment(string shipName, string mobile, string address, string email)
        {
            var order = new Transaction();

            order.CreatedDate  = DateTime.Now;
            order.User_Address = address;
            order.User_Phone   = mobile;
            order.User_Name    = shipName;
            order.User_Email   = email;

            try
            {
                var    id               = new TransactionDataAccess().Insert(order);
                var    cart             = (List <CartItem>)Session[CartSession];
                var    detailDataAccess = new OrderDataAccess();
                double total            = 0;
                foreach (var item in cart)
                {
                    var orderDetail = new Order();
                    orderDetail.ProductID     = item.Product.ProductID;
                    orderDetail.TransactionID = id;
                    orderDetail.OrderID       = id;
                    orderDetail.Quantity      = item.Quantity;
                    orderDetail.Price         = item.Product.Price;
                    orderDetail.Name          = item.Product.Name;
                    detailDataAccess.Insert(orderDetail);

                    total += (item.Product.Price.GetValueOrDefault(0) * item.Quantity);
                }
                string content = System.IO.File.ReadAllText(Server.MapPath("~/assets/client/template/neworder.html"));

                content = content.Replace("{{CustomerName}}", shipName);
                content = content.Replace("{{Phone}}", mobile);
                content = content.Replace("{{Email}}", email);
                content = content.Replace("{{Address}}", address);
                content = content.Replace("{{Total}}", total.ToString("N0"));
                var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString();

                new MailHelper().SendMail(email, "Đơn hàng mới từ ShopHoa", content);
                new MailHelper().SendMail(toEmail, "Đơn hàng mới từ ShopHoa", content);
            }
            catch (Exception ex)
            {
                //ghi log
                return(Redirect("/loi-thanh-toan"));
            }
            return(Redirect("/hoan-thanh"));
        }
예제 #15
0
        public void TransactionDataAccess_CrudTransaction()
        {
            var transactionDataAccess = new TransactionDataAccess();

            const double firstAmount  = 76.30;
            const double secondAmount = 22.90;

            var transaction = new FinancialTransaction {
                ChargedAccount = new Account {
                    Id = 4
                },
                Amount  = firstAmount,
                Date    = DateTime.Today,
                Note    = "this is a note!!!",
                Cleared = false
            };

            transactionDataAccess.Save(transaction);

            var list = transactionDataAccess.LoadList();

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(firstAmount, list.First().Amount);

            transaction.Amount = secondAmount;

            transactionDataAccess.Save(transaction);

            transactionDataAccess.LoadList();
            list = transactionDataAccess.LoadList();

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(secondAmount, list.First().Amount);

            transactionDataAccess.Delete(transaction);

            transactionDataAccess.LoadList();
            list = transactionDataAccess.LoadList();
            Assert.IsFalse(list.Any());
        }
        public void TransactionDataAccess_CrudTransaction()
        {
            var transactionDataAccess =
                new TransactionDataAccess(new SqliteConnectionCreator(new WindowsSqliteConnectionFactory()));

            const double firstAmount = 76.30;
            const double secondAmount = 22.90;

            var transaction = new FinancialTransaction
            {
                ChargedAccount = new Account {Id = 4},
                Amount = firstAmount,
                Date = DateTime.Today,
                Note = "this is a note!!!",
                IsCleared = false
            };

            transactionDataAccess.SaveItem(transaction);

            var list = transactionDataAccess.LoadList();

            Assert.Equal(1, list.Count);
            Assert.Equal(firstAmount, list.First().Amount);

            transaction.Amount = secondAmount;

            transactionDataAccess.SaveItem(transaction);

            transactionDataAccess.LoadList();
            list = transactionDataAccess.LoadList();

            Assert.Equal(1, list.Count);
            Assert.Equal(secondAmount, list.First().Amount);

            transactionDataAccess.DeleteItem(transaction);

            transactionDataAccess.LoadList();
            list = transactionDataAccess.LoadList();
            Assert.False(list.Any());
        }
        public void TransactionDataAccess_CrudTransaction()
        {
            var transactionDataAccess = new TransactionDataAccess(new DbHelper(new SQLitePlatformWinRT(), new TestDatabasePath()));

            const double firstAmount = 76.30;
            const double secondAmount = 22.90;

            var transaction = new FinancialTransaction
            {
                ChargedAccount = new Account {Id = 4},
                Amount = firstAmount,
                Date = DateTime.Today,
                Note = "this is a note!!!",
                Cleared = false
            };

            transactionDataAccess.Save(transaction);

            var list = transactionDataAccess.LoadList();

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(firstAmount, list.First().Amount);

            transaction.Amount = secondAmount;

            transactionDataAccess.Save(transaction);

            transactionDataAccess.LoadList();
            list = transactionDataAccess.LoadList();

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(secondAmount, list.First().Amount);

            transactionDataAccess.Delete(transaction);

            transactionDataAccess.LoadList();
            list = transactionDataAccess.LoadList();
            Assert.IsFalse(list.Any());
        }
        public void TransactionDataAccess_CrudTransactionWithoutAccount()
        {
            var transactionDataAccess = new TransactionDataAccess();

            const double firstAmount = 76.30;
            const double secondAmount = 22.90;

            var transaction = new FinancialTransaction
            {
                Amount = firstAmount,
                Date = DateTime.Today,
                Note = "this is a note!!!",
                Cleared = false
            };

            transactionDataAccess.Save(transaction);

            var list = transactionDataAccess.LoadList();

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(firstAmount, list.First().Amount);

            transaction.Amount = secondAmount;

            transactionDataAccess.Save(transaction);

            transactionDataAccess.LoadList();
            list = transactionDataAccess.LoadList();

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(secondAmount, list.First().Amount);

            transactionDataAccess.Delete(transaction);

            transactionDataAccess.LoadList();
            list = transactionDataAccess.LoadList();
            Assert.IsFalse(list.Any());
        }
        public void SendMoney(long debit, long credit, int amount)
        {
            TransactionDataAccess tranDA = new TransactionDataAccess();

            tranDA.InsertDetails(debit, credit, amount);
        }
예제 #20
0
 public TransactionForm()
 {
     InitializeComponent();
     transactionDataAccess = new TransactionDataAccess();
 }
예제 #21
0
 public ItemManager()
 {
     itemDataAccess        = new ItemDataAccess();
     transactionDataAccess = new TransactionDataAccess();
 }
예제 #22
0
 public TransactionService()
 {
     this.TransactionDataAccess = new TransactionDataAccess();
 }
        public void SaveTransaction_ChargedAccountSet_AccountIdAssociated()
        {
            var transactionDataAccess =
                new TransactionDataAccess(new SqliteConnectionCreator(new WindowsSqliteConnectionFactory()));

            var transaction = new FinancialTransaction
            {
                ChargedAccount = new Account {Id = 4},
                Amount = 76.30,
                Date = DateTime.Today,
                Note = "this is a note!!!",
                IsCleared = false
            };

            transactionDataAccess.SaveItem(transaction);

            transaction.ChargedAccountId.ShouldBe(4);
        }
예제 #24
0
 public ProcessTransactionLogic()
 {
     _transactionDA         = new TransactionDataAccess();
     _loyaltyCardDataAccess = new LoyaltyCardDataAccess();
 }