📄 st_shipinfo.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace STGROUP.ST_Book.ST_Product
{
/// <summary>
/// 生成订单
/// </summary>
public partial class ST_ShipInfo : System.Web.UI.Page
{
public ST_BookBiz.ST_User st_user = new STGROUP.ST_BookBiz.ST_User();
protected void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!IsPostBack)
{
//默认的收货人信息是自己
ST_BookBiz.ST_Identity identity = new ST_BookBiz.ST_Identity(User.Identity.Name);
int userid = identity.UserID;
ST_BookBiz.ST_UserEntity st_entity = st_user.GetUserInfo(userid);
txtName.Text = st_entity.ST_TrueName;
txtAddress.Text = st_entity.ST_Address;
txtEmail.Text = st_entity.ST_Email;
txtPostCode.Text = st_entity.ST_Postcode;
txtPhone.Text = st_entity.ST_Telephone;
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
}
#endregion
protected void btnNext_Click(object sender, System.EventArgs e)
{
//取出购物车中的商品信息
ST_BookBiz.ST_Cart cart = (ST_BookBiz.ST_Cart)Session["Cart"];
DataTable table = null;
if (cart != null)
{
table = cart.GetProductItems();
}
float sum = 0.00f;
for(int i=0;i<table.Rows.Count;i++)
{
sum += float.Parse(table.Rows[i]["ST_Total"].ToString());
}
ST_BookBiz.ST_Identity identity = new ST_BookBiz.ST_Identity(User.Identity.Name);
int userid = identity.UserID;
ST_BookBiz.ST_OrderEntity st_entity = new STGROUP.ST_BookBiz.ST_OrderEntity();
st_entity.ST_Consignee = txtName.Text;
st_entity.ST_ConsingeeAddress = txtAddress.Text;
st_entity.ST_ConsingeeEmail = txtEmail.Text;
st_entity.ST_ConsingeePhone = txtPhone.Text;
st_entity.ST_ConsingeePostcode = txtPostCode.Text;
st_entity.ST_CreateTime = DateTime.Now;
st_entity.ST_Payment = Select1.Value;
st_entity.ST_Ship = Select2.Value;
st_entity.ST_UserID = userid;
st_entity.ST_Sum = sum;
//生成订单
ST_BookBiz.ST_Order st_order = new STGROUP.ST_BookBiz.ST_Order();
st_order.InsertOrder(st_entity);
//清空购物车
Session.Remove("Cart");
Response.Write("<script language='javascript'>alert('订单生成成功');window.top.location='../ST_Common/st_main.aspx';</script>");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -