protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString["orderid"])) { BLL.OrdersManager bll = new BookShop.BLL.OrdersManager(); Model.Orders model = bll.GetModel(Request.QueryString["orderid"]); if (model != null) { if (model.State == 1) { Response.Write("以付款,无需重新付款"); } else { PayGet.PayProcess process = new BookShop.Web.PayGet.PayProcess("图书", "网上书城", Request.QueryString["orderid"], model.TotalPrice.ToString()); string url = process.GoPayPage(); Response.Redirect(url);//向支付宝发出请求. } } } }
/// <summary> /// 下订单 /// </summary> protected void CreateOrder() { if (checkOrderInfo())//如果信息填写完整开始下订单. { //1:下订单(将购物信息放入订单表中)存储过程。 string orderNum = DateTime.Now.ToString("yyyyMMddHHmmssfff") + userModel.Id;//订单号. string address = string.Format("姓名:{0},地址:{1},电话:{2},邮编:{3}", Request.Form["txtName"], Request.Form["txtAddress"], Request.Form["txtPhone"], Request.Form["txtPostCode"]); BLL.OrdersManager orderBll = new BookShop.BLL.OrdersManager(); decimal totalMoney = orderBll.GetTotalMoney(orderNum, address, userModel.Id); //2:开始向支付宝发送数据,进行支付. if (Request.Form["zfPay"] == "zfb") { PayGet.PayProcess process = new BookShop.Web.PayGet.PayProcess("图书", "网上书城", orderNum, totalMoney.ToString()); string url = process.GoPayPage(); Response.Redirect(url);//向支付宝发出请求. } } }