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

📄 注册用户.cs

📁 射频卡读写程序,C#版
💻 CS
字号:
namespace 毕业设计
{
	using System;
	using System.Drawing;
	using System.Collections;
	using System.ComponentModel;
	using System.Windows.Forms;
	using System.Data;

	namespace 软件系统
	{
		/// <summary>
		/// 发卡 的摘要说明。
		/// </summary>
		public class 注册用户 : System.Windows.Forms.Form
		{
			private System.Windows.Forms.Label label2;
			private System.Windows.Forms.Label label3;
			private System.Windows.Forms.Label label4;
			private System.Windows.Forms.Label label5;
			private System.Windows.Forms.Label label6;
			private System.Windows.Forms.TextBox txtName;
			private System.Windows.Forms.TextBox txtSno;
			private System.Windows.Forms.Button btnCancel;
			private System.Windows.Forms.Button btnConfirm;
			private System.Windows.Forms.ComboBox cmbSex;
			private System.ComponentModel.IContainer components;
			private System.Windows.Forms.ComboBox cmbGrade;
			private System.Windows.Forms.ComboBox cmbMajor;
			private System.Windows.Forms.Label label7;
			private System.Windows.Forms.Label label8;
			private System.Windows.Forms.TextBox txtPwd2;
			private System.Windows.Forms.TextBox txtPwd;
			private System.Windows.Forms.CheckBox chkTeacher;

			public string cardno=null;
			public 注册用户()
			{
				//
				// Windows 窗体设计器支持所必需的
				//
				InitializeComponent();

				//
				// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
				//
			}

			/// <summary>
			/// 清理所有正在使用的资源。
			/// </summary>
			protected override void Dispose( bool disposing )
			{
				if( disposing )
				{
					if(components != null)
					{
						components.Dispose();
					}
				}
				base.Dispose( disposing );
			}

			#region Windows 窗体设计器生成的代码
			/// <summary>
			/// 设计器支持所需的方法 - 不要使用代码编辑器修改
			/// 此方法的内容。
			/// </summary>
			private void InitializeComponent()
			{
				this.txtName = new System.Windows.Forms.TextBox();
				this.txtSno = new System.Windows.Forms.TextBox();
				this.label2 = new System.Windows.Forms.Label();
				this.label3 = new System.Windows.Forms.Label();
				this.label4 = new System.Windows.Forms.Label();
				this.label5 = new System.Windows.Forms.Label();
				this.label6 = new System.Windows.Forms.Label();
				this.btnCancel = new System.Windows.Forms.Button();
				this.btnConfirm = new System.Windows.Forms.Button();
				this.cmbSex = new System.Windows.Forms.ComboBox();
				this.cmbGrade = new System.Windows.Forms.ComboBox();
				this.cmbMajor = new System.Windows.Forms.ComboBox();
				this.label7 = new System.Windows.Forms.Label();
				this.label8 = new System.Windows.Forms.Label();
				this.txtPwd = new System.Windows.Forms.TextBox();
				this.txtPwd2 = new System.Windows.Forms.TextBox();
				this.chkTeacher = new System.Windows.Forms.CheckBox();
				this.SuspendLayout();
				// 
				// txtName
				// 
				this.txtName.Location = new System.Drawing.Point(120, 24);
				this.txtName.Name = "txtName";
				this.txtName.TabIndex = 0;
				this.txtName.Text = "";
				// 
				// txtSno
				// 
				this.txtSno.Location = new System.Drawing.Point(120, 135);
				this.txtSno.Name = "txtSno";
				this.txtSno.TabIndex = 2;
				this.txtSno.Text = "";
				// 
				// label2
				// 
				this.label2.Location = new System.Drawing.Point(8, 135);
				this.label2.Name = "label2";
				this.label2.TabIndex = 8;
				this.label2.Text = "学号";
				this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
				// 
				// label3
				// 
				this.label3.Location = new System.Drawing.Point(8, 172);
				this.label3.Name = "label3";
				this.label3.TabIndex = 9;
				this.label3.Text = "性别";
				this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
				// 
				// label4
				// 
				this.label4.Location = new System.Drawing.Point(8, 209);
				this.label4.Name = "label4";
				this.label4.TabIndex = 10;
				this.label4.Text = "年级";
				this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
				// 
				// label5
				// 
				this.label5.Location = new System.Drawing.Point(8, 246);
				this.label5.Name = "label5";
				this.label5.TabIndex = 11;
				this.label5.Text = "专业";
				this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
				// 
				// label6
				// 
				this.label6.Location = new System.Drawing.Point(8, 24);
				this.label6.Name = "label6";
				this.label6.TabIndex = 12;
				this.label6.Text = "姓名";
				this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
				// 
				// btnCancel
				// 
				this.btnCancel.Location = new System.Drawing.Point(184, 280);
				this.btnCancel.Name = "btnCancel";
				this.btnCancel.TabIndex = 14;
				this.btnCancel.Text = "取消";
				this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
				// 
				// btnConfirm
				// 
				this.btnConfirm.Location = new System.Drawing.Point(64, 280);
				this.btnConfirm.Name = "btnConfirm";
				this.btnConfirm.TabIndex = 15;
				this.btnConfirm.Text = "确定";
				this.btnConfirm.Click += new System.EventHandler(this.btnConfirm_Click);
				// 
				// cmbSex
				// 
				this.cmbSex.Items.AddRange(new object[] {
															"男",
															"女"});
				this.cmbSex.Location = new System.Drawing.Point(120, 172);
				this.cmbSex.Name = "cmbSex";
				this.cmbSex.Size = new System.Drawing.Size(40, 20);
				this.cmbSex.TabIndex = 17;
				this.cmbSex.Text = "男";
				// 
				// cmbGrade
				// 
				this.cmbGrade.Items.AddRange(new object[] {
															  "大一",
															  "大二",
															  "大三",
															  "大四"});
				this.cmbGrade.Location = new System.Drawing.Point(120, 208);
				this.cmbGrade.Name = "cmbGrade";
				this.cmbGrade.Size = new System.Drawing.Size(121, 20);
				this.cmbGrade.TabIndex = 18;
				this.cmbGrade.Text = "大四";
				// 
				// cmbMajor
				// 
				this.cmbMajor.Items.AddRange(new object[] {
															  "计算机科学与技术",
															  "工商管理",
															  "纺织",
															  "物理",
															  "化工"});
				this.cmbMajor.Location = new System.Drawing.Point(120, 244);
				this.cmbMajor.Name = "cmbMajor";
				this.cmbMajor.Size = new System.Drawing.Size(121, 20);
				this.cmbMajor.TabIndex = 20;
				this.cmbMajor.Text = "计算机科学与技术";
				// 
				// label7
				// 
				this.label7.Location = new System.Drawing.Point(8, 98);
				this.label7.Name = "label7";
				this.label7.TabIndex = 21;
				this.label7.Text = "重复密码";
				this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
				// 
				// label8
				// 
				this.label8.Location = new System.Drawing.Point(8, 61);
				this.label8.Name = "label8";
				this.label8.TabIndex = 22;
				this.label8.Text = "密码";
				this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
				// 
				// txtPwd
				// 
				this.txtPwd.Location = new System.Drawing.Point(120, 61);
				this.txtPwd.Name = "txtPwd";
				this.txtPwd.TabIndex = 23;
				this.txtPwd.Text = "";
				// 
				// txtPwd2
				// 
				this.txtPwd2.Location = new System.Drawing.Point(120, 98);
				this.txtPwd2.Name = "txtPwd2";
				this.txtPwd2.TabIndex = 24;
				this.txtPwd2.Text = "";
				// 
				// chkTeacher
				// 
				this.chkTeacher.Location = new System.Drawing.Point(248, 24);
				this.chkTeacher.Name = "chkTeacher";
				this.chkTeacher.Size = new System.Drawing.Size(64, 24);
				this.chkTeacher.TabIndex = 25;
				this.chkTeacher.Text = "老师";
				// 
				// 发卡
				// 
				this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
				this.ClientSize = new System.Drawing.Size(320, 326);
				this.Controls.Add(this.chkTeacher);
				this.Controls.Add(this.txtPwd2);
				this.Controls.Add(this.txtPwd);
				this.Controls.Add(this.txtSno);
				this.Controls.Add(this.txtName);
				this.Controls.Add(this.label8);
				this.Controls.Add(this.label7);
				this.Controls.Add(this.cmbMajor);
				this.Controls.Add(this.cmbGrade);
				this.Controls.Add(this.cmbSex);
				this.Controls.Add(this.btnConfirm);
				this.Controls.Add(this.btnCancel);
				this.Controls.Add(this.label6);
				this.Controls.Add(this.label5);
				this.Controls.Add(this.label4);
				this.Controls.Add(this.label3);
				this.Controls.Add(this.label2);
				this.Name = "发卡";
				this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
				this.Text = "发卡";
				this.ResumeLayout(false);

			}
			#endregion

			private void btnConfirm_Click(object sender, System.EventArgs e)
			{
				bool FullInfo=true;
				if(this.txtName.Text.Trim()=="")
				{
					FullInfo=false;
					MessageBox.Show("姓名为空!");
				}
				else if(this.txtPwd.Text.Trim()=="")
				{
					FullInfo=false;
					MessageBox.Show("密码为空!");
				}
				else if(this.txtPwd.Text!=this.txtPwd2.Text)
				{
					FullInfo=false;
					MessageBox.Show("请确认密码输入无误!");
					this.txtPwd.Text="";
					this.txtPwd2.Text="";
				}
				else if(this.txtSno.Text.Trim()=="")
				{
					FullInfo=false;
					MessageBox.Show("学号为空!");
				}
				else if(this.cmbSex.Text.Trim()=="")
				{
					FullInfo=false;
					MessageBox.Show("性别为空!");
				}
				else if(this.txtName.Text.Trim()=="")
				{
					FullInfo=false;
					MessageBox.Show("姓名为空!");
				}
				else if(this.cmbGrade.Text.Trim()=="")
				{
					FullInfo=false;
					MessageBox.Show("年级为空!");
				}
				else if(this.cmbMajor.Text.Trim()=="")
				{
					FullInfo=false;
					MessageBox.Show("专业为空!");
				}
				if(FullInfo)
				{
					string userid=this.txtSno.Text;
					string name=this.txtName.Text;
					string pwd=this.txtPwd.Text;
					string clas=this.cmbMajor.Text;
					string grade=this.cmbGrade.Text;
					string sex=this.cmbSex.Text;
					string cardsno=cardno;
					int type=0;
					if(this.chkTeacher.Checked)
						type=1;
					毕业设计.数据处理.数据处理 o=new 毕业设计.数据处理.数据处理();
					if(o.Registers(userid,name,pwd,cardsno,clas,grade,sex,type))
					{
						MessageBox.Show("注册成功!");
						this.Dispose(true);
					}
					else
					{
						MessageBox.Show("注册失败!");
						this.Dispose(true);
					}
				}
			}

		

			private void btnCancel_Click(object sender, System.EventArgs e)
			{
				this.Close();
			}


		
		}
	}
}

⌨️ 快捷键说明

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