public string BankPayment(string paramList)
        {
            string[] parameters = paramList.Split(',');
            JavaScriptSerializer jsonObj = new JavaScriptSerializer();
            try
            {
                if (Session["UserID"] != null) //already logged in
                {
                    if (Session["Role"].Equals("admin") || Session["Role"].Equals("member"))
                    {
                        UserID = (int)Session["UserID"];
                    }
                }
                else
                {
                    return jsonObj.Serialize("LoginPrompt");//RedirectToAction("Login","Account");
                }
                var userCartDAL = new UserCartDAL(UserID);

                var validateTrans = UserDAL.AuthenticateTransaction(UserID, parameters[0], parameters[1], parameters[2]);

                if (validateTrans)
                {
                    if (userCartDAL.SaveTransaction(parameters[1]))
                    {
                        return jsonObj.Serialize("success");
                    }
                }
            }
            catch (Exception)
            {
            }
            return jsonObj.Serialize("failure");
        }
示例#2
0
        public ActionResult Index(BankCart model)
        {
            if (null == UserID) UserID = -1;
            List<CartItem> cartItemList = new List<CartItem>();
            try
            {
                if (Session["UserID"] != null) //already logged in
                {
                    if (Session["Role"].Equals("admin") || Session["Role"].Equals("member"))
                    {
                        UserID = (int)Session["UserID"];
                    }
                }
                else
                {
                    //return
                    return RedirectToAction("Login", "Account", new { ReturnToUrl = "/Cart/" });//RedirectToAction("Login","Account");
                }
                var userCartDAL = new UserCartDAL(UserID);

                var validateTrans = true;// UserDAL.AuthenticateTransaction(UserID, model.BankName, model.AccountNo, model.TransactionPassword);

                if (validateTrans)
                {
                    if (userCartDAL.SaveTransaction(model.AccountNo))
                    {
                        return RedirectToAction("Member", "Transaction");
                    }
                }
            }
            catch (Exception)
            {

            }
            ModelState.AddModelError("", "Incorrect bank details are entered.");
            return View(model);
        }