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

📄 dlgrecord.cs

📁 一个快速的数据库访问框架。可根据需要灵活的扩展。
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace MyORM
{
	/// <summary>
	/// dlgRecord 的摘要说明。
	/// </summary>
	public class dlgRecord : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TextBox txtTitleOfCourtesy;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.TextBox txtAddress;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox txtNotes;
		private System.Windows.Forms.Label label5;
		public System.Windows.Forms.TextBox txtID;
		private System.Windows.Forms.Button cmdOK;
		private System.Windows.Forms.Button cmdCancel;
		private System.Windows.Forms.TextBox txtLastName;
		private System.Windows.Forms.TextBox txtFirstName;
		private System.Windows.Forms.Label label6;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public dlgRecord()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
			this.DialogResult = DialogResult.Cancel ;
		}

		/// <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.txtLastName = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.txtTitleOfCourtesy = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.txtAddress = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.txtNotes = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.txtID = new System.Windows.Forms.TextBox();
			this.cmdOK = new System.Windows.Forms.Button();
			this.cmdCancel = new System.Windows.Forms.Button();
			this.txtFirstName = new System.Windows.Forms.TextBox();
			this.label6 = new System.Windows.Forms.Label();
			this.SuspendLayout();
			// 
			// txtLastName
			// 
			this.txtLastName.Location = new System.Drawing.Point(64, 48);
			this.txtLastName.Name = "txtLastName";
			this.txtLastName.Size = new System.Drawing.Size(352, 21);
			this.txtLastName.TabIndex = 9;
			this.txtLastName.Text = "";
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(16, 48);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(23, 17);
			this.label1.TabIndex = 7;
			this.label1.Text = "姓:";
			// 
			// label2
			// 
			this.label2.AutoSize = true;
			this.label2.Location = new System.Drawing.Point(16, 112);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(35, 17);
			this.label2.TabIndex = 8;
			this.label2.Text = "称呼:";
			// 
			// txtTitleOfCourtesy
			// 
			this.txtTitleOfCourtesy.Location = new System.Drawing.Point(64, 112);
			this.txtTitleOfCourtesy.Name = "txtTitleOfCourtesy";
			this.txtTitleOfCourtesy.Size = new System.Drawing.Size(352, 21);
			this.txtTitleOfCourtesy.TabIndex = 13;
			this.txtTitleOfCourtesy.Text = "";
			// 
			// label3
			// 
			this.label3.AutoSize = true;
			this.label3.Location = new System.Drawing.Point(16, 144);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(35, 17);
			this.label3.TabIndex = 4;
			this.label3.Text = "地址:";
			// 
			// txtAddress
			// 
			this.txtAddress.Location = new System.Drawing.Point(64, 144);
			this.txtAddress.Name = "txtAddress";
			this.txtAddress.Size = new System.Drawing.Size(352, 21);
			this.txtAddress.TabIndex = 12;
			this.txtAddress.Text = "";
			// 
			// label4
			// 
			this.label4.AutoSize = true;
			this.label4.Location = new System.Drawing.Point(16, 176);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(35, 17);
			this.label4.TabIndex = 5;
			this.label4.Text = "说明:";
			// 
			// txtNotes
			// 
			this.txtNotes.Location = new System.Drawing.Point(64, 176);
			this.txtNotes.Multiline = true;
			this.txtNotes.Name = "txtNotes";
			this.txtNotes.ScrollBars = System.Windows.Forms.ScrollBars.Both;
			this.txtNotes.Size = new System.Drawing.Size(352, 88);
			this.txtNotes.TabIndex = 11;
			this.txtNotes.Text = "";
			// 
			// label5
			// 
			this.label5.AutoSize = true;
			this.label5.Location = new System.Drawing.Point(16, 16);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(35, 17);
			this.label5.TabIndex = 6;
			this.label5.Text = "编号:";
			// 
			// txtID
			// 
			this.txtID.Location = new System.Drawing.Point(64, 16);
			this.txtID.Name = "txtID";
			this.txtID.Size = new System.Drawing.Size(352, 21);
			this.txtID.TabIndex = 10;
			this.txtID.Text = "";
			// 
			// cmdOK
			// 
			this.cmdOK.Location = new System.Drawing.Point(216, 280);
			this.cmdOK.Name = "cmdOK";
			this.cmdOK.TabIndex = 14;
			this.cmdOK.Text = "确定(&O)";
			this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
			// 
			// cmdCancel
			// 
			this.cmdCancel.Location = new System.Drawing.Point(312, 280);
			this.cmdCancel.Name = "cmdCancel";
			this.cmdCancel.TabIndex = 14;
			this.cmdCancel.Text = "取消(&C)";
			this.cmdCancel.Click += new System.EventHandler(this.cmdCancel_Click);
			// 
			// txtFirstName
			// 
			this.txtFirstName.Location = new System.Drawing.Point(64, 80);
			this.txtFirstName.Name = "txtFirstName";
			this.txtFirstName.Size = new System.Drawing.Size(352, 21);
			this.txtFirstName.TabIndex = 9;
			this.txtFirstName.Text = "";
			// 
			// label6
			// 
			this.label6.AutoSize = true;
			this.label6.Location = new System.Drawing.Point(16, 80);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(23, 17);
			this.label6.TabIndex = 7;
			this.label6.Text = "名:";
			// 
			// dlgRecord
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(424, 312);
			this.Controls.Add(this.cmdOK);
			this.Controls.Add(this.txtLastName);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.txtTitleOfCourtesy);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.txtAddress);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.txtNotes);
			this.Controls.Add(this.label5);
			this.Controls.Add(this.txtID);
			this.Controls.Add(this.cmdCancel);
			this.Controls.Add(this.txtFirstName);
			this.Controls.Add(this.label6);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "dlgRecord";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "编辑员工信息";
			this.Load += new System.EventHandler(this.dlgRecord_Load);
			this.ResumeLayout(false);

		}
		#endregion

		public DB_Employees Employe = null;

		private void cmdOK_Click(object sender, System.EventArgs e)
		{
			Employe.EmployeeID = Convert.ToInt32(  this.txtID.Text );
			Employe.LastName = this.txtLastName.Text ;
			Employe.FirstName = this.txtFirstName.Text ;
			Employe.TitleOfCourtesy = this.txtTitleOfCourtesy.Text ;
			Employe.Address = this.txtAddress.Text ;
			Employe.Notes = this.txtNotes.Text ;
			this.DialogResult = DialogResult.OK ;
			this.Close();
		}

		private void dlgRecord_Load(object sender, System.EventArgs e)
		{
			this.txtID.Text = Employe.EmployeeID.ToString() ;
			this.txtLastName.Text = Employe.LastName ;
			this.txtFirstName.Text = Employe.FirstName ;
			this.txtTitleOfCourtesy.Text = Employe.TitleOfCourtesy ;
			this.txtNotes.Text = Employe.Notes ;
			this.txtAddress.Text = Employe.Address ;
		}

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

⌨️ 快捷键说明

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