📄 mainform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Reflection;
using Excel = Microsoft.Office.Interop.Excel;
namespace KTMIS
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class MainForm : System.Windows.Forms.Form
{
public System.Data.SqlClient.SqlConnection sqlConnection;
private System.Data.SqlClient.SqlCommand sqlCommand;
private System.Data.SqlClient.SqlCommand storedProcedure;
private System.Data.SqlClient.SqlDataReader sqlDataReader;
private string[] connectStr = {"(local)", "KTMIS", "sa", ""};
private string queryCondition = "";
private System.Windows.Forms.StatusBar statusBar;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button btnUpdate;
private System.Windows.Forms.Button btnSearch;
private System.Windows.Forms.Button btnAbout;
private System.Windows.Forms.Button btnHelp;
private System.Windows.Forms.DataGrid dataGrid;
private System.Windows.Forms.Button btnS_Manage;
private System.Windows.Forms.Button btnL_Manage;
private System.Windows.Forms.Button btnC_Manage;
private System.Windows.Forms.Button btnM_Manage;
private System.Data.DataSet dataSet;
private System.Data.DataTable tTask;
private System.Data.DataColumn cTaskID;
private System.Data.DataColumn cSortCo;
private System.Data.DataColumn cLevelCo;
private System.Data.DataColumn cYear;
private System.Data.DataColumn cSerial;
private System.Data.DataColumn cCollegeCo;
private System.Data.DataColumn cTaskNa;
private System.Data.DataColumn cMainMember;
private System.Data.DataColumn cStartDate;
private System.Data.DataColumn cPlanDate;
private System.Data.DataColumn cEndDate;
private System.Data.DataColumn cStandardMoney;
private System.Data.DataColumn cAlreadyMoney;
private System.Data.DataColumn cSurplusMoney;
private System.Data.DataColumn cTel;
private System.Data.DataColumn cEmail;
private System.Data.DataColumn cRemark;
private System.Data.DataColumn cMember1;
private System.Data.DataColumn cMember2;
private System.Data.DataColumn cMember3;
private System.Data.DataColumn cMember4;
private System.Data.DataColumn cMember5;
private System.Data.DataColumn cSortPY;
private System.Data.DataColumn cLevelPY;
private System.Data.DataColumn cCollegeNa;
private System.Data.DataColumn cTaskCo;
private System.Data.DataColumn cMemberName;
private System.Windows.Forms.Button btnEduce;
private System.Windows.Forms.DataGridTableStyle tableStyle;
private System.Windows.Forms.DataGridTextBoxColumn sTaskCo;
private System.Windows.Forms.DataGridTextBoxColumn sTaskNa;
private System.Windows.Forms.DataGridTextBoxColumn sCollege;
private System.Windows.Forms.DataGridTextBoxColumn sMemberNames;
private System.Windows.Forms.DataGridTextBoxColumn sStart;
private System.Windows.Forms.DataGridTextBoxColumn sPlan;
private System.Windows.Forms.DataGridTextBoxColumn sEnd;
private System.Windows.Forms.DataGridTextBoxColumn sStandard;
private System.Windows.Forms.DataGridTextBoxColumn sAlready;
private System.Windows.Forms.DataGridTextBoxColumn sSurplus;
private System.Windows.Forms.DataGridTextBoxColumn sTel;
private System.Windows.Forms.DataGridTextBoxColumn sEmail;
private System.Windows.Forms.DataGridTextBoxColumn sRemark;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.StatusBarPanel sbpTitle;
private System.Windows.Forms.StatusBarPanel sbpAuthor;
private System.Windows.Forms.StatusBarPanel sbpDate;
private System.Windows.Forms.StatusBarPanel sbpTime;
private System.Windows.Forms.Timer timer_DateTime;
private System.ComponentModel.IContainer components;
public MainForm()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
this.sqlCommand = new System.Data.SqlClient.SqlCommand();
this.storedProcedure = new System.Data.SqlClient.SqlCommand();
this.storedProcedure.CommandType = System.Data.CommandType.StoredProcedure;
}
/// <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.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
this.statusBar = new System.Windows.Forms.StatusBar();
this.btnM_Manage = new System.Windows.Forms.Button();
this.btnC_Manage = new System.Windows.Forms.Button();
this.btnL_Manage = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.btnS_Manage = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.btnEduce = new System.Windows.Forms.Button();
this.btnHelp = new System.Windows.Forms.Button();
this.btnAbout = new System.Windows.Forms.Button();
this.btnSearch = new System.Windows.Forms.Button();
this.btnUpdate = new System.Windows.Forms.Button();
this.btnDelete = new System.Windows.Forms.Button();
this.btnAdd = new System.Windows.Forms.Button();
this.dataGrid = new System.Windows.Forms.DataGrid();
this.tTask = new System.Data.DataTable();
this.cTaskID = new System.Data.DataColumn();
this.cSortCo = new System.Data.DataColumn();
this.cLevelCo = new System.Data.DataColumn();
this.cYear = new System.Data.DataColumn();
this.cSerial = new System.Data.DataColumn();
this.cTaskCo = new System.Data.DataColumn();
this.cTaskNa = new System.Data.DataColumn();
this.cCollegeCo = new System.Data.DataColumn();
this.cCollegeNa = new System.Data.DataColumn();
this.cMemberName = new System.Data.DataColumn();
this.cStartDate = new System.Data.DataColumn();
this.cPlanDate = new System.Data.DataColumn();
this.cEndDate = new System.Data.DataColumn();
this.cStandardMoney = new System.Data.DataColumn();
this.cAlreadyMoney = new System.Data.DataColumn();
this.cSurplusMoney = new System.Data.DataColumn();
this.cTel = new System.Data.DataColumn();
this.cEmail = new System.Data.DataColumn();
this.cRemark = new System.Data.DataColumn();
this.cSortPY = new System.Data.DataColumn();
this.cLevelPY = new System.Data.DataColumn();
this.cMainMember = new System.Data.DataColumn();
this.cMember1 = new System.Data.DataColumn();
this.cMember2 = new System.Data.DataColumn();
this.cMember3 = new System.Data.DataColumn();
this.cMember4 = new System.Data.DataColumn();
this.cMember5 = new System.Data.DataColumn();
this.tableStyle = new System.Windows.Forms.DataGridTableStyle();
this.sTaskCo = new System.Windows.Forms.DataGridTextBoxColumn();
this.sTaskNa = new System.Windows.Forms.DataGridTextBoxColumn();
this.sCollege = new System.Windows.Forms.DataGridTextBoxColumn();
this.sMemberNames = new System.Windows.Forms.DataGridTextBoxColumn();
this.sStart = new System.Windows.Forms.DataGridTextBoxColumn();
this.sPlan = new System.Windows.Forms.DataGridTextBoxColumn();
this.sEnd = new System.Windows.Forms.DataGridTextBoxColumn();
this.sStandard = new System.Windows.Forms.DataGridTextBoxColumn();
this.sAlready = new System.Windows.Forms.DataGridTextBoxColumn();
this.sSurplus = new System.Windows.Forms.DataGridTextBoxColumn();
this.sTel = new System.Windows.Forms.DataGridTextBoxColumn();
this.sEmail = new System.Windows.Forms.DataGridTextBoxColumn();
this.sRemark = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataSet = new System.Data.DataSet();
this.sbpTitle = new System.Windows.Forms.StatusBarPanel();
this.sbpAuthor = new System.Windows.Forms.StatusBarPanel();
this.sbpDate = new System.Windows.Forms.StatusBarPanel();
this.sbpTime = new System.Windows.Forms.StatusBarPanel();
this.timer_DateTime = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.dataGrid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tTask)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sbpTitle)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sbpAuthor)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sbpDate)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sbpTime)).BeginInit();
this.SuspendLayout();
//
// statusBar
//
this.statusBar.Location = new System.Drawing.Point(0, 697);
this.statusBar.Name = "statusBar";
this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.sbpTitle,
this.sbpAuthor,
this.sbpDate,
this.sbpTime});
this.statusBar.ShowPanels = true;
this.statusBar.Size = new System.Drawing.Size(1024, 22);
this.statusBar.TabIndex = 2;
//
// btnM_Manage
//
this.btnM_Manage.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnM_Manage.Location = new System.Drawing.Point(16, 616);
this.btnM_Manage.Name = "btnM_Manage";
this.btnM_Manage.Size = new System.Drawing.Size(72, 64);
this.btnM_Manage.TabIndex = 8;
this.btnM_Manage.Text = "成员信息管理界面";
this.btnM_Manage.Click += new System.EventHandler(this.btnM_Manage_Click);
//
// btnC_Manage
//
this.btnC_Manage.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnC_Manage.Location = new System.Drawing.Point(16, 536);
this.btnC_Manage.Name = "btnC_Manage";
this.btnC_Manage.Size = new System.Drawing.Size(72, 64);
this.btnC_Manage.TabIndex = 7;
this.btnC_Manage.Text = "院系信息管理界面";
this.btnC_Manage.Click += new System.EventHandler(this.btnC_Manage_Click);
//
// btnL_Manage
//
this.btnL_Manage.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnL_Manage.Location = new System.Drawing.Point(16, 456);
this.btnL_Manage.Name = "btnL_Manage";
this.btnL_Manage.Size = new System.Drawing.Size(72, 64);
this.btnL_Manage.TabIndex = 6;
this.btnL_Manage.Text = "级别信息管理界面";
this.btnL_Manage.Click += new System.EventHandler(this.btnL_Manage_Click);
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.White;
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(100, 100);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox1.TabIndex = 5;
this.pictureBox1.TabStop = false;
//
// btnS_Manage
//
this.btnS_Manage.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnS_Manage.Location = new System.Drawing.Point(16, 376);
this.btnS_Manage.Name = "btnS_Manage";
this.btnS_Manage.Size = new System.Drawing.Size(72, 64);
this.btnS_Manage.TabIndex = 5;
this.btnS_Manage.Text = "分类信息管理界面";
this.btnS_Manage.Click += new System.EventHandler(this.btnS_Manage_Click);
//
// btnExit
//
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.Location = new System.Drawing.Point(16, 120);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(72, 40);
this.btnExit.TabIndex = 9;
this.btnExit.Text = "退 出";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnEduce
//
this.btnEduce.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnEduce.Enabled = false;
this.btnEduce.Location = new System.Drawing.Point(752, 24);
this.btnEduce.Name = "btnEduce";
this.btnEduce.Size = new System.Drawing.Size(144, 56);
this.btnEduce.TabIndex = 4;
this.btnEduce.Text = "导出到 Excel 报表";
this.btnEduce.Click += new System.EventHandler(this.btnEduce_Click);
//
// btnHelp
//
this.btnHelp.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnHelp.Location = new System.Drawing.Point(936, 56);
this.btnHelp.Name = "btnHelp";
this.btnHelp.Size = new System.Drawing.Size(64, 23);
this.btnHelp.TabIndex = 5;
this.btnHelp.TabStop = false;
this.btnHelp.Text = "帮 助";
this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
//
// btnAbout
//
this.btnAbout.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnAbout.Location = new System.Drawing.Point(936, 24);
this.btnAbout.Name = "btnAbout";
this.btnAbout.Size = new System.Drawing.Size(64, 23);
this.btnAbout.TabIndex = 4;
this.btnAbout.TabStop = false;
this.btnAbout.Text = "关 于";
this.btnAbout.Click += new System.EventHandler(this.btnAbout_Click);
//
// btnSearch
//
this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSearch.Location = new System.Drawing.Point(584, 24);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(128, 56);
this.btnSearch.TabIndex = 3;
this.btnSearch.Text = "查 询 课 题";
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// btnUpdate
//
this.btnUpdate.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnUpdate.Enabled = false;
this.btnUpdate.Location = new System.Drawing.Point(432, 24);
this.btnUpdate.Name = "btnUpdate";
this.btnUpdate.Size = new System.Drawing.Size(128, 56);
this.btnUpdate.TabIndex = 2;
this.btnUpdate.Text = "修 改 课 题";
this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
//
// btnDelete
//
this.btnDelete.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnDelete.Enabled = false;
this.btnDelete.Location = new System.Drawing.Point(280, 24);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(128, 56);
this.btnDelete.TabIndex = 1;
this.btnDelete.Text = "删 除 课 题";
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// btnAdd
//
this.btnAdd.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnAdd.Location = new System.Drawing.Point(128, 24);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(128, 56);
this.btnAdd.TabIndex = 0;
this.btnAdd.Text = "添 加 课 题";
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// dataGrid
//
this.dataGrid.BackgroundColor = System.Drawing.Color.White;
this.dataGrid.CaptionBackColor = System.Drawing.Color.Lavender;
this.dataGrid.DataMember = "";
this.dataGrid.DataSource = this.tTask;
this.dataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid.Location = new System.Drawing.Point(100, 100);
this.dataGrid.Name = "dataGrid";
this.dataGrid.RowHeaderWidth = 30;
this.dataGrid.Size = new System.Drawing.Size(924, 597);
this.dataGrid.TabIndex = 10;
this.dataGrid.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] {
this.tableStyle});
this.dataGrid.TabStop = false;
this.dataGrid.CurrentCellChanged += new System.EventHandler(this.dataGrid_CurrentCellChanged);
//
// tTask
//
this.tTask.Columns.AddRange(new System.Data.DataColumn[] {
this.cTaskID,
this.cSortCo,
this.cLevelCo,
this.cYear,
this.cSerial,
this.cTaskCo,
this.cTaskNa,
this.cCollegeCo,
this.cCollegeNa,
this.cMemberName,
this.cStartDate,
this.cPlanDate,
this.cEndDate,
this.cStandardMoney,
this.cAlreadyMoney,
this.cSurplusMoney,
this.cTel,
this.cEmail,
this.cRemark,
this.cSortPY,
this.cLevelPY,
this.cMainMember,
this.cMember1,
this.cMember2,
this.cMember3,
this.cMember4,
this.cMember5});
this.tTask.Constraints.AddRange(new System.Data.Constraint[] {
new System.Data.UniqueConstraint("Constraint1", new string[] {
"课题ID"}, true)});
this.tTask.PrimaryKey = new System.Data.DataColumn[] {
this.cTaskID};
this.tTask.TableName = "课题表";
//
// cTaskID
//
this.cTaskID.AllowDBNull = false;
this.cTaskID.Caption = "课题ID";
this.cTaskID.ColumnMapping = System.Data.MappingType.Hidden;
this.cTaskID.ColumnName = "课题ID";
this.cTaskID.DataType = typeof(object);
this.cTaskID.ReadOnly = true;
//
// cSortCo
//
this.cSortCo.ColumnMapping = System.Data.MappingType.Hidden;
this.cSortCo.ColumnName = "分类编号";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -