product/buy.aspx.cs

(开头部分) 3KB

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

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

public partial class buy : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session.Count == 0)
            {
                Response.Write("<script>alert('您尚未登录,请先登录');location='../Default.aspx'</script>");
            }
            else
            {
                string sql = "select * from View_buy where UserName='" + Session["UserName"].ToString() + "' order by BuyId Desc";
                Repeater1.DataSource = MyClass.OfflineSelect(sql);
                Repeater1.DataBind();

                double dblAllTotal = 0;
                for (int i = 0; i < this.Repeater1.Items.Count; i++)
                {
                    dblAllTotal += Convert.ToDouble(((Label)this.Repeater1.Items[i].FindControl("lblTotal")).Text.ToString());
                }
                lblAllTotal.Text = "总计:" + dblAllTotal.ToString() + "元";
            }
        }
    }
    protected void btnEdit_Click(object sender, CommandEventArgs e)
    {
        int iNum, BuyId;
        double iPrice;
        string sql = "";
        int id = Convert.ToInt32(e.CommandName);
        for (int i = 0; i < this.Repeater1.Items.Count; i++) 
        {
            BuyId = Convert.ToInt32(((Label)this.Repeater1.Items[i].FindControl("lblId")).Text);

            if (id == BuyId)
            {
                iNum = Convert.ToInt32(((TextBox)Repeater1.Items[i].FindControl("txtNum")).Text);
                iPrice = Convert.ToDouble(((Label)this.Repeater1.Items[i].FindControl("lblPrice")).Text);
                sql = "update Buys set Num=" + iNum + ",TotalPrice=" + iNum * iPrice + "where BuyId=" + id;
                MyClass.ExecuteSql(sql);
                break;
            }
        }
        Response.Redirect("~/buy.aspx");
    }
    protected void btnDel_Click(object sender, CommandEventArgs e)
后面还有 27 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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