⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 count.aspx.cs

📁 一个较小的采购系统,一些比较实际的代码,可以用来参考
💻 CS
字号:
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;
using System.Data.SqlClient;

public partial class count : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            order countleibie = new order();
            this.countleibie.Text = countleibie.countleibie();
            order countpinmin = new order();
            this.countpinmin.Text = countpinmin.countpinmin();
            if (!IsPostBack)
            {
                cooktb ds = new cooktb();
                DataSet dsleibie = ds.leibie();
                this.dpdlleibie.DataSource = dsleibie.Tables[0].DefaultView;
               
                this.dpdlleibie.DataTextField = "leibie_name";
                this.dpdlleibie.DataBind();
                dsleibie.Dispose();
                dpdlleibie.Items.Insert(0, new ListItem("请选择", "请选择"));
                //

            }
            try
            {
                cooktb data = new cooktb();
                DataSet dsdata = data.loaddata(this.dpdlpinmin.SelectedItem.Text);
                this.dlstimage.DataSource = dsdata;
                this.dlstimage.DataBind();
                dsdata.Dispose();
            }
            catch (Exception ex)
            {
            }
            cooktb leibie = new cooktb();
            dpdlleibie.DataSource =  leibie.leibie();
            dpdlleibie.DataTextField = "leibie_name";
            dpdlleibie.DataBind();
        }
    }

    protected void dropleibie_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            this.dpdlpinmin.Items.Clear();
            cooktb pm = new cooktb();
            DataSet ds = pm.pinmin(this.dpdlleibie.Text);
            dpdlpinmin.DataSource = ds.Tables[0].DefaultView;
            dpdlpinmin.DataMember = "order_PM";
            dpdlpinmin.DataTextField = "order_PM";
            dpdlpinmin.DataBind();
            ds.Dispose();
        }
        catch (Exception ex)
        { }
        try
        {
            if (this.dpdlpinmin.SelectedItem.Text != "")
            {
                cooktb gg = new cooktb();
                string strGG = gg.GG(this.dpdlpinmin.SelectedItem.Text);
                this.txtGG.Text = strGG;
            }
            else
            {
                this.txtGG.Text = "";
            }
        }
        catch (Exception ex2)
        {
        }
        try
        {
            cooktb data = new cooktb();
            DataSet dsdata = data.loaddata(this.dpdlpinmin.SelectedItem.Text);
            this.dlstimage.DataSource = dsdata;
            this.dlstimage.DataBind();
            dsdata.Dispose();
        }
        catch (Exception ex)
        { }
    }
    protected void dpdlpinmin_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (this.dpdlpinmin.SelectedItem.Text != "")
        {
            cooktb gg = new cooktb();
            string strGG = gg.GG(this.dpdlpinmin.SelectedItem.Text);
            this.txtGG.Text = strGG;

            cooktb data = new cooktb();
            DataSet dsdata = data.loaddata(this.dpdlpinmin.SelectedItem.Text);
            this.dlstimage.DataSource = dsdata;
            this.dlstimage.DataBind();
            dsdata.Dispose();
        }
        else
        {
            this.txtGG.Text = "";
        }
    }
    protected void txtsuoxie_TextChanged(object sender, EventArgs e)
    {
        dpdlpinmin.Items.Clear();
        cooktb search = new cooktb();
        SqlDataReader dr = search.search(this.txtsuoxie.Text, this.dpdlleibie.SelectedItem.Text);
        while (dr.Read())
        {
            dpdlpinmin.Items.Add(dr.GetValue(0).ToString());
        }
        try
        {
            if (this.dpdlpinmin.SelectedItem.Text == "")
            {
                this.txtGG.Text = "";
            }
            else
            {
                cooktb gg = new cooktb();
                string strGG = gg.GG(this.dpdlpinmin.SelectedItem.Text);
                this.txtGG.Text = strGG;


                cooktb data = new cooktb();
                DataSet dsdata = data.loaddata(this.dpdlpinmin.SelectedItem.Text);
                this.dlstimage.DataSource = dsdata;
                this.dlstimage.DataBind();
                dsdata.Dispose();
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void btndelete_Click(object sender, EventArgs e)
    {
        try
        {
            order deletepinmin = new order();
            deletepinmin.deletePM(this.dpdlpinmin.SelectedItem.Text);

            this.dpdlpinmin.Items.Clear();
            cooktb pm = new cooktb();
            DataSet ds = pm.pinmin(this.dpdlleibie.Text);
            dpdlpinmin.DataSource = ds.Tables[0].DefaultView;
            dpdlpinmin.DataTextField = "order_PM";
            dpdlpinmin.DataBind();
            ds.Dispose();


            cooktb data = new cooktb();
            DataSet dsdata = data.loaddata(this.dpdlpinmin.SelectedItem.Text);
            this.dlstimage.DataSource = dsdata;
            this.dlstimage.DataBind();
            dsdata.Dispose();

            order countpinmin = new order();
            this.countpinmin.Text = countpinmin.countpinmin();

            Response.Write("<script>alert('删除成功')</script>");
        }
        catch (Exception ex)
        { 
        
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -