bookBuy.aspx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class bookBuy : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "" || TextBox4.Text == "" || TextBox5.Text == "")
        {
            Response.Write("<script language='javalanguage>alert('请全部填写!');</script>");
           
        }
        else
        {
            orderinfo order = new orderinfo();
            order = (orderinfo)Session["order"];
            string userName = Session["userlogin"].ToString();
            string sql_id = "select userID from tbluser where userName='" + userName + "'";
            int uid = int.Parse(Class1.SelOne(sql_id));
            DateTime orderTime = order.orderTime;
            decimal orderSumPrice = order.sumPrice;
            string orderInsert = String.Format("insert into tblorder(userID,orderTime,orderSum,payment,ship,buyerName,buyerEmail,buyerAddress,buyerCode,buyerTel )values(" + uid + ",'" + orderTime + "','" + orderSumPrice + "','" + DropDownList1.Text + "','" + DropDownList2.Text + "','" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "')");
            Class1.ExecSql(orderInsert);   //生成订单,写入tblorder表
            int orderID = int.Parse(Class1.SelOne("select max(orderID) from tblorder"));  //获取orderID
            //将orderItemInfo写入到tblorderBook 中
            orderItemInfo orderItem = new orderItemInfo();
            for (int i = 0; i < order.orderItemList.Count; i++)
            {
                orderItem = (orderItemInfo)order.orderItemList[i];
                int bookid = orderItem.bookID;
                int bookSum = orderItem.bookNum;
                decimal paySum = orderItem.price;
                decimal price = paySum / bookSum;
                string orderIsert = String.Format("insert into tblorderBook values(" + orderID + "," + bookid + "," + bookSum + "," + price + "," + paySum + ")");
                Class1.ExecSql(orderIsert);
            }
            Label1.Text = order.sumPrice.ToString();
            int shipPrice = 0;
            if (DropDownList2.Text == "平邮")
            {
                shipPrice = 6;
            }
            else
            {
                shipPrice = 20;
            }
            Label2.Text = shipPrice.ToString();
            Label3.Text = Convert.ToString(order.sumPrice + shipPrice);
后面还有 11 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。