📄 wf_batch_order_pre.aspx.cs
字号:
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 WebApplication1
{
/// <summary>
/// WFapp 的摘要说明。
/// </summary>
public class WF_Batch_order_Pre : System.Web.UI.Page
{
protected System.Data.DataView dataView1;
protected System.Data.Odbc.OdbcConnection odbcConnection1;
protected System.Data.Odbc.OdbcCommand odbcSelectCommand1;
internal System.Data.Odbc.OdbcCommand odbcInsertCommand1;
protected System.Data.Odbc.OdbcCommand odbcUpdateCommand1;
protected System.Data.Odbc.OdbcCommand odbcDeleteCommand1;
protected System.Data.Odbc.OdbcDataAdapter odbcDataAdapter1;
protected System.Data.DataSet dataSet1;
protected System.Data.Odbc.OdbcCommand odbcCommand1;
protected System.Web.UI.WebControls.Button btnAdd;
protected System.Web.UI.WebControls.Button btnModify;
protected System.Web.UI.WebControls.Button btnDelete;
protected System.Web.UI.WebControls.Button btnCancel;
protected System.Web.UI.WebControls.Label lblMessage;
protected System.Web.UI.WebControls.TextBox txtPageSize;
protected System.Web.UI.WebControls.Label lblCurrentPage;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.TextBox txtNum;
protected System.Web.UI.WebControls.DropDownList ddlDest;
protected System.Web.UI.WebControls.DropDownList ddlEffect;
protected System.Web.UI.WebControls.TextBox txtReason;
protected System.Web.UI.WebControls.Label lblDate;
private string selectstr;
private string Insertstr;
private string strCurDate;
// private string strCurTime;
private string strDinner;
private string strUser, strUserName;
private string strDept, strDeptName;
protected System.Web.UI.WebControls.RangeValidator valNum;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Label Label5;
protected System.Data.DataSet dsDest;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
strUser = (string)Session["strUser"];
strUserName = (string)Session["strUserName"];
strDept = (string)Session["strDept"];
strDeptName = (string)Session["strDeptName"];
dataSet1 = new DataSet() ;
FindDinner();
if (!IsPostBack)
{
if (!Global.CheckUserValidation((string)Session["strRole"], Global.MENU_BATCHPRE))
{
Response.Redirect("err_session.htm", true);
}
connectionDB();
odbcDataAdapter1.SelectCommand.CommandText ="select dest_id, `desc` from t_dest";
odbcDataAdapter1.SelectCommand.Connection = odbcConnection1;
odbcDataAdapter1.Fill (dsDest, "dest");
ddlDest.DataSource = dsDest.Tables ["dest"].DefaultView ;
ddlDest.DataTextField = "desc";
ddlDest.DataValueField = "desc";
ddlDest.DataBind ();
ddlDest.SelectedIndex = 0;
DataGrid1.CurrentPageIndex=0;
DataGrid1.PageSize = Convert.ToInt32 (txtPageSize.Text );
select();
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.dataView1 = new System.Data.DataView();
this.odbcConnection1 = new System.Data.Odbc.OdbcConnection();
this.odbcSelectCommand1 = new System.Data.Odbc.OdbcCommand();
this.odbcInsertCommand1 = new System.Data.Odbc.OdbcCommand();
this.odbcUpdateCommand1 = new System.Data.Odbc.OdbcCommand();
this.odbcDeleteCommand1 = new System.Data.Odbc.OdbcCommand();
this.odbcDataAdapter1 = new System.Data.Odbc.OdbcDataAdapter();
this.odbcCommand1 = new System.Data.Odbc.OdbcCommand();
this.dsDest = new System.Data.DataSet();
((System.ComponentModel.ISupportInitialize)(this.dataView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dsDest)).BeginInit();
this.DataGrid1.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.DataGrid1_PageIndexChanged_1);
this.DataGrid1.SelectedIndexChanged += new System.EventHandler(this.DataGrid1_SelectedIndexChanged);
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
this.btnModify.Click += new System.EventHandler(this.btnModify_Click);
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// odbcDataAdapter1
//
this.odbcDataAdapter1.DeleteCommand = this.odbcDeleteCommand1;
this.odbcDataAdapter1.InsertCommand = this.odbcInsertCommand1;
this.odbcDataAdapter1.SelectCommand = this.odbcSelectCommand1;
this.odbcDataAdapter1.UpdateCommand = this.odbcUpdateCommand1;
//
// dsDest
//
this.dsDest.DataSetName = "NewDataSet";
this.dsDest.Locale = new System.Globalization.CultureInfo("zh-CN");
this.Load += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dsDest)).EndInit();
}
#endregion
private void FindDinner()
{
if (Global.FindBookTime(out strDinner, out strCurDate))
{
btnAdd.Enabled = true;
btnModify.Enabled = true;
btnDelete.Enabled = true;
btnCancel.Enabled = true;
switch (strDinner)
{
case "A":
lblDate.Text = "您订的是:" + strCurDate + " 的早餐";
break;
case "B":
lblDate.Text = "您订的是:" + strCurDate + " 的中餐";
break;
case "C":
lblDate.Text = "您订的是:" + strCurDate + " 的晚餐";
break;
case "D":
lblDate.Text = "您订的是:" + strCurDate + " 的零点餐";
break;
}
}
else
{
btnAdd.Enabled = false;
btnModify.Enabled = false;
btnDelete.Enabled = false;
btnCancel.Enabled = false;
switch (strDinner)
{
case "A":
lblDate.Text = strCurDate + " 早餐订餐时间已过";
break;
case "B":
lblDate.Text = strCurDate + " 中餐订餐时间已过";
break;
case "C":
lblDate.Text = strCurDate + " 晚餐订餐时间已过";
break;
case "D":
lblDate.Text = strCurDate + " 零点餐订餐时间已过";
break;
}
}
}
private void connectionDB()
{
Global.OpenConnection(ref odbcConnection1);
}
private void closeDB()
{
odbcConnection1.Close();
}
private void select()
{
//connectionDB();
DataGrid1.CurrentPageIndex=0;
DataGrid1.PageSize = Convert.ToInt32 (txtPageSize.Text );
selectdata();
PageIndexNbr();
}
private void selectdata()
{
connectionDB();
selectstr= "select `BATCH_ORDER_id`, `Date`, `Kind`, `Department_ID`, `department`, `Num`, `send_dest`, " +
"`reason`, `Manager_id`, `Manager_name`, `Effect`, `Checker_id`, `Checker_name` " +
"from `t_batch_order` " +
"where `Department_ID` = '" + strDept + "' " +
"and `Date` = '" + strCurDate + "' " +
"and `Kind` = '" + strDinner + "' " +
"order by BATCH_ORDER_id desc";
//lblMessage.Text = selectstr; return;
odbcDataAdapter1.SelectCommand.Connection = odbcConnection1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -