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

📄 formproperty.cs

📁 C#2.0宝典源码,C#经典书籍,很多例子
💻 CS
📖 第 1 页 / 共 4 页
字号:
using System;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using StudentsMIS.DataAccess;
using StudentsMIS.Business;

namespace StudentsMIS.WinForm
{
	/// <summary>
	/// FormProperty 的摘要说明。
	/// </summary>
	public class FormProperty : System.Windows.Forms.Form
	{
    private System.Windows.Forms.TabControl tabControl1;
    private System.Windows.Forms.TabPage tabPage1;
    private System.Windows.Forms.Label label6;
    private System.Windows.Forms.Label label5;
    private System.Windows.Forms.Label label4;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.Panel panel1;
    private System.Windows.Forms.PictureBox pictureBox1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.TabPage tabPage2;
    private System.Windows.Forms.Label label14;
    private System.Windows.Forms.Label label13;
    private System.Windows.Forms.Label label12;
    private System.Windows.Forms.Label label11;
    private System.Windows.Forms.Label label10;
    private System.Windows.Forms.Label label9;
    private System.Windows.Forms.Label label7;
    private System.Windows.Forms.PictureBox pictureBox2;
    private System.Windows.Forms.Panel panel3;
    private System.Windows.Forms.TabPage tabPage3;
    private System.Windows.Forms.Label label20;
    private System.Windows.Forms.Label label19;
    private System.Windows.Forms.Label label18;
    private System.Windows.Forms.Label label17;
    private System.Windows.Forms.Label label16;
    private System.Windows.Forms.PictureBox pictureBox3;
    private System.Windows.Forms.Label label8;
    private System.Windows.Forms.Panel panel4;
    private System.Windows.Forms.Button btnSubmit;
    private System.Windows.Forms.Label labelName;
    private System.Windows.Forms.Label labelNative;
    private System.Windows.Forms.Label labelBirthday;
    private System.Windows.Forms.Label labelIDCardNum;
    private System.Windows.Forms.Label labelSex;
    private System.Windows.Forms.Label labelSpeciality;
    private System.Windows.Forms.Label labelCollege;
    private System.Windows.Forms.Label labelClass;
    private System.Windows.Forms.Label labelStuID;
    private System.Windows.Forms.Label labelEnterYear;
    private System.Windows.Forms.Label labelStuType;
    private System.Windows.Forms.Label labelHomeAdd;
    private System.Windows.Forms.Label labelEmail;
    private System.Windows.Forms.Label labelMobile;
    private System.Windows.Forms.Label labelFlatTel;
    private System.Windows.Forms.Label labelHomeTel;
    private System.Windows.Forms.Button btnEdit;

		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

    private StudentEntity entity = new StudentEntity();
    private System.Windows.Forms.TabPage tabPage4;
    private System.Windows.Forms.TabPage tabPage5;
    private System.Windows.Forms.TabPage tabPage6;
    private System.Windows.Forms.Label label15;
    private System.Windows.Forms.PictureBox pictureBox4;
    private System.Windows.Forms.Label label21;
    private System.Windows.Forms.PictureBox pictureBox5;
    private System.Windows.Forms.Label label22;
    private System.Windows.Forms.PictureBox pictureBox6;
    private System.Windows.Forms.Panel panel2;
    private System.Windows.Forms.Panel panel5;
    private System.Windows.Forms.Panel panel6;
    private System.Data.DataSet dataSetMain;
    private System.Data.DataTable dataTable1;
    private System.Data.DataTable dataTable2;
    private System.Data.DataTable dataTable3;
    private System.Windows.Forms.DataGrid dataGridChanges;
    private System.Windows.Forms.DataGridTableStyle dataGridTableStyle2;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn4;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn5;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn6;
    private System.Windows.Forms.DataGrid dataGridAwards;
    private System.Windows.Forms.DataGrid dataGridPunishments;
    private System.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn2;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn3;
    private System.Windows.Forms.DataGridTableStyle dataGridTableStyle3;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn7;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn8;
    private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn9;
    private StudentManager manager = new StudentManager();

		public FormProperty(string id)
		{
			// Windows 窗体设计器支持所必需的
			InitializeComponent();
      entity = (StudentEntity)manager.Select(id);
      labelName.Text = entity.StudentName;
      labelSex.Text = entity.StudentSex;
      labelIDCardNum.Text = entity.StudentIDCardNum;
      labelBirthday.Text = entity.StudentBirthday.ToShortDateString();
      labelNative.Text = entity.StudentNative;
      labelCollege.Text = entity.StudentCollegeID + "-" + entity.StudentCollegeName;
      labelSpeciality.Text = entity.StudentSpecialityID + "-" + entity.StudentSpecialityName;
      labelClass.Text = entity.StudentClass;
      labelStuID.Text = entity.StudentID;
      labelEnterYear.Text = entity.StudentEnterYear + "年";
      labelStuType.Text = entity.StudentStuType + "年";
      labelHomeAdd.Text = entity.StudentHomeAdd;
      labelEmail.Text = entity.StudentEmail;
      labelMobile.Text = entity.StudentMobile;
      labelFlatTel.Text = entity.StudentFlatTel;
      labelHomeTel.Text = entity.StudentHomeTel;

      OleDbCommand objCommand = CommandBuilder.BuildOleDbCommand("SELECT changes.change_reason,changes.change_date, changeTypes.changeType_name FROM changeTypes INNER JOIN changes ON changeTypes.changeType_ID = changes.change_changeType Where change_studentID=@StudentID");
      objCommand.Parameters.Add("@StudentID",id);
      OleDbDataAdapter objAdapter = new OleDbDataAdapter(objCommand);
      objAdapter.Fill(dataSetMain,"Changes");

      objCommand = CommandBuilder.BuildOleDbCommand("Select * From awards Where award_studentID=@StudentID");
      objCommand.Parameters.Add("@StudentID",id);
      objAdapter = new OleDbDataAdapter(objCommand);
      objAdapter.Fill(dataSetMain,"Awards");

      objCommand = CommandBuilder.BuildOleDbCommand("SELECT punishments.*, punishmentTypes.* FROM punishmentTypes INNER JOIN punishments ON punishmentTypes.punishmentType_ID = punishments.punishment_typeID Where punishment_studentID=@StudentID");
      objCommand.Parameters.Add("@StudentID",id);
      objAdapter = new OleDbDataAdapter(objCommand);
      objAdapter.Fill(dataSetMain,"Punishments");
      
      objCommand.Connection.Close();
      objCommand.Connection.Dispose();
      objCommand.Dispose();
      objAdapter.Dispose();
		}


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

    #endregion

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
      System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormProperty));
      this.tabControl1 = new System.Windows.Forms.TabControl();
      this.tabPage1 = new System.Windows.Forms.TabPage();
      this.labelNative = new System.Windows.Forms.Label();
      this.labelBirthday = new System.Windows.Forms.Label();
      this.labelIDCardNum = new System.Windows.Forms.Label();
      this.labelSex = new System.Windows.Forms.Label();
      this.labelName = new System.Windows.Forms.Label();
      this.label6 = new System.Windows.Forms.Label();
      this.label5 = new System.Windows.Forms.Label();
      this.label4 = new System.Windows.Forms.Label();
      this.label3 = new System.Windows.Forms.Label();
      this.label1 = new System.Windows.Forms.Label();
      this.panel1 = new System.Windows.Forms.Panel();
      this.pictureBox1 = new System.Windows.Forms.PictureBox();
      this.label2 = new System.Windows.Forms.Label();
      this.tabPage2 = new System.Windows.Forms.TabPage();
      this.labelStuType = new System.Windows.Forms.Label();
      this.labelEnterYear = new System.Windows.Forms.Label();
      this.labelStuID = new System.Windows.Forms.Label();
      this.labelClass = new System.Windows.Forms.Label();
      this.labelSpeciality = new System.Windows.Forms.Label();
      this.labelCollege = new System.Windows.Forms.Label();
      this.label14 = new System.Windows.Forms.Label();
      this.label13 = new System.Windows.Forms.Label();
      this.label12 = new System.Windows.Forms.Label();
      this.label11 = new System.Windows.Forms.Label();
      this.label10 = new System.Windows.Forms.Label();
      this.label9 = new System.Windows.Forms.Label();
      this.label7 = new System.Windows.Forms.Label();
      this.pictureBox2 = new System.Windows.Forms.PictureBox();
      this.panel3 = new System.Windows.Forms.Panel();
      this.tabPage3 = new System.Windows.Forms.TabPage();
      this.labelEmail = new System.Windows.Forms.Label();
      this.labelMobile = new System.Windows.Forms.Label();
      this.labelFlatTel = new System.Windows.Forms.Label();
      this.labelHomeTel = new System.Windows.Forms.Label();
      this.labelHomeAdd = new System.Windows.Forms.Label();
      this.label20 = new System.Windows.Forms.Label();
      this.label19 = new System.Windows.Forms.Label();
      this.label18 = new System.Windows.Forms.Label();
      this.label17 = new System.Windows.Forms.Label();
      this.label16 = new System.Windows.Forms.Label();
      this.pictureBox3 = new System.Windows.Forms.PictureBox();
      this.label8 = new System.Windows.Forms.Label();
      this.panel4 = new System.Windows.Forms.Panel();
      this.tabPage4 = new System.Windows.Forms.TabPage();
      this.dataGridChanges = new System.Windows.Forms.DataGrid();
      this.dataSetMain = new System.Data.DataSet();
      this.dataTable1 = new System.Data.DataTable();
      this.dataTable2 = new System.Data.DataTable();
      this.dataTable3 = new System.Data.DataTable();
      this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle();
      this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.dataGridTextBoxColumn2 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.dataGridTextBoxColumn3 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.panel2 = new System.Windows.Forms.Panel();
      this.label15 = new System.Windows.Forms.Label();
      this.pictureBox4 = new System.Windows.Forms.PictureBox();
      this.tabPage5 = new System.Windows.Forms.TabPage();
      this.dataGridAwards = new System.Windows.Forms.DataGrid();
      this.dataGridTableStyle2 = new System.Windows.Forms.DataGridTableStyle();
      this.dataGridTextBoxColumn4 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.dataGridTextBoxColumn5 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.dataGridTextBoxColumn6 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.panel5 = new System.Windows.Forms.Panel();
      this.label21 = new System.Windows.Forms.Label();
      this.pictureBox5 = new System.Windows.Forms.PictureBox();
      this.tabPage6 = new System.Windows.Forms.TabPage();
      this.dataGridPunishments = new System.Windows.Forms.DataGrid();
      this.dataGridTableStyle3 = new System.Windows.Forms.DataGridTableStyle();
      this.dataGridTextBoxColumn7 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.dataGridTextBoxColumn8 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.dataGridTextBoxColumn9 = new System.Windows.Forms.DataGridTextBoxColumn();
      this.panel6 = new System.Windows.Forms.Panel();
      this.label22 = new System.Windows.Forms.Label();
      this.pictureBox6 = new System.Windows.Forms.PictureBox();
      this.btnEdit = new System.Windows.Forms.Button();
      this.btnSubmit = new System.Windows.Forms.Button();
      this.tabControl1.SuspendLayout();
      this.tabPage1.SuspendLayout();
      this.tabPage2.SuspendLayout();
      this.tabPage3.SuspendLayout();
      this.tabPage4.SuspendLayout();
      ((System.ComponentModel.ISupportInitialize)(this.dataGridChanges)).BeginInit();
      ((System.ComponentModel.ISupportInitialize)(this.dataSetMain)).BeginInit();
      ((System.ComponentModel.ISupportInitialize)(this.dataTable1)).BeginInit();
      ((System.ComponentModel.ISupportInitialize)(this.dataTable2)).BeginInit();

⌨️ 快捷键说明

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