Beispiel #1
0
        //Add or Post Transactions
        public string PostMomoTransaction(MomoTransaction momoTransaction)
        {
            string msg = "";

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

                    command.Parameters.AddWithValue("@RefNo ", momoTransaction.CUSTOMERREFERENCEID);
                    command.Parameters.AddWithValue("@MomoNumber ", momoTransaction.MSISDN);
                    command.Parameters.AddWithValue("@Amount", momoTransaction.AMOUNT);
                    command.Parameters.AddWithValue("@TransactionID", momoTransaction.TXNID);
                    command.Parameters.AddWithValue("@Type", momoTransaction.TYPE);
                    command.Parameters.AddWithValue("@CompanyName", momoTransaction.COMPANYNAME);

                    command.Parameters.AddWithValue("@ReferenceID", momoTransaction.RefID);
                    command.Parameters.AddWithValue("@MNO ", momoTransaction.MNO);

                    var result = Save(command);

                    msg = result;
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
            return(msg);
        }
Beispiel #2
0
        public MomoTransaction GetMomoTransactionByRefNo(string ref_number)
        {
            using (var command = new SqlCommand())
            {
                command.CommandText = "usp_Get_Momo_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 MomoTransaction
                    {
                        EntryID             = (int)r["EntryID"],
                        CUSTOMERREFERENCEID = r["RefNo"].ToString(),
                        AMOUNT = Convert.ToDecimal(r["Amount"]),
                        MSISDN = r["MomoNumber"].ToString(),
                        MNO    = r["MNO"].ToString()
                    };
                    return(transaction);
                }
                return(null);
            }
        }