Пример #1
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        if (Page.IsValid && this.labMessage.Text == "订单详细情况如下:")
        {
            //得到用户输入的信息
            string strPhone;                                             //电话号码
            float  fltShipFee;                                           //邮递方式及其费用
            if (IsValidPhone(this.txtReceiverPhone.Text.Trim()) == true) //判断输入的电话号码是否合法
            {
                strPhone = this.txtReceiverPhone.Text.Trim();
            }
            else
            {
                Response.Write(ccObj.MessageBox("输入有误!"));
                return;
            }

            fltShipFee = float.Parse(this.Shipfee.Text);             //获取邮递方式及其费用
            string strName    = this.txtReciverName.Text.Trim();     //收货人姓名
            string strAddress = this.txtReceiverAddress.Text.Trim(); //收货人详细地址
            string strRemark  = this.txtRemark.InnerText.Trim();     //备注
            //将订单信息插入订单表中
            int intOrderID = ocObj.AddOrder(float.Parse(this.labTotalPrice.Text), fltShipFee, this.ShipType.Text, int.Parse(Session["UserID"].ToString()), strName, strPhone, strAddress, strRemark);
            int IntBookID; //商品ID
            int IntNum;    //购买商品数量


            float fltTotalPrice;
            //对订单中的每一个货物插入订单详细表中
            foreach (GridViewRow gvr in this.gvShopCart.Rows)
            {
                IntBookID     = int.Parse(gvr.Cells[1].Text);
                IntNum        = int.Parse(gvr.Cells[3].Text);
                fltTotalPrice = float.Parse(gvr.Cells[5].Text);
                ocObj.AddDetail(IntBookID, IntNum, intOrderID, fltTotalPrice);
            }

            //设置Session
            Session["ShopCart"] = null;  //清空购物车
            //Response.Redirect("PayWay.aspx?OrderID=" + IntOrderID);
            //Response.Redirect("GoBank.aspx?OrderID=" + IntOrderID );

            //配置支付需要的东西
            //订单号IntOrderID,价格totalPrice,官方教材,时间?当前时间date
            string temp = this.labTotalPrice.Text;


            Response.Write("<Script Language=JavaScript>alert('支付成功');location='Default.aspx'</Script>");
        }
    }