コード例 #1
0
        public ActionResult Confirm(string vpc_AdditionData, string vpc_Amount, string vpc_Command, string vpc_CurrencyCode, string vpc_Locale, string vpc_MerchTxnRef, string vpc_Merchant, string vpc_OrderInfo,
                                    string vpc_TransactionNo, string vpc_TxnResponseCode, string vpc_Version, string vpc_SecureHash)
        {
            Utils.WriteLogToFile("[Date]=[" + DateTime.Now + "]|[vpc_AdditionData]=[" + vpc_AdditionData + "]|[vpc_Amount]=[" + vpc_Amount + "]|[vpc_Command]=[" + vpc_Command + "]|[vpc_CurrencyCode]=[" + vpc_CurrencyCode + "]|[vpc_Locale]=[" + vpc_Locale + "]|[vpc_MerchTxnRef]=[" + vpc_MerchTxnRef + "]|[vpc_Merchant]=[" + vpc_Merchant + "]|[vpc_OrderInfo]=[" + vpc_OrderInfo + "]|[vpc_TransactionNo]=[" + vpc_TransactionNo + "]|[vpc_TxnResponseCode]=[" + vpc_TxnResponseCode + "]|[vpc_Version]=[" + vpc_Version + "]|[vpc_SecureHash]=[" + vpc_SecureHash + "]");

            AppoinmentView appointment = new AppoinmentView();

            appointment = _appoinmentBusiness.GetByCode(vpc_OrderInfo);

            bool status = false;

            if (appointment != null && appointment.ID != 0)
            {
                if (vpc_TxnResponseCode == "0")
                {
                    status = true;
                    if (!appointment.IsPayment)
                    {
                        if (_appoinmentBusiness.UpdatePayment(appointment.ID))
                        {
                            _appoinmentBusiness.Save();
                        }
                    }
                }
                else
                {
                    status = false;
                    if (_appoinmentBusiness.UpdateStatus(appointment.ID, -1))
                    {
                        _appoinmentBusiness.Save();
                    }
                }
            }
            ViewBag.StatusPayment = status;
            return(View(appointment));
        }
コード例 #2
0
        public string UpdateStatus(int id, int status)
        {
            try
            {
                if (id == 0)
                {
                    return("Mã không tồn tại!");
                }

                if (_appoinmentBusiness.UpdateStatus(id, status))
                {
                    _appoinmentBusiness.Save();
                }
                return("");
            }
            catch (Exception)
            {
                return("Đã xảy ra lỗi!");
            }
        }