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

📄 supply.aspx.cs

📁 ASP.NET编写的眼镜行分销系统的程序.
💻 CS
字号:
using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace NewGlassBook
{
	/// <summary>
	/// Summary description for employee.
	/// </summary>
	public class Supply : MyPage
	{
		protected System.Web.UI.WebControls.Label lblWarning;
		protected NewGlassBook.MyButton dbtnReset;
		protected NewGlassBook.MyButton dbtnOk;
		protected NewGlassBook.MyTextBox aDemo;
		protected NewGlassBook.MyTextBox aZip;
		protected NewGlassBook.MyTextBox aAddress;
		protected NewGlassBook.MyTextBox aMobile;
		protected NewGlassBook.MyTextBox aFax;
		protected NewGlassBook.MyTextBox aTel;
		protected NewGlassBook.MyTextBox aBusinessAdmin;
		protected NewGlassBook.MyTextBox aName;
		protected NewGlassBook.MyTextBox aID;
		protected NewGlassBook.MyTextBox apassword;
		Record r=new Record();
		private void Page_Load(object sender, System.EventArgs e)
		{	
			if(!Page.IsPostBack)
			{
				//增加确定按钮的onClick属性进行客户端验证
				dbtnOk.Attributes["onClick"]="return supplyValid()";
				aID.Text=gen();//产生供应商编号
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.dbtnOk.Click += new System.EventHandler(this.dbtnOk_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
		private void dbtnReset_Click(object sender, System.EventArgs e)
		{
			ClearTextBox();
		}
		string gen()//生成供应商的编号
		{
			DataSet ds=r.GetData("supply","select top 1 id from supply order by id desc");
			string strID=ds.Tables["supply"].Rows[0]["id"].ToString();
			string strRight=strID.Substring(1,4);
			string l="";
			int intTmp=Int32.Parse(strRight);//编号转化成整型
			intTmp++;//编号加一
			for(int i=0;i<4-intTmp.ToString().Length;i++)//根据编号的长度,补0
			{
				l=l+"0";
			}
			strID="s"+l+intTmp.ToString();
			return strID;
		}

		private void dbtnOk_Click(object sender, System.EventArgs e)
		{
			
			if(r.RequestInsert("supply",Request)!=1)//调用Record的RequestInsert方法写入数据库
			{
				lblWarning.Text=r.ErrMsg;
				return;
			}
			lblWarning.Text=aName.Text+"供应商的信息添加成功";
			ClearTextBox();
			aID.Text=gen();
		}
	}
}

⌨️ 快捷键说明

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