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

📄 batches.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 batches : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["name"] == null)
        {
            Response.Redirect("blank.htm");
        }
        else
        {
           
          }
        if (!IsPostBack)
        {
            loaddata load = new loaddata();
            DataSet ds  = load.getload(Session["name"].ToString());
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
    }
    protected void imgalone_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("cook.aspx");
    }
    protected void imgload_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("load.aspx");
    }
    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
     
        this.txtdate.Text = this.Calendar1.SelectedDate.ToString();
       
    }
    protected void btnupdate_Click(object sender, EventArgs e)
    {
        if (this.txtdate.Text != "")
        {
            loaddata update = new loaddata();
            update.updatetime(Session["name"].ToString(), txtdate.Text);

            clear updateload = new clear();
            updateload.updateload(Session["name"].ToString());

            loaddata load = new loaddata();
            DataSet ds = load.getload(Session["name"].ToString());
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
        else
        {
            Response.Write("<script>alert('时间为空')</script>");
        }
    }
    protected void btnenter_Click(object sender, EventArgs e)
    {
        try
        {
            SqlConnection conn = new SqlConnection();
            conn.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"];
            conn.Open();
            foreach (GridViewRow row in GridView1.Rows)
            {
                Label lbid = (Label)row.FindControl("Label1");
                TextBox tb = (TextBox)row.FindControl("txtcount");

                SqlCommand cmd = new SqlCommand("updatecount", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter paraid = new SqlParameter("@load_id", SqlDbType.NVarChar, 50);
                paraid.Value = lbid.Text;
                cmd.Parameters.Add(paraid);

                SqlParameter paracount = new SqlParameter("@load_count", SqlDbType.Int);
                paracount.Value = Convert.ToInt16(tb.Text);
                cmd.Parameters.Add(paracount);

                SqlParameter parasession = new SqlParameter("@load_session", SqlDbType.NVarChar, 50);
                parasession.Value = Session["name"].ToString();
                cmd.Parameters.Add(parasession);

                cmd.ExecuteNonQuery();
            }
            conn.Close();
            conn.Dispose();
         
           
        }
        catch (Exception ex)
        { 
        
        }
        loaddata copy = new loaddata();
        copy.copy();
        Response.Redirect("cook.aspx");

    }

    protected void TextBox2_TextChanged(object sender, EventArgs e)
    {

    }
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {

    }
}

⌨️ 快捷键说明

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