?? winnewuser.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace CJGL
{
/// <summary>
/// WinNewUser 的摘要說明。
/// </summary>
public class WinNewUser : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label password;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.DateTimePicker borndate;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label3;
public System.Windows.Forms.RadioButton maleradio;
public System.Windows.Forms.RadioButton famleradio;
public System.Windows.Forms.RadioButton secretradio;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnQuit;
private System.Windows.Forms.Label label7;
public System.Windows.Forms.TextBox teltext;
public System.Windows.Forms.TextBox usernametext;
public System.Windows.Forms.TextBox stuidtext;
public System.Windows.Forms.TextBox addresstext;
public System.Windows.Forms.TextBox passwordtext;
public System.Windows.Forms.TextBox majortext;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label11;
/// <summary>
/// 必需的設計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public WinNewUser()
{
//
// 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()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(WinNewUser));
this.label1 = new System.Windows.Forms.Label();
this.password = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.borndate = new System.Windows.Forms.DateTimePicker();
this.usernametext = new System.Windows.Forms.TextBox();
this.stuidtext = new System.Windows.Forms.TextBox();
this.maleradio = new System.Windows.Forms.RadioButton();
this.famleradio = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.secretradio = new System.Windows.Forms.RadioButton();
this.addresstext = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.passwordtext = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.majortext = new System.Windows.Forms.TextBox();
this.btnOk = new System.Windows.Forms.Button();
this.btnQuit = new System.Windows.Forms.Button();
this.label7 = new System.Windows.Forms.Label();
this.teltext = new System.Windows.Forms.TextBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(64, 104);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 16);
this.label1.TabIndex = 0;
this.label1.Text = "用戶名";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// password
//
this.password.Location = new System.Drawing.Point(32, 200);
this.password.Name = "password";
this.password.Size = new System.Drawing.Size(56, 24);
this.password.TabIndex = 1;
this.password.Text = "出生日期";
//
// label6
//
this.label6.Location = new System.Drawing.Point(64, 64);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(48, 24);
this.label6.TabIndex = 2;
this.label6.Text = "學號";
//
// label2
//
this.label2.Location = new System.Drawing.Point(32, 256);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(48, 24);
this.label2.TabIndex = 3;
this.label2.Text = "性別";
//
// label5
//
this.label5.Location = new System.Drawing.Point(56, 296);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(48, 16);
this.label5.TabIndex = 4;
this.label5.Text = "地址";
//
// borndate
//
this.borndate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.borndate.Location = new System.Drawing.Point(160, 200);
this.borndate.Name = "borndate";
this.borndate.Size = new System.Drawing.Size(88, 21);
this.borndate.TabIndex = 4;
//
// usernametext
//
this.usernametext.Location = new System.Drawing.Point(176, 96);
this.usernametext.Name = "usernametext";
this.usernametext.TabIndex = 1;
this.usernametext.Text = "";
//
// stuidtext
//
this.stuidtext.Location = new System.Drawing.Point(176, 64);
this.stuidtext.Name = "stuidtext";
this.stuidtext.TabIndex = 0;
this.stuidtext.Text = "";
//
// maleradio
//
this.maleradio.Location = new System.Drawing.Point(0, 24);
this.maleradio.Name = "maleradio";
this.maleradio.Size = new System.Drawing.Size(40, 16);
this.maleradio.TabIndex = 6;
this.maleradio.Text = "男";
//
// famleradio
//
this.famleradio.Location = new System.Drawing.Point(72, 24);
this.famleradio.Name = "famleradio";
this.famleradio.Size = new System.Drawing.Size(32, 24);
this.famleradio.TabIndex = 7;
this.famleradio.Text = "女";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.secretradio);
this.groupBox1.Controls.Add(this.famleradio);
this.groupBox1.Controls.Add(this.maleradio);
this.groupBox1.Location = new System.Drawing.Point(112, 224);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(208, 56);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
//
// secretradio
//
this.secretradio.Location = new System.Drawing.Point(128, 24);
this.secretradio.Name = "secretradio";
this.secretradio.Size = new System.Drawing.Size(48, 24);
this.secretradio.TabIndex = 8;
this.secretradio.Text = "保密";
//
// addresstext
//
this.addresstext.Location = new System.Drawing.Point(176, 288);
this.addresstext.Name = "addresstext";
this.addresstext.Size = new System.Drawing.Size(96, 21);
this.addresstext.TabIndex = 9;
this.addresstext.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(48, 128);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(48, 24);
this.label3.TabIndex = 13;
this.label3.Text = "密碼";
//
// passwordtext
//
this.passwordtext.Location = new System.Drawing.Point(176, 128);
this.passwordtext.Name = "passwordtext";
this.passwordtext.PasswordChar = '*';
this.passwordtext.TabIndex = 2;
this.passwordtext.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(40, 160);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(40, 23);
this.label4.TabIndex = 15;
this.label4.Text = "專業";
//
// majortext
//
this.majortext.Location = new System.Drawing.Point(160, 160);
this.majortext.Name = "majortext";
this.majortext.Size = new System.Drawing.Size(72, 21);
this.majortext.TabIndex = 3;
this.majortext.Text = "";
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(64, 368);
this.btnOk.Name = "btnOk";
this.btnOk.TabIndex = 11;
this.btnOk.Text = "確定";
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnQuit
//
this.btnQuit.Location = new System.Drawing.Point(264, 368);
this.btnQuit.Name = "btnQuit";
this.btnQuit.TabIndex = 12;
this.btnQuit.Text = "取消";
this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click);
//
// label7
//
this.label7.Location = new System.Drawing.Point(56, 328);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(56, 24);
this.label7.TabIndex = 19;
this.label7.Text = "聯系電話";
//
// teltext
//
this.teltext.Location = new System.Drawing.Point(176, 328);
this.teltext.Name = "teltext";
this.teltext.Size = new System.Drawing.Size(96, 21);
this.teltext.TabIndex = 10;
this.teltext.Text = "";
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(40, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(328, 50);
this.pictureBox1.TabIndex = 20;
this.pictureBox1.TabStop = false;
//
// label8
//
this.label8.ForeColor = System.Drawing.Color.Brown;
this.label8.Location = new System.Drawing.Point(304, 64);
this.label8.Name = "label8";
this.label8.TabIndex = 21;
this.label8.Text = "*為必填";
//
// label9
//
this.label9.ForeColor = System.Drawing.Color.Brown;
this.label9.Location = new System.Drawing.Point(296, 128);
this.label9.Name = "label9";
this.label9.TabIndex = 22;
this.label9.Text = "*為必填";
//
// label10
//
this.label10.ForeColor = System.Drawing.Color.Brown;
this.label10.Location = new System.Drawing.Point(280, 96);
this.label10.Name = "label10";
this.label10.TabIndex = 23;
this.label10.Text = "*為必填";
//
// label11
//
this.label11.ForeColor = System.Drawing.Color.Brown;
this.label11.Location = new System.Drawing.Point(248, 168);
this.label11.Name = "label11";
this.label11.TabIndex = 24;
this.label11.Text = "*為必填";
//
// WinNewUser
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.Info;
this.ClientSize = new System.Drawing.Size(440, 445);
this.ControlBox = false;
this.Controls.Add(this.label11);
this.Controls.Add(this.label10);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.teltext);
this.Controls.Add(this.label7);
this.Controls.Add(this.btnQuit);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.majortext);
this.Controls.Add(this.label4);
this.Controls.Add(this.passwordtext);
this.Controls.Add(this.label3);
this.Controls.Add(this.addresstext);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.stuidtext);
this.Controls.Add(this.usernametext);
this.Controls.Add(this.borndate);
this.Controls.Add(this.label5);
this.Controls.Add(this.label2);
this.Controls.Add(this.label6);
this.Controls.Add(this.password);
this.Controls.Add(this.label1);
this.Name = "WinNewUser";
this.Text = "新用戶注冊";
this.Load += new System.EventHandler(this.WinNewUser_Load);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void label1_Click(object sender, System.EventArgs e)
{
}
private void btnOk_Click(object sender, System.EventArgs e)
{
string stuid="",username="",password="",sex="",tel="",address="",btime="",major="";
stuid=this.stuidtext.Text.Trim();
username=this.usernametext.Text.Trim();
password=this.passwordtext.Text.Trim();
if(this.maleradio.Checked)sex="男";
if(this.famleradio.Checked)sex="女";
if(this.secretradio.Checked)sex= "保密";
tel=this.teltext.Text.Trim();
btime=this.borndate.Text.Trim();
major=this.majortext.Text.Trim();
address=this.addresstext.Text.Trim();
DataAccess data=new DataAccess();
if(stuid!=""&&username!=""&&password!=""&&major!="")
{
if(data.newUser(stuid,username,sex,major,tel,address,btime,password))
{
MessageBox.Show("注冊成功");
this.Close();
}
else
{
MessageBox.Show("用戶名已經存在");
}
}
else
{
MessageBox.Show("請完整輸入");
}
}
private void btnQuit_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void WinNewUser_Load(object sender, System.EventArgs e)
{
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -