ShoppingBook.aspx.cs

(开头部分) 4KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MyWeb.DBUtility;
using MyWeb.WebUtility;
using System.Data;

namespace MyWeb
{
    public partial class ShoppingBook : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DBHelper db = new DBHelper();
                TextBox3.Text = Session["name"].ToString();
                string sql = "select Sum(b.Price*foodsNum) as total,sum(foodsNum) as num from ShoppingCart_Tbl a inner join Goods_Tbl b on a.foodsID=b.id where a.del=0 and b.del=0 and isOver=0 and a.userID='" + Session["id"].ToString() + "'";
                DataSet ds = db.Query(sql);
                Label5.Text = ds.Tables[0].Rows[0]["num"].ToString();
                //Label8.Text = (Convert.ToDouble(ds.Tables[0].Rows[0]["price"]) * Convert.ToDouble(ds.Tables[0].Rows[0]["foodsNum"])).ToString() + "元";
                Label8.Text = ds.Tables[0].Rows[0]["total"].ToString();
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            DBHelper db = new DBHelper();
            WebHelper wb = new WebHelper();
            //if (TextBox1.Text == "")
            //{
            //    wb.Alert("选购时间不能为空");
            //}
            //else if (TextBox2.Text == "")
            //{
            //    wb.Alert("送达时间不能为空");
            //}
             if (TextBox3.Text == "")
            {
                wb.Alert("姓名不能为空");
            }
            else if (TextBox4.Text == "")
            {
                wb.Alert("手机号码不能为空");
            }
            //else if (TextBox5.Text == "")
            //{
            //    wb.Alert("身份证号不能为空");
            //}
            else if (TextBox7.Text == "")
            {
                wb.Alert("地址不能为空");
            }
            else
            {
                string sql = "insert into Order_Tbl output inserted.id values('','" + Session["id"] + "','" + Label5.Text + "','" + Label8.Text.Replace("元", "") + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "',0,getdate(),0)";
                DataSet ds5 = db.Query(sql);
                if (Convert.ToInt32(ds5.Tables[0].Rows[0][0]) > 0)
后面还有 28 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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