using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL;
|
using CY.Model;
|
using CY.Infrastructure.Query;
|
using CY.Infrastructure.Common;
|
using CY.BLL.Sys;
|
using DealMvc.Pay.Tenpay;
|
|
namespace CY.WebForm.Pages.pay
|
{
|
public partial class RechargeSubmit : BasePage
|
{
|
Pay_AccountedRecordBLL bll_Pay_AccountedRecordBLL = null;
|
Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
|
DateTime nowTime = new DateTime();
|
|
//初始化
|
public RechargeSubmit()
|
{
|
bll_Pay_AccountedRecordBLL = new Pay_AccountedRecordBLL();
|
bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
nowTime = DateTime.Now;
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
GetRechargeData();
|
}
|
}
|
|
//获取充值数据
|
public void GetRechargeData()
|
{
|
Session["RechargeSubmit"] = "get";
|
string RecordNumber = bll_Pay_AccountedRecordBLL.GetNewRecordNumber();
|
decimal? RechargeMoney = Request["txtRechargeMoney"].ToDecimal2();
|
string RechargeType = Request["RechargeType"].ToString2();
|
if (RechargeMoney == null || RechargeMoney.Value.ToString("0.00").ToDouble2() <= 0.00)
|
Response.Redirect("/Pages/pay/RechargeReturn.aspx");
|
else if (string.IsNullOrEmpty(RechargeType))
|
Response.Redirect("/Pages/pay/RechargeReturn.aspx");
|
else
|
{
|
Pay_AccountedRecord m_Pay_AccountedRecord = new Pay_AccountedRecord();
|
m_Pay_AccountedRecord.AccountingMoney = RechargeMoney;
|
m_Pay_AccountedRecord.AccountingTarget = RechargeType;
|
m_Pay_AccountedRecord.NoteDate = nowTime;
|
m_Pay_AccountedRecord.OperateTypeId = bll_Sys_DictionaryBLL.GetKeyIdByKeyid(1, "Pay_入账类型");
|
m_Pay_AccountedRecord.PayId = CurrentPayAccount.Keyid;
|
m_Pay_AccountedRecord.StatusId = bll_Sys_DictionaryBLL.GetKeyIdByKeyid(1, "Pay_交易状态");
|
m_Pay_AccountedRecord.RecordNumber = RecordNumber;
|
if (bll_Pay_AccountedRecordBLL.InsertModel(m_Pay_AccountedRecord))
|
Checkout(RecordNumber, RechargeType);
|
else
|
Response.Redirect("/Pages/pay/RechargeReturn.aspx");
|
}
|
}
|
|
/// <summary>
|
/// 充值开始
|
/// </summary>
|
/// <param name="RecordNumber">流水号</param>
|
/// <param name="RechargeType">银行类别</param>
|
/// <returns></returns>
|
public void Checkout(string RecordNumber, string RechargeType)
|
{
|
Pay_AccountedRecord m_Pay_AccountedRecord = bll_Pay_AccountedRecordBLL.GetModel(RecordNumber);
|
if (m_Pay_AccountedRecord == null || m_Pay_AccountedRecord.Keyid == null)
|
Response.Redirect("/Pages/pay/RechargeReturn.aspx");
|
else
|
{
|
Session["RechargeMoney"] = m_Pay_AccountedRecord.AccountingMoney.ToDecimal2().Value.ToString("0.00");
|
Session["RechargeBank"] = bll_Sys_DictionaryBLL.GetNameByMeanValue(RechargeType.ToInt32(), "Pay_银行名称");
|
UtilPay NowUtiPay = new UtilPay(System.Web.HttpContext.Current);
|
NowUtiPay.Yinhang = RechargeType;
|
string TenpayURL = NowUtiPay.GetTenpayUrl("会员[" + CurrentUser.Name + "] 充值",
|
m_Pay_AccountedRecord.RecordNumber,
|
m_Pay_AccountedRecord.AccountingMoney.ToDecimal2().Value.ToString("0.00"),
|
"/Pages/pay/RechargeReturn.aspx");
|
//Response.Write("<script>window.showModelessDialog('" + TenpayURL + "')</script>");
|
Response.Redirect(TenpayURL);
|
}
|
}
|
}
|
}
|