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

📄 webform1.aspx.cs

📁 某大型国企试用的网上订餐管理系统完整源代码
💻 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;

using System.Security;
using System.Security.Cryptography;
using System.Text;




namespace WebApplication1
{
	/// <summary>
	/// WebForm1 的摘要说明。
	/// </summary>
	public class WebForm1 : System.Web.UI.Page
	{
		protected System.Data.Odbc.OdbcCommand odbcCommand1;
		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.DataView dataView1;
		protected System.Data.DataSet dataSet1;
		protected System.Timers.Timer timer1;
		protected System.Data.Odbc.OdbcConnection odbcConnection1;
		protected System.Web.Services.WebService webService1;
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.Label Label2;
		protected System.Web.UI.WebControls.TextBox TextBox2;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.TextBox TextBox1;
		protected System.Web.UI.WebControls.DataGrid DataGrid1;
		protected System.Web.UI.WebControls.Button Button2;
		protected System.Web.UI.WebControls.TextBox txtPlain;
		protected System.Web.UI.WebControls.TextBox txtCrypt;
		protected DateTime dtCur;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			dtCur = new DateTime();
			timer1 = new System.Timers.Timer(1000);
			timer1.AutoReset = true;
			timer1.Start();

			TextBox2.Text = dtCur.ToString();

		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.odbcConnection1 = new System.Data.Odbc.OdbcConnection();
			this.odbcCommand1 = new System.Data.Odbc.OdbcCommand();
			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.dataView1 = new System.Data.DataView();
			this.dataSet1 = new System.Data.DataSet();
			this.timer1 = new System.Timers.Timer();
			this.webService1 = new System.Web.Services.WebService();
			((System.ComponentModel.ISupportInitialize)(this.dataView1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.timer1)).BeginInit();
			this.Button1.Click += new System.EventHandler(this.Button1_Click);
			this.Button2.Click += new System.EventHandler(this.Button2_Click);
			// 
			// odbcConnection1
			// 
			this.odbcConnection1.ConnectionString = "DSN=mysql_web";
			this.odbcConnection1.InfoMessage += new System.Data.Odbc.OdbcInfoMessageEventHandler(this.odbcConnection1_InfoMessage);
			// 
			// odbcCommand1
			// 
			this.odbcCommand1.CommandText = "SELECT help_topic_id, name FROM help_topic";
			this.odbcCommand1.Connection = this.odbcConnection1;
			// 
			// 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");
			// 
			// timer1
			// 
			this.timer1.Enabled = true;
			this.timer1.Interval = 1000;
			this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elapsed);
			this.Load += new System.EventHandler(this.Page_Load);
			((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.timer1)).EndInit();

		}
		#endregion

		private void odbcConnection1_InfoMessage(object sender, System.Data.Odbc.OdbcInfoMessageEventArgs e)
		{
		
		}

		private void Button1_Click(object sender, System.EventArgs e)
		{
			odbcConnection1.ConnectionString = "DSN=mysql_web";
			odbcConnection1.Open();
			TextBox1.Text = "ServerVersion:"+odbcConnection1.ServerVersion+ "\tDataSource: " + odbcConnection1.DataSource;

			//return;

			odbcSelectCommand1 = new System.Data.Odbc.OdbcCommand("SELECT help_topic_id, name FROM help_topic", odbcConnection1);
			odbcInsertCommand1 = new System.Data.Odbc.OdbcCommand();
			odbcUpdateCommand1 = new System.Data.Odbc.OdbcCommand();
			odbcDeleteCommand1 = new System.Data.Odbc.OdbcCommand();
			odbcSelectCommand1.Connection = odbcConnection1;
			odbcInsertCommand1.Connection = odbcConnection1;
			odbcUpdateCommand1.Connection = odbcConnection1;
			odbcDeleteCommand1.Connection = odbcConnection1;

			odbcDataAdapter1 = new System.Data.Odbc.OdbcDataAdapter();
			odbcDataAdapter1.SelectCommand = odbcSelectCommand1;
			odbcDataAdapter1.InsertCommand = odbcInsertCommand1;
			odbcDataAdapter1.UpdateCommand = odbcUpdateCommand1;
			odbcDataAdapter1.DeleteCommand = odbcDeleteCommand1;

			dataSet1 = new DataSet();
			odbcDataAdapter1.Fill(dataSet1, "my_test");
			dataView1 = new DataView(dataSet1.Tables["my_test"]);

			//DataGrid1 = new DataGrid();
			DataGrid1.DataSource = dataView1;
			DataGrid1.DataBind();

			odbcConnection1.Close();
		
		}

		private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
		{
			dtCur = DateTime.Now;

		}

		private void Button2_Click(object sender, System.EventArgs e)
		{
			MD5CryptoServiceProvider md = new System.Security.Cryptography.MD5CryptoServiceProvider();
			byte[] bytePlain = (new UTF8Encoding()).GetBytes(txtPlain.Text);

			//md.Initialize();
			//md..Clear();
			byte[] byteCrypt = md.ComputeHash(bytePlain);
			txtCrypt.Text = BitConverter.ToString(byteCrypt).Replace("-", "").ToLower();
		}
	}
}

⌨️ 快捷键说明

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