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

📄 wf_current_menu.aspx.cs

📁 某大型国企试用的网上订餐管理系统完整源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
			connectionDB();
		//	selectstr="select  concat(name,'(',Price,')') as AsName,concat(Price,',''',food_id,''',''',Style,''',''',name,''',''',Description,''',''',Image) as AsAll   FROM T_current_menu  where Date='"+TBoxToday.Text+"' and  style="+char1+" and Kind='"+strDinner1+"' order by food_id desc"; 
			selectstr="select   name as AsName,food_id as AsAll   FROM T_current_menu  where Date='"+TBoxToday.Text+"' and  style="+char1+" and Kind='"+strDinner1+"' order by food_id desc"; 

			odbcDataAdapter1 =new System.Data.Odbc.OdbcDataAdapter (selectstr ,odbcConnection1 ) ;
			dataSet1 =new DataSet() ;
			odbcDataAdapter1.Fill ( dataSet1 , "T_Current_menu" ) ;
			DataView dataView1 = dataSet1.Tables [ "T_Current_menu" ].DefaultView ;
			ckl2.DataSource = dataView1 ;
			ckl2.DataBind() ;
			closeDB();
		}
		private void SelectTotalMenu()
		{
			CkBoxListTodayFoods1.Items.Clear();
			CkBoxListTodayFoods2.Items.Clear();
			SelectCurrent_menuData('1', CkBoxListTodayFoods1);//主食
			SelectCurrent_menuData('0', CkBoxListTodayFoods2);//菜食
			for (int i=0; i<CkBoxListTodayFoods2.Items.Count; i++) 
			{
				CkBoxListTodayFoods2.Items[i].Selected=true;
			}
			for (int i=0; i<CkBoxListTodayFoods1.Items.Count; i++) 
			{
				CkBoxListTodayFoods1.Items[i].Selected=true;
			}
		}
		private void BQueryTotalMenu_Click(object sender, System.EventArgs e)
		{	
			

		}

		private void BTodayCanel_Click(object sender, System.EventArgs e)
		{
			CkBoxListTodayFoods1.Items.Clear();
			CkBoxListTodayFoods2.Items.Clear();
		}

		private void BAllFoodCaneld_Click(object sender, System.EventArgs e)
		{
			for (int i=0; i<CkBoxListAllFoods2.Items.Count; i++) 
			{
				CkBoxListAllFoods2.Items[i].Selected=false;
			}
		}

		private void BAllFoodSelected_Click(object sender, System.EventArgs e)
		{
			for (int i=0; i<CkBoxListAllFoods2.Items.Count; i++) 
			{
				CkBoxListAllFoods2.Items[i].Selected=true;
			}
		}

		private void BTodaySelected_Click(object sender, System.EventArgs e)
		{
			BQueryTotalMenu_Click(sender,e);
			int mm=1;


			for(int i=0; i<CkBoxListAllFoods2.Items.Count; i++) 
			{
				if(CkBoxListAllFoods2.Items[i].Selected)
				{
					for(int j=0; j<CkBoxListTodayFoods2.Items.Count; j++) 
					{
						if(CkBoxListAllFoods2.Items[i].Value==CkBoxListTodayFoods2.Items[j].Value)
						{
							mm=0;
							break;
							//continue;
						}
																		
					}
					if(mm>0 )
					{
						ListItem Item = new ListItem();
						Item.Text = CkBoxListAllFoods2.Items[i].Text; 
						Item.Value =CkBoxListAllFoods2.Items[i].Value;
						Item.Selected=true;
						CkBoxListTodayFoods2.Items.Add(Item);
					}
					mm=1;
				}
			}

			for(int i=0; i<CkBoxListAllFoods1.Items.Count; i++) 
			{
				if(CkBoxListAllFoods1.Items[i].Selected)
				{

					for(int j=0; j<CkBoxListTodayFoods1.Items.Count; j++) 
					{
						if(CkBoxListAllFoods1.Items[i].Value==CkBoxListTodayFoods1.Items[j].Value)
						{
							mm=0;
							break;
							//continue;
						}
																		
					}
					if(mm>0 )
					{
						ListItem Item = new ListItem();
						Item.Text = CkBoxListAllFoods1.Items[i].Text; 
						Item.Value =CkBoxListAllFoods1.Items[i].Value;
						Item.Selected=true;
						CkBoxListTodayFoods1.Items.Add(Item);
					}
					mm=1;
				}
			}		
		}

		private void Button1_Click(object sender, System.EventArgs e)
		{
			for (int i=0; i<CkBoxListAllFoods1.Items.Count; i++) 
			{
				CkBoxListAllFoods1.Items[i].Selected=true;
			}
		}

		private void Button2_Click(object sender, System.EventArgs e)
		{
			for (int i=0; i<CkBoxListAllFoods1.Items.Count; i++) 
			{
				CkBoxListAllFoods1.Items[i].Selected=false;
			}
		}

		private void Button3_Click(object sender, System.EventArgs e)
		{        
			if (!Button3.Enabled)
			{
				Page.RegisterStartupScript("alert", @"<script language=""javascript"">window.alert(""错误:设置时间已过!"")</script>");
				return;
			}

			if (TBoxToday.Text.CompareTo (DateStr)>=0)
			{
			//	string str1="";
				string char1="";
				if (RBFoodtime1.Checked)
				{
					char1="A";
				}
				else if (RBFoodtime2.Checked)
				{
					char1="B";
				}
				else if (RBFoodtime3.Checked)
				{
					char1="C";
				}
				else if (RBFoodtime4.Checked)
				{
					char1="D";
				}		
				if ((char1=="")||(CkBoxListTodayFoods2.Items.Count==0 )&&(CkBoxListTodayFoods1.Items.Count==0))
				{
			   Page.RegisterStartupScript("alert", @"<script language=""javascript"">window.alert(""错误:请选择您想设置的餐别或添加食谱到当日食谱当中!"")</script>");

			//	lblDate.Text="请选择您想设置的餐别!!";
				return;
				}


				DeleStr = "delete from t_current_menu " +
					"where Date = '"+TBoxToday.Text+"'and Kind='"+char1+"'";
				DeleData();
			
			for (int i=0; i< CkBoxListTodayFoods1.Items.Count; i++) 
				{
					if (CkBoxListTodayFoods1.Items[i].Selected)
			
					{
					//	str1="'"+TBoxToday.Text+"','"+char1+"',"+CkBoxListTodayFoods1.Items[i].Value+"'";
					//	Insertstr="INSERT INTO t_current_menu(`Date`,`Kind`,`Price` ,`food_id` ,`Style`,`name`,`Description` ,`Image`) VALUES ( "+str1+")";
						Insertstr = "INSERT INTO t_current_menu(`Date`,`Kind`,`Price` ,`food_id` ,`Style`,`name`,`Description` ,`Image`)"+ 
							"SELECT '"+TBoxToday.Text+"','"+char1+"',t_total_menu.Price,t_total_menu.food_id,t_total_menu.Style,"+
							"t_total_menu.name,t_total_menu.Description,t_total_menu.Image"+
							" FROM t_total_menu  WHERE t_total_menu.food_id = "+CkBoxListTodayFoods1.Items[i].Value;	
  						insertdata();
					}
				}	
				for (int i=0; i<CkBoxListTodayFoods2.Items.Count; i++) 
				{
					if (CkBoxListTodayFoods2.Items[i].Selected)
			
					{
					//	str1="'"+TBoxToday.Text+"','"+char1+"',"+  CkBoxListTodayFoods2.Items[i].Value+"'";
					//	Insertstr="INSERT INTO t_current_menu(`Date`,`Kind`,`Price` ,`food_id` ,`Style`,`name`,`Description` ,`Image`) VALUES ( "+str1+")";
						Insertstr = "INSERT INTO t_current_menu(`Date`,`Kind`,`Price` ,`food_id` ,`Style`,`name`,`Description` ,`Image`)"+ 
							"SELECT '"+TBoxToday.Text+"','"+char1+"',t_total_menu.Price,t_total_menu.food_id,t_total_menu.Style,"+
							"t_total_menu.name,t_total_menu.Description,t_total_menu.Image"+
							" FROM t_total_menu  WHERE t_total_menu.food_id = "+CkBoxListTodayFoods2.Items[i].Value;
						 insertdata();
					}
				}
			    Global.WriteLog(ref odbcConnection1, strUser,Global.MENU_CURRENTMENU,Global.ACTION_ADD,Insertstr);				 
			}
			else
			{
				lblDate.Text="选择日期不对!请修改";
			}
		}

		private void insertdata()
		{
			int i;
			connectionDB();
			odbcInsertCommand1 = new System.Data.Odbc.OdbcCommand(Insertstr,odbcConnection1);
			i = odbcInsertCommand1.ExecuteNonQuery ();
			closeDB();	
		}

		private void DeleData()
	    {
			int i;
			connectionDB();
			System.Data.Odbc.OdbcCommand cmdUpdate = new System.Data.Odbc.OdbcCommand (DeleStr, odbcConnection1);
			i = cmdUpdate.ExecuteNonQuery ();
     	   closeDB();

	    }


		private void RBFoodtime1_CheckedChanged(object sender, System.EventArgs e)
		{
			INDBChecked("A");
		}

		private void RBFoodtime2_CheckedChanged(object sender, System.EventArgs e)
		{
			INDBChecked("B");
		}

		private void RBFoodtime3_CheckedChanged(object sender, System.EventArgs e)
		{
			INDBChecked("C");
		}

		private void INDBChecked(string str1)
		{
			if (TBoxToday.Text.CompareTo (DateStr)>0)
			  {
				Button3.Enabled=true;
			  }
			
			if (TBoxToday.Text.CompareTo (DateStr)==0)
			{
				if ((str1.CompareTo(strDinner)>= 0)&&(str1.CompareTo(strDinner2)>= 0))
				{						  
					Button3.Enabled=true;
				}
				else
				{
					Button3.Enabled=false;
				}
			}
			if (TBoxToday.Text.CompareTo (DateStr)<0)
			{
				Button3.Enabled=false;
			}
			SelectTotalMenu();

		//	Label9.Text = "str1="+str1+"strDinner="+strDinner+"strDinner2="+strDinner2;

		}
		private void RBFoodtime4_CheckedChanged(object sender, System.EventArgs e)
		{
			INDBChecked("D");
		}

		private void CkBoxListTodayFoods2_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}

		private void CkBoxListAllFoods1_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}

		private void btnSort_Click(object sender, System.EventArgs e)
		{
			ListItem itmTmp = new ListItem();

			for (int i=0; i< CkBoxListTodayFoods1.Items.Count; i++) 
			{
				if (CkBoxListTodayFoods1.Items[i].Selected)
				{
					continue;
				}
				else
				{
					for (int j=i+1; j<CkBoxListTodayFoods1.Items.Count; j++)
					{
						if (!CkBoxListTodayFoods1.Items[j].Selected)
						{
							continue;
						}
						else
						{
							itmTmp.Selected = CkBoxListTodayFoods1.Items[i].Selected;
							itmTmp.Text = CkBoxListTodayFoods1.Items[i].Text;
							itmTmp.Value = CkBoxListTodayFoods1.Items[i].Value;
							CkBoxListTodayFoods1.Items[i].Selected = CkBoxListTodayFoods1.Items[j].Selected;
							CkBoxListTodayFoods1.Items[i].Text = CkBoxListTodayFoods1.Items[j].Text;
							CkBoxListTodayFoods1.Items[i].Value = CkBoxListTodayFoods1.Items[j].Value;
							CkBoxListTodayFoods1.Items[j].Selected = itmTmp.Selected;
							CkBoxListTodayFoods1.Items[j].Text = itmTmp.Text;
							CkBoxListTodayFoods1.Items[j].Value = itmTmp.Value;
							break;
						}
					}
				}
			}	

			for (int i=0; i< CkBoxListTodayFoods2.Items.Count; i++) 
			{
				if (CkBoxListTodayFoods2.Items[i].Selected)
				{
					continue;
				}
				else
				{
					for (int j=i+1; j<CkBoxListTodayFoods2.Items.Count; j++)
					{
						if (!CkBoxListTodayFoods2.Items[j].Selected)
						{
							continue;
						}
						else
						{
							itmTmp.Selected = CkBoxListTodayFoods2.Items[i].Selected;
							itmTmp.Text = CkBoxListTodayFoods2.Items[i].Text;
							itmTmp.Value = CkBoxListTodayFoods2.Items[i].Value;
							CkBoxListTodayFoods2.Items[i].Selected = CkBoxListTodayFoods2.Items[j].Selected;
							CkBoxListTodayFoods2.Items[i].Text = CkBoxListTodayFoods2.Items[j].Text;
							CkBoxListTodayFoods2.Items[i].Value = CkBoxListTodayFoods2.Items[j].Value;
							CkBoxListTodayFoods2.Items[j].Selected = itmTmp.Selected;
							CkBoxListTodayFoods2.Items[j].Text = itmTmp.Text;
							CkBoxListTodayFoods2.Items[j].Value = itmTmp.Value;
							break;
						}
					}
				}
			}	
		}

		private void Button4_Click(object sender, System.EventArgs e)
		{

		}
	}
}

⌨️ 快捷键说明

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