📄 myorderpay1.aspx.cs
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
namespace YXShop.Web.Membercenter.Dynamic
{
public partial class myOrderPay1 : System.Web.UI.Page
{
public static string orderId = "";//保留訂單號
public static int userID = 0;
private static decimal orderPrice = 0;
private decimal outPrice = 0;
private static decimal remiPrice = 0;
private static decimal paymPrice = 0;
private static decimal prepPrice = 0;
YXShop.BLL.RemittanceInfo Remibll = new YXShop.BLL.RemittanceInfo();//银行支付
YXShop.BLL.PaymentMoney paymbll = new YXShop.BLL.PaymentMoney();//现金支付
YXShop.BLL.PrepayMoney prepbll = new YXShop.BLL.PrepayMoney();//预付款支付
YXShop.BLL.Orders bll = new YXShop.BLL.Orders();
YXShop.BLL.MemberInfo membBll = new YXShop.BLL.MemberInfo();
YXShop.BLL.UserInAndExp uiaeBll = new YXShop.BLL.UserInAndExp();
protected void Page_Load(object sender, EventArgs e)
{
if (Session["MemberID"] == null)
{
Response.Redirect("../index.aspx", true);
}
else
{
if (string.IsNullOrEmpty(Session["MemberID"].ToString()))
{
Response.Redirect("../index.aspx", true);
}
}
if ((!IsPostBack) || ((Request["Event"] != null) && (Request["Event"] != "")))
{
//初始化信息(订单信息,银行信息,支付信息)
if (!string.IsNullOrEmpty(Request.QueryString["OrderID"]))
{
//bindOrderInfo(YXShop.Common.WebUtility.replaceStr(Request.QueryString["OrderID"]));
orderId = YXShop.Common.WebUtility.replaceStr(Request.QueryString["OrderID"]);
bindOrderInfo(orderId);
}
else
{
Response.Redirect("../Sueeccd.aspx?key=银行支付&url=Dynamic/myOrderList.aspx", true);
}
}
}
/// <summary>
/// 订单信息
/// </summary>
/// <param name="orderID"></param>
private void bindOrderInfo(string orderID)
{
List<YXShop.Model.Orders> li = bll.GetListByColumn("OrderID", orderID);
YXShop.Model.RemittanceInfo bankModel = Remibll.GetModel(orderId);
YXShop.Model.PaymentMoney paymModel = paymbll.GetModel(orderId);
YXShop.Model.PrepayMoney prepModel = prepbll.GetModel(orderId);
if (li.Count == 1)
{
orderPrice = Convert.ToDecimal(li[0].FactPrice);
remiPrice = Convert.ToDecimal(bankModel != null ? bankModel.RemittanceMoney : 0);
paymPrice = Convert.ToDecimal(paymModel != null ? paymModel.GatheringMoney : 0);
prepPrice = Convert.ToDecimal(prepModel != null ? prepModel.PayoutMoney : 0);
userID = int.Parse(li[0].UserId);
Label1.Text = li[0].ConsigneeName;
//Label2.Text = li[0].ConsigneeRealName;
myuser.Text = li[0].ConsigneeRealName;
myuser.NavigateUrl = "~/Admin/Consumer/MemberInfo.aspx?Pro_ID=" + li[0].UserId;
Label3.Text = li[0].OrderId;
Label4.Text = orderPrice.ToString();
Label5.Text = (remiPrice + paymPrice + prepPrice).ToString();//已经支付
TextBox4.Text = (orderPrice - remiPrice - paymPrice - prepPrice).ToString();
TextBox2.Text = li[0].Remark;
//TextBox1.Text = Convert.ToInt32(li[0].TotalPrice).ToString();
if (orderPrice <= (remiPrice + paymPrice + prepPrice))
{
//如果已经支付清,就转到对应信息页面
YXShop.Common.alert.show("订单已经支付清!");
}
}
}
protected void saveInfo_Click(object sender, EventArgs e)
{
YXShop.Model.UserInAndExp uiaeModel = null;
YXShop.Model.PrepayMoney prepModel = new YXShop.Model.PrepayMoney();
decimal userPrice = 0;//用户余额
List<YXShop.Model.MemberInfo> membModel = membBll.GetListByColumn("uUserName", myuser.Text);
if (membModel.Count == 1)
{
userPrice = Convert.ToDecimal(membModel[0].fSurplusCapital);
}
#region 已付款计算
decimal inPrice = Convert.ToDecimal(TextBox4.Text.Trim());
if (userPrice < inPrice)
{
YXShop.Common.alert.ShowAndRedirect(this, "用户余额不足!", "myOrderList.aspx");
}
decimal totalPrice = inPrice + remiPrice + prepPrice + paymPrice;
if (totalPrice > orderPrice)
{
//多余的款项
outPrice = totalPrice - orderPrice;
}
//现金总金额
if (outPrice > 0)
{
prepModel.PayoutMoney = (inPrice + prepPrice - outPrice);
}
else
{
prepModel.PayoutMoney = (inPrice + prepPrice);//現金錄入金額
}
#endregion
#region 預付款記錄信息
prepModel.OrderID = orderId;
prepModel.UserName = myuser.Text;
//prepModel.PayoutMoney
prepModel.ReMark = YXShop.Common.WebUtility.replaceStr(TextBox2.Text);
prepModel.BosomNote = YXShop.Common.WebUtility.replaceStr(TextBox5.Text);
prepModel.NoteDate = DateTime.Now;
prepModel.NoteName = Session["MemberID"].ToString();
#endregion
//int userID = membBll.getUserIDByName(myuser.Text);
if (userID == 0)
{
YXShop.Common.alert.ShowAndRedirectgo(this, "请你先登陆!", "../index.aspx");
}
#region 用户交易明细
uiaeModel = new YXShop.Model.UserInAndExp();
uiaeModel.UserID = userID;
uiaeModel.AdsumMoneyDate = getMoneyDate.Date;
uiaeModel.AdsumMoney = Convert.ToDecimal(TextBox4.Text);
uiaeModel.PresentTicket = 0;
uiaeModel.RemitJoinMode = YXShop.Common.StatuEnum.RemitJoinMode.虚拟货币.GetHashCode();//支付方式:預付款
uiaeModel.RemitJoinBank = "";
uiaeModel.Remark = YXShop.Common.WebUtility.replaceStr(TextBox2.Text.Trim()) == string.Empty ? "支付订单费用。订单号:" + orderId + "" : YXShop.Common.WebUtility.replaceStr(TextBox2.Text.Trim());//备注
uiaeModel.InformMode = "银行汇兑";//通知方式
uiaeModel.BosomNote = YXShop.Common.WebUtility.replaceStr(TextBox5.Text);//内部信息
uiaeModel.NoteDate = DateTime.Now;
uiaeModel.NoteName = Session["MemberName"].ToString();
uiaeModel.incomeAndExpStatus = 1;
uiaeModel.Status = 1;
#endregion
#region 数据处理
try
{
//用户明细信息添加
uiaeBll.Add(uiaeModel);
if (prepbll.UpdateMoney(prepModel) != 1)
{
prepbll.Add(prepModel);
}
//付款状态,订单状态
if (totalPrice >= orderPrice)
{
bll.UpdateOrders("PaymentStatus", YXShop.Common.StatuEnum.PaymentStatu.已经付清.GetHashCode(), orderId);
}
else
{
bll.UpdateOrders("PaymentStatus", YXShop.Common.StatuEnum.PaymentStatu.未付清.GetHashCode(), orderId);
bll.UpdateOrders("OrderStatus", YXShop.Common.StatuEnum.OrderStatu.未结清.GetHashCode(), orderId);
}
if (outPrice > 0)
{
membBll.addUserMoney(userID, outPrice);
}
Response.Redirect("../Sueeccd.aspx?key=现金支付成功!&url=orderInfo.aspx?OrderID=" + orderId);
}
catch
{
Response.Redirect("../Sueeccd.aspx?key=现金支付失败!");
//YXShop.Common.alert.ShowAndRedirect(this, "現金支付失败!", "orderInfo.aspx?OrderID=" + orderId);
}
#endregion
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("myOrderInfo.aspx?OrderID=" + orderId, true);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -