ST_Admin_orderlistd.aspx.cs
上传用户:wyx_1982
上传日期:2020-04-18
资源大小:699k
文件大小:4k
源码类别:
SCSI/ASPI
开发平台:
Others
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- namespace ST_GROUP.EnterpriseOnlineInfoManage
- {
- /// <summary>
- /// ST_Admin_orderlistd 的摘要说明。
- /// </summary>
- public partial class ST_Admin_orderlistd : System.Web.UI.Page
- {
- ST_DataBase ST_database = new ST_DataBase();
- protected void Page_Load(object sender, System.EventArgs e)
- {
- // 在此处放置用户代码以初始化页面
- if (Session["admin"] == null)
- {
- //Response.Write("<script>alert("您还没有登录,不能进行接下来的操作,请登录后断续!");</script>");
- Response.Redirect("ST_contraller.aspx?cname=noadmin");
- }
- if(!Page.IsPostBack)
- {
- string ST_strsql;
- ST_strsql = "SELECT * FROM ST_tOrder where ST_isdeal = '是' order by ST_ID desc";
- DataTable ST_dt = ST_database.ReadTable(ST_strsql);
- DataGrid1.DataSource = ST_dt;
- DataGrid1.DataBind();
- }
- }
- #region Web 窗体设计器生成的代码
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.DataGrid1.CancelCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_CancelCommand);
- this.DataGrid1.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_EditCommand);
- this.DataGrid1.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_UpdateCommand);
- this.DataGrid1.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_DeleteCommand);
- }
- #endregion
- private void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
- {
- string ST_myid;
- string ST_strsql="";
- ST_myid =e.Item.Cells[0].Text;
- ST_strsql="delete from ST_Order where ST_ID="+ST_myid;
- ST_database.execsql(ST_strsql);
- ST_strsql="SELECT * FROM ST_tOrder where ST_isdeal = '是' order by ST_ID desc";
- DataTable ST_dt = ST_database.ReadTable(ST_strsql);
- DataGrid1.DataSource = ST_dt;
- DataGrid1.DataBind();
- }
- private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
- {
- DataGrid1.EditItemIndex = e.Item.ItemIndex;
- string ST_strsql;
- ST_strsql= "SELECT * FROM ST_tOrder where ST_isdeal = '是' order by ST_ID desc";
- DataTable ST_dt = ST_database.ReadTable(ST_strsql);
- DataGrid1.DataSource = ST_dt;
- DataGrid1.DataBind();
- }
- private void DataGrid1_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
- {
- DataGrid1.EditItemIndex = -1;
- string ST_strsql;
- ST_strsql= "SELECT * FROM ST_tOrder where ST_isdeal = '是' order by ST_ID desc";
- DataTable ST_dt = ST_database.ReadTable(ST_strsql);
- DataGrid1.DataSource = ST_dt;
- DataGrid1.DataBind();
- }
- private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
- {
- string ST_isdeal,ST_id;
- string ST_strsql;
- TextBox tb;
- ST_id = e.Item.Cells[0].Text;
- tb = (TextBox)(e.Item.Cells[5].Controls[0]);
- ST_isdeal = tb.Text;
- //TextBox3.Text=tb.Text;
- ST_strsql="update ST_tOrder set ST_isdeal='"+ST_isdeal+"' where ST_ID="+ST_id;
- ST_database.execsql(ST_strsql);
- ST_strsql="SELECT * FROM ST_tOrder where ST_isdeal = '是' order by ST_ID desc";
- DataGrid1.EditItemIndex = -1;
- DataTable ST_dt = ST_database.ReadTable(ST_strsql);
- DataGrid1.DataSource = ST_dt;
- DataGrid1.DataBind();
- }
- }
- }