📄 displayemployeedetails.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace ApplicationForm
{
/// <summary>
/// Summary description for DisplayDetails.
/// </summary>
public class DisplayEmployeeDetailsForm : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnFinish;
protected internal System.Windows.Forms.Label lblCourseWorkDetail;
private System.Windows.Forms.Label lblEmpID;
private System.Windows.Forms.Label lblSex;
protected internal System.Windows.Forms.Label lblTelephoneDetail;
private System.Windows.Forms.Label lblTelephone;
protected internal System.Windows.Forms.Label lblPerAddressDetail;
protected internal System.Windows.Forms.Label label1;
protected internal System.Windows.Forms.Label lblAddressDetail;
protected internal System.Windows.Forms.Label lblEmpStatusDetail;
protected internal System.Windows.Forms.Label lblEmpDesg;
protected internal System.Windows.Forms.Label lblEmployeeDesignation;
protected internal System.Windows.Forms.Label lblCourseWorkload;
protected internal System.Windows.Forms.Label lblSexDetail;
private System.Windows.Forms.Label lblPerAddress;
private System.Windows.Forms.Label lblAddress;
private System.Windows.Forms.Label lblName;
protected internal System.Windows.Forms.Label lblEmployeeIDDetail;
protected internal System.Windows.Forms.Label lblNameDetails;
private System.Windows.Forms.Button btnCreateInstanceDetails;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public DisplayEmployeeDetailsForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lblCourseWorkDetail = new System.Windows.Forms.Label();
this.lblEmpID = new System.Windows.Forms.Label();
this.lblSex = new System.Windows.Forms.Label();
this.lblTelephoneDetail = new System.Windows.Forms.Label();
this.lblTelephone = new System.Windows.Forms.Label();
this.lblPerAddressDetail = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.lblAddressDetail = new System.Windows.Forms.Label();
this.lblEmpStatusDetail = new System.Windows.Forms.Label();
this.lblEmpDesg = new System.Windows.Forms.Label();
this.lblEmployeeDesignation = new System.Windows.Forms.Label();
this.lblCourseWorkload = new System.Windows.Forms.Label();
this.lblSexDetail = new System.Windows.Forms.Label();
this.lblPerAddress = new System.Windows.Forms.Label();
this.lblAddress = new System.Windows.Forms.Label();
this.lblName = new System.Windows.Forms.Label();
this.lblEmployeeIDDetail = new System.Windows.Forms.Label();
this.lblNameDetails = new System.Windows.Forms.Label();
this.btnFinish = new System.Windows.Forms.Button();
this.btnCreateInstanceDetails = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.lblCourseWorkDetail);
this.groupBox1.Controls.Add(this.lblEmpID);
this.groupBox1.Controls.Add(this.lblSex);
this.groupBox1.Controls.Add(this.lblTelephoneDetail);
this.groupBox1.Controls.Add(this.lblTelephone);
this.groupBox1.Controls.Add(this.lblPerAddressDetail);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.lblAddressDetail);
this.groupBox1.Controls.Add(this.lblEmpStatusDetail);
this.groupBox1.Controls.Add(this.lblEmpDesg);
this.groupBox1.Controls.Add(this.lblEmployeeDesignation);
this.groupBox1.Controls.Add(this.lblCourseWorkload);
this.groupBox1.Controls.Add(this.lblSexDetail);
this.groupBox1.Controls.Add(this.lblPerAddress);
this.groupBox1.Controls.Add(this.lblAddress);
this.groupBox1.Controls.Add(this.lblName);
this.groupBox1.Controls.Add(this.lblEmployeeIDDetail);
this.groupBox1.Controls.Add(this.lblNameDetails);
this.groupBox1.Location = new System.Drawing.Point(10, 9);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(470, 585);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "职员详细信息";
//
// lblCourseWorkDetail
//
this.lblCourseWorkDetail.Location = new System.Drawing.Point(206, 508);
this.lblCourseWorkDetail.Name = "lblCourseWorkDetail";
this.lblCourseWorkDetail.Size = new System.Drawing.Size(255, 65);
this.lblCourseWorkDetail.TabIndex = 28;
//
// lblEmpID
//
this.lblEmpID.Location = new System.Drawing.Point(19, 28);
this.lblEmpID.Name = "lblEmpID";
this.lblEmpID.Size = new System.Drawing.Size(96, 25);
this.lblEmpID.TabIndex = 31;
this.lblEmpID.Text = "职员编号:";
//
// lblSex
//
this.lblSex.Location = new System.Drawing.Point(19, 191);
this.lblSex.Name = "lblSex";
this.lblSex.Size = new System.Drawing.Size(66, 24);
this.lblSex.TabIndex = 27;
this.lblSex.Text = "性别:";
//
// lblTelephoneDetail
//
this.lblTelephoneDetail.Location = new System.Drawing.Point(205, 457);
this.lblTelephoneDetail.Name = "lblTelephoneDetail";
this.lblTelephoneDetail.Size = new System.Drawing.Size(221, 24);
this.lblTelephoneDetail.TabIndex = 26;
//
// lblTelephone
//
this.lblTelephone.Location = new System.Drawing.Point(19, 457);
this.lblTelephone.Name = "lblTelephone";
this.lblTelephone.Size = new System.Drawing.Size(77, 17);
this.lblTelephone.TabIndex = 25;
this.lblTelephone.Text = "电话:";
//
// lblPerAddressDetail
//
this.lblPerAddressDetail.Location = new System.Drawing.Point(209, 339);
this.lblPerAddressDetail.Name = "lblPerAddressDetail";
this.lblPerAddressDetail.Size = new System.Drawing.Size(252, 95);
this.lblPerAddressDetail.TabIndex = 24;
//
// label1
//
this.label1.Location = new System.Drawing.Point(19, 155);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(144, 17);
this.label1.TabIndex = 35;
this.label1.Text = "职员状态:";
//
// lblAddressDetail
//
this.lblAddressDetail.Location = new System.Drawing.Point(205, 233);
this.lblAddressDetail.Name = "lblAddressDetail";
this.lblAddressDetail.Size = new System.Drawing.Size(246, 86);
this.lblAddressDetail.TabIndex = 21;
//
// lblEmpStatusDetail
//
this.lblEmpStatusDetail.Location = new System.Drawing.Point(211, 155);
this.lblEmpStatusDetail.Name = "lblEmpStatusDetail";
this.lblEmpStatusDetail.Size = new System.Drawing.Size(154, 25);
this.lblEmpStatusDetail.TabIndex = 34;
//
// lblEmpDesg
//
this.lblEmpDesg.Location = new System.Drawing.Point(19, 121);
this.lblEmpDesg.Name = "lblEmpDesg";
this.lblEmpDesg.Size = new System.Drawing.Size(154, 17);
this.lblEmpDesg.TabIndex = 33;
this.lblEmpDesg.Text = "职员称号:";
//
// lblEmployeeDesignation
//
this.lblEmployeeDesignation.Location = new System.Drawing.Point(205, 121);
this.lblEmployeeDesignation.Name = "lblEmployeeDesignation";
this.lblEmployeeDesignation.Size = new System.Drawing.Size(154, 24);
this.lblEmployeeDesignation.TabIndex = 32;
//
// lblCourseWorkload
//
this.lblCourseWorkload.Location = new System.Drawing.Point(19, 508);
this.lblCourseWorkload.Name = "lblCourseWorkload";
this.lblCourseWorkload.Size = new System.Drawing.Size(135, 26);
this.lblCourseWorkload.TabIndex = 30;
this.lblCourseWorkload.Text = "课程分配:";
//
// lblSexDetail
//
this.lblSexDetail.Location = new System.Drawing.Point(205, 191);
this.lblSexDetail.Name = "lblSexDetail";
this.lblSexDetail.Size = new System.Drawing.Size(67, 24);
this.lblSexDetail.TabIndex = 19;
//
// lblPerAddress
//
this.lblPerAddress.Location = new System.Drawing.Point(19, 339);
this.lblPerAddress.Name = "lblPerAddress";
this.lblPerAddress.Size = new System.Drawing.Size(144, 23);
this.lblPerAddress.TabIndex = 23;
this.lblPerAddress.Text = "户籍地址:";
//
// lblAddress
//
this.lblAddress.Location = new System.Drawing.Point(19, 233);
this.lblAddress.Name = "lblAddress";
this.lblAddress.Size = new System.Drawing.Size(66, 24);
this.lblAddress.TabIndex = 22;
this.lblAddress.Text = "地址:";
//
// lblName
//
this.lblName.Location = new System.Drawing.Point(19, 78);
this.lblName.Name = "lblName";
this.lblName.Size = new System.Drawing.Size(66, 24);
this.lblName.TabIndex = 20;
this.lblName.Text = "姓名:";
//
// lblEmployeeIDDetail
//
this.lblEmployeeIDDetail.Location = new System.Drawing.Point(211, 28);
this.lblEmployeeIDDetail.Name = "lblEmployeeIDDetail";
this.lblEmployeeIDDetail.Size = new System.Drawing.Size(154, 25);
this.lblEmployeeIDDetail.TabIndex = 29;
//
// lblNameDetails
//
this.lblNameDetails.Location = new System.Drawing.Point(211, 78);
this.lblNameDetails.Name = "lblNameDetails";
this.lblNameDetails.Size = new System.Drawing.Size(240, 24);
this.lblNameDetails.TabIndex = 18;
//
// btnFinish
//
this.btnFinish.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnFinish.Location = new System.Drawing.Point(390, 603);
this.btnFinish.Name = "btnFinish";
this.btnFinish.Size = new System.Drawing.Size(90, 25);
this.btnFinish.TabIndex = 11;
this.btnFinish.Text = "完成(&F)";
this.btnFinish.Click += new System.EventHandler(this.btnFinish_Click);
//
// btnCreateInstanceDetails
//
this.btnCreateInstanceDetails.Location = new System.Drawing.Point(259, 603);
this.btnCreateInstanceDetails.Name = "btnCreateInstanceDetails";
this.btnCreateInstanceDetails.Size = new System.Drawing.Size(115, 25);
this.btnCreateInstanceDetails.TabIndex = 12;
this.btnCreateInstanceDetails.Text = "创建实例(&C)";
this.btnCreateInstanceDetails.Click += new System.EventHandler(this.btnSaveDetails_Click);
//
// DisplayEmployeeDetailsForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(489, 630);
this.Controls.Add(this.btnCreateInstanceDetails);
this.Controls.Add(this.btnFinish);
this.Controls.Add(this.groupBox1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DisplayEmployeeDetailsForm";
this.ShowInTaskbar = false;
this.Text = "显示详细信息";
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void btnFinish_Click(object sender, System.EventArgs e)
{
this.Close();
}
//create instance of selected type in ComboBox Professor or Clerk
private void btnSaveDetails_Click(object sender, System.EventArgs e)
{
string empStat = "";
if(string.Compare(this.lblEmpStatusDetail.Text,Employee.EmployeeStatus.OnProbation.ToString(),false)==0)
{
empStat = Employee.EmployeeStatus.OnProbation.ToString();
}
else if(string.Compare(this.lblEmpStatusDetail.Text,Student.StudentType.PartTime.ToString(),false)==0)
{
empStat = Employee.EmployeeStatus.Permanent.ToString();
}
if(string.Compare(this.lblEmployeeDesignation.Text,"Professor",false)==0)
{
string existsCourses = this.lblCourseWorkDetail.Text.Trim();
Professor objProf = new Professor(this.lblEmployeeIDDetail.Text,this.lblNameDetails.Text,long.Parse(this.lblTelephoneDetail.Text),this.lblAddressDetail.Text,this.lblPerAddressDetail.Text,existsCourses,empStat);
MessageBox.Show("包含所有学生详细信息的 Professor 实例已创建");
}
else if(string.Compare(this.lblEmployeeDesignation.Text,"Clerk",false)==0)
{
string existsWorkLoad = this.lblCourseWorkDetail.Text.Trim();
Clerk objProf = new Clerk(this.lblEmployeeIDDetail.Text,this.lblNameDetails.Text,long.Parse(this.lblTelephoneDetail.Text),this.lblAddressDetail.Text,this.lblPerAddressDetail.Text,existsWorkLoad, empStat);
MessageBox.Show("包含所有学生详细信息的 Clerk 实例已创建");
}
btnCreateInstanceDetails.Enabled = false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -