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

📄 wf_current_menu.aspx.cs

📁 某大型国企试用的网上订餐管理系统完整源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
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 //HNtest1_main1
{
	/// <summary>
	/// WFapp 的摘要说明。
	/// </summary>
	public class WF_Current_Menu : System.Web.UI.Page
	{
		protected System.Data.DataView dataView1;
		protected System.Data.Odbc.OdbcConnection odbcConnection1;
		protected System.Data.Odbc.OdbcCommand odbcSelectCommand1;
		protected 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.Web.UI.WebControls.CheckBox CBoxDateS;
		protected System.Web.UI.WebControls.Label Label6;
		protected System.Web.UI.WebControls.Label Label5;
		protected System.Web.UI.WebControls.Label Label4;
		protected System.Web.UI.WebControls.CheckBoxList CkBoxListAllFoods2;
		protected System.Web.UI.WebControls.CheckBoxList CkBoxListAllFoods1;
		protected System.Web.UI.WebControls.CheckBoxList CkBoxListTodayFoods1;
		protected System.Web.UI.WebControls.CheckBoxList CkBoxListTodayFoods2;
		protected System.Web.UI.WebControls.Button BTodayCanel;
		protected System.Web.UI.WebControls.Button BTodaySelected;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.Button Button2;
		protected System.Web.UI.WebControls.Button BAllFoodSelected;
		protected System.Web.UI.WebControls.Button BAllFoodCaneld;
		
		protected  string DateStr;
		protected System.Web.UI.WebControls.Button Button3;
		protected System.Web.UI.HtmlControls.HtmlForm Form1;
		protected System.Web.UI.WebControls.RadioButton RBFoodtime1;
		protected System.Web.UI.WebControls.RadioButton RBFoodtime2;
		protected System.Web.UI.WebControls.RadioButton RBFoodtime3;
		protected System.Web.UI.WebControls.RadioButton RBFoodtime4;
		protected  string TimeStr;
		protected  string Insertstr;

		private string strUser ;    
		private string strUserName;  
		private string strDept;     
		private string strDeptName;
		protected System.Data.Odbc.OdbcCommand odbcCommand1;
		protected  string DeleStr,strDinner1,strDinner,strDinner2;
		protected System.Web.UI.WebControls.TextBox TextBox1;
		protected System.Web.UI.WebControls.Label Label2;
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.TextBox TBoxToday;
		protected System.Web.UI.WebControls.Label lblDate;
		protected System.Web.UI.WebControls.Label Label7;
		protected System.Web.UI.WebControls.Button btnSort;
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.Label Label9;
		protected System.Web.UI.WebControls.Label Label8;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			DateStr=TimeStr="";
			DateStr = DateTime.Now.ToString("yyyy'-'MM'-'dd");
			TimeStr= DateTime.Now.ToString("HH':'mm");

			strUser = (string)Session["strUser"];        
			strUserName = (string)Session["strUserName"];
			strDept = (string)Session["strDept"];        
			strDeptName = (string)Session["strDeptName"];  


			FindDinner();
			string str1="";
			if (RBFoodtime1.Checked)
			{
				str1="A";
			}
			else if (RBFoodtime2.Checked)
			{
				str1="B";
			}
			else if (RBFoodtime3.Checked)
			{
				str1="C";
			}
			else
			{
				str1="D";
			}	

          strDinner1=str1;

			if (!Page.IsPostBack)		
			{
				TBoxToday.Text=DateStr;
				if (!Global.CheckUserValidation((string)Session["strRole"], Global.MENU_CURRENTMENU))
				{
					Response.Redirect("err_session.htm", true);
				}
				FindDinner();
				switch (strDinner)
				{
					case "A":
						if(strDinner2== "A")
						{
							RBFoodtime1.Checked=false;
						}
						else
						{
							RBFoodtime1.Checked=true;
						}
						break;
					case "B":
						if(strDinner2== "B")
						{
							RBFoodtime2.Checked=false;
						}
						else
						{
							RBFoodtime2.Checked=true;
						}
						break;
					case "C":
						if(strDinner2== "C")
						{
							RBFoodtime3.Checked=false;
						}
						else
						{
							RBFoodtime3.Checked=true;
						}
						break;
					default:
						if(strDinner2== "D")
						{
							RBFoodtime4.Checked=false;
						}
						else
						{
							RBFoodtime4.Checked=true;
						}
						break;												
				}	
				//Label1.Text = "strDinner2="+strDinner2+"strDinner="+strDinner;
				SelectTotal_MenuData('1', CkBoxListAllFoods1);//主食
				SelectTotal_MenuData('0', CkBoxListAllFoods2);//菜食 
				INDBChecked(strDinner);
			}
		}


		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		/// 
		private  string selectstr;


		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.dataSet1 = new System.Data.DataSet();
			this.odbcCommand1 = new System.Data.Odbc.OdbcCommand();
			((System.ComponentModel.ISupportInitialize)(this.dataView1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
			// 
			// odbcDataAdapter1
			// 
			this.odbcDataAdapter1.DeleteCommand = this.odbcDeleteCommand1;
			this.odbcDataAdapter1.InsertCommand = this.odbcInsertCommand1;
			this.odbcDataAdapter1.SelectCommand = this.odbcSelectCommand1;
			this.odbcDataAdapter1.UpdateCommand = this.odbcUpdateCommand1;
			// 
			// dataSet1
			// 
			this.dataSet1.DataSetName = "NewDataSet";
			this.dataSet1.Locale = new System.Globalization.CultureInfo("zh-CN");
			this.CkBoxListAllFoods1.SelectedIndexChanged += new System.EventHandler(this.CkBoxListAllFoods1_SelectedIndexChanged);
			this.CkBoxListTodayFoods2.SelectedIndexChanged += new System.EventHandler(this.CkBoxListTodayFoods2_SelectedIndexChanged);
			this.BAllFoodSelected.Click += new System.EventHandler(this.BAllFoodSelected_Click);
			this.BAllFoodCaneld.Click += new System.EventHandler(this.BAllFoodCaneld_Click);
			this.Button1.Click += new System.EventHandler(this.Button1_Click);
			this.Button2.Click += new System.EventHandler(this.Button2_Click);
			this.BTodaySelected.Click += new System.EventHandler(this.BTodaySelected_Click);
			this.BTodayCanel.Click += new System.EventHandler(this.BTodayCanel_Click);
			this.btnSort.Click += new System.EventHandler(this.btnSort_Click);
			this.Button3.Click += new System.EventHandler(this.Button3_Click);
			this.CBoxDateS.CheckedChanged += new System.EventHandler(this.CBoxDateS_CheckedChanged);
			this.RBFoodtime1.CheckedChanged += new System.EventHandler(this.RBFoodtime1_CheckedChanged);
			this.RBFoodtime3.CheckedChanged += new System.EventHandler(this.RBFoodtime3_CheckedChanged);
			this.RBFoodtime2.CheckedChanged += new System.EventHandler(this.RBFoodtime2_CheckedChanged);
			this.RBFoodtime4.CheckedChanged += new System.EventHandler(this.RBFoodtime4_CheckedChanged);
			this.Load += new System.EventHandler(this.Page_Load);
			((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();

		}
		#endregion
		private void connectionDB()
		{
			Global.OpenConnection(ref odbcConnection1);
		}	
		private void closeDB()
		{	
			if (odbcConnection1.State != ConnectionState.Closed)	
			{
				odbcConnection1.Close();
			}
		}

	private void FindDinner()
	{
			string ast, aend, bst, bend, cst, cend, dst, dend;
			string strCurDate,strCurTime;

/////////////////////////////////////////////////////////////////////
			connectionDB();
			strCurDate = DateTime.Now.ToString ("yyyy'-'MM'-'dd");
			strCurTime = DateTime.Now.ToString ("HH':'mm");

			odbcCommand1.Connection  = odbcConnection1;
			odbcCommand1.CommandText = "select `value` from t_sys_para where para_id = 'a_start1'";
			ast = odbcCommand1.ExecuteScalar ().ToString() ;

			odbcCommand1.CommandText = "select `value` from t_sys_para where para_id = 'a_end1'";
			aend = odbcCommand1.ExecuteScalar ().ToString() ;

			odbcCommand1.CommandText = "select `value` from t_sys_para where para_id = 'b_start1'";
			bst = odbcCommand1.ExecuteScalar ().ToString() ;

			odbcCommand1.CommandText = "select `value` from t_sys_para where para_id = 'b_end1'";
			bend = odbcCommand1.ExecuteScalar ().ToString() ;

			odbcCommand1.CommandText = "select `value` from t_sys_para where para_id = 'c_start1'";
			cst = odbcCommand1.ExecuteScalar ().ToString ();

			odbcCommand1.CommandText = "select `value` from t_sys_para where para_id = 'c_end1'";
			cend = odbcCommand1.ExecuteScalar ().ToString ();

			odbcCommand1.CommandText = "select `value` from t_sys_para where para_id = 'd_start1'";
			dst = odbcCommand1.ExecuteScalar ().ToString ();

			odbcCommand1.CommandText = "select `value` from t_sys_para where para_id = 'd_end1'";
			dend = odbcCommand1.ExecuteScalar ().ToString ();

			if ( strCurTime.CompareTo (ast) >= 0 && strCurTime.CompareTo (aend) <= 0)
			{
				lblDate.Text = "您可以设置的是:" + strCurDate + " 的早餐";
				strDinner = "A";
				return;
			}
			if ( strCurTime.CompareTo (bst) >= 0 && strCurTime.CompareTo (bend) <= 0)
			{
				lblDate.Text = "您可以设置的是:" + strCurDate + " 的中餐";
				strDinner = "B";
				return;
			}
			if ( strCurTime.CompareTo (cst) >= 0 && strCurTime.CompareTo (cend) <= 0)
			{
				lblDate.Text = "您可以设置的是:" + strCurDate + " 的晚餐";
				strDinner = "C";
				return;
			}
			if ( strCurTime.CompareTo (dst) >= 0 && strCurTime.CompareTo (dend) <= 0)
			{
				lblDate.Text = "您可以设置的是:" + strCurDate + " 的零点餐";
				strDinner = "D";
				return;
			}
		///////////////////////////////////////////////////////////////////////////////

			if (strCurTime.CompareTo (aend) > 0)
			{
				lblDate.Text = "设置早餐的时间已过。";
				strDinner = "A";
				strDinner2 = "B";
			}
	    	if (strCurTime.CompareTo (bend) > 0)
	    	{
			lblDate.Text = "设置中餐的时间已过。";
			strDinner = "B";
				strDinner2 = "C";
			}
		  if (strCurTime.CompareTo (cend) > 0)
		  {
			lblDate.Text = "设置晚餐的时间已过。";
			strDinner = "C";
		  	strDinner2 = "D";
		  }

		if (strCurTime.CompareTo (dend) > 0 || strCurTime.CompareTo (ast) < 0)
		{
			lblDate.Text = "设置零点餐的时间已过。";
			strDinner = "D";
			strDinner2 = "A";
		}

	}


		private void CBoxDateS_CheckedChanged(object sender, System.EventArgs e)
		{
			if (CBoxDateS.Checked)
			{	
				TBoxToday.Enabled=true;
			}
			else
			{	
				TBoxToday.Text=DateStr;
				TBoxToday.Enabled=false;

			}
		}


		private void SelectTotal_MenuData(char char1,CheckBoxList ckl1)
		{
			connectionDB(); 
			//selectstr="select concat(name,'(',Price,')') as as AsName,concat(Price,',''',food_id,''',''',Style,''',''',name,''',''',Description,''',''',Image) as AsAll  FROM t_total_menu  where  Effect='1' and  Style='"+char1+"' order by food_id desc";
			
			selectstr="select  name as AsName, food_id as AsAll  FROM t_total_menu  where  Effect='1' and  Style='"+char1+"' order by food_id desc";

			odbcDataAdapter1 =new System.Data.Odbc.OdbcDataAdapter (selectstr ,odbcConnection1 ) ;
			dataSet1 =new DataSet() ;
			odbcDataAdapter1.Fill ( dataSet1 , "T_total_menu" ) ;
			DataView dataView1 = dataSet1.Tables [ "T_total_menu" ].DefaultView ;
			ckl1.DataSource = dataView1 ;
			ckl1.DataBind() ;
			closeDB();
		}

		private void SelectCurrent_menuData(char char1,CheckBoxList ckl2)
		{

⌨️ 快捷键说明

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