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

📄 addcompany.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;
//using NewGlassBook;
namespace NewGlassBook
{
	/// <summary>
	/// Summary description for employee.
	/// </summary>
	public class AddCompany : MyPage 
	{
		protected NewGlassBook.MyButton dbtnreset;
		protected System.Web.UI.WebControls.DropDownList astorecode;
		protected NewGlassBook.MyTextBox aZip;
		protected NewGlassBook.MyTextBox aAddress;
		protected NewGlassBook.MyTextBox aFax;
		protected NewGlassBook.MyTextBox aTel;
		protected NewGlassBook.MyTextBox aContact;
		protected NewGlassBook.MyTextBox aCompanyName;
		protected NewGlassBook.MyTextBox aID;
		protected System.Web.UI.WebControls.Label lblWarning;
		protected NewGlassBook.MyButton dbtnOk;
		Record r=new Record();	
		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!Page.IsPostBack)
			{
				astorecodebind();//绑定仓库
				dbtnOk.Attributes["onClick"]="return subcompanyValid();";
				aID.Text=gen();//设置公司ID号
			}
		}
		private void astorecodebind()//绑定仓库
		{
			DataSet ds=r.GetData("tblName","select * from store where storecode not like '_f%'");
			astorecode.DataSource=ds;
			astorecode.DataTextField="storename";
			astorecode.DataValueField="storecode";
			astorecode.DataBind();
			ListItem a=new ListItem();
			a.Text="请选择公司主仓库";
			a.Value="";
			astorecode.Items.Insert(0,a);
		}

		#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.dbtnreset.Click += new System.EventHandler(this.dbtnreset_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
		private void dbtnreset_Click(object sender, System.EventArgs e)
		{
			ClearTextBox();
			lblWarning.Text="";
		}

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

			if(r.RequestInsert("company",Request)==1)
			{
				lblWarning.Text=aCompanyName.Text+"公司信息添加成功!";	
				ClearTextBox();
				aID.Text=gen();
			}
			else
			{
				lblWarning.Text=r.ErrMsg;	
			}
		}

		string gen()//产生公司编号的函数
		{
			DataSet ds=r.GetData("fxs","select top 1 id from company where id not like 'f%' order by id desc");
			string strID=ds.Tables["fxs"].Rows[0]["id"].ToString();
			int intTmp=Int32.Parse(strID);
			intTmp++;
			string l="";
			for(int i=0;i<2-intTmp.ToString().Length;i++)
			{
				l=l+"0";
			}
			strID=l+intTmp.ToString();
			return strID;
		}		

	}
}

⌨️ 快捷键说明

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