예제 #1
0
        //Add or Post Transactions
        public string PostBankTransaction(BankTransaction transaction)
        {
            string msg = "";

            try
            {
                var last_accessed = DateTime.Now;
                using (var command = new SqlCommand())
                {
                    command.CommandText = "[usp_Bank_LoanRepayment]";

                    command.Parameters.AddWithValue("@RefNo ", transaction.RefNo);
                    command.Parameters.AddWithValue("@B_AccountNumber ", transaction.B_AccountNumber);
                    command.Parameters.AddWithValue("@Amount", transaction.Amount);
                    command.Parameters.AddWithValue("@TransactionID", transaction.TransactionID);

                    var result = Save(command);
                    msg = result;
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
            return(msg);
        }
예제 #2
0
        //Get Transaction by RefNo
        public BankTransaction GetBankTransactionByRefNo(string ref_number)
        {
            using (var command = new SqlCommand())
            {
                command.CommandText = "usp_Get_Bank_Transaction_RefNo";
                command.Parameters.AddWithValue("@refNo", ref_number);

                var dt = GetData(command);

                if (dt != null && dt.Rows.Count > 0)
                {
                    var r = dt.Rows[0];

                    var transaction = new BankTransaction
                    {
                        EntryID         = (int)r["EntryID"],
                        RefNo           = r["RefNo"].ToString(),
                        Amount          = Convert.ToDecimal(r["Amount"]),
                        B_AccountNumber = r["B_AccountNumber"].ToString(),
                        LastUpdated     = r["LastUpdated"].ToString()
                    };
                    return(transaction);
                }
                return(null);
            }
        }