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

📄 frmviewexamresult.cs

📁 本论文叙述了联机考试系统的现状以及C#语言的概况。重点介绍了联机考试系统的实现过程:包括系统分析、 系统调查、 数据流程分析、功能设计、 数据库设计、 系统物理配置方案、 系统实现、 系统测试和调试。
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace OES
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class frmViewExamResult : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnHelp;
		private System.Windows.Forms.Button btnClose;
		private System.Windows.Forms.ComboBox cboSubject;
		private System.Windows.Forms.Label lblSubject;
		private System.Windows.Forms.GroupBox grpSearch;
		private System.Windows.Forms.Button btnSearch;
		private System.Windows.Forms.DateTimePicker dtpDate;
		private System.Windows.Forms.Label lblDate;
		private System.Windows.Forms.Label lblUserName;
		private System.Windows.Forms.Label lblViewResult;
		private System.Windows.Forms.ComboBox cboUserName;
		private System.Windows.Forms.DataGrid dbgStudentDetails;
		
		private string [] searchValue;
		private Exam objExam;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmViewExamResult()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			
			searchValue = new string[4];
			objExam = new Exam();


			//
			// 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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmViewExamResult));
			this.cboSubject = new System.Windows.Forms.ComboBox();
			this.lblSubject = new System.Windows.Forms.Label();
			this.btnClose = new System.Windows.Forms.Button();
			this.btnHelp = new System.Windows.Forms.Button();
			this.btnSearch = new System.Windows.Forms.Button();
			this.dbgStudentDetails = new System.Windows.Forms.DataGrid();
			this.lblViewResult = new System.Windows.Forms.Label();
			this.dtpDate = new System.Windows.Forms.DateTimePicker();
			this.lblDate = new System.Windows.Forms.Label();
			this.lblUserName = new System.Windows.Forms.Label();
			this.grpSearch = new System.Windows.Forms.GroupBox();
			this.cboUserName = new System.Windows.Forms.ComboBox();
			((System.ComponentModel.ISupportInitialize)(this.dbgStudentDetails)).BeginInit();
			this.grpSearch.SuspendLayout();
			this.SuspendLayout();
			// 
			// cboSubject
			// 
			this.cboSubject.BackColor = System.Drawing.SystemColors.Info;
			this.cboSubject.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboSubject.Location = new System.Drawing.Point(64, 40);
			this.cboSubject.Name = "cboSubject";
			this.cboSubject.Size = new System.Drawing.Size(72, 25);
			this.cboSubject.TabIndex = 0;
			// 
			// lblSubject
			// 
			this.lblSubject.AutoSize = true;
			this.lblSubject.BackColor = System.Drawing.Color.Transparent;
			this.lblSubject.Font = new System.Drawing.Font("Century Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblSubject.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.lblSubject.Location = new System.Drawing.Point(128, 104);
			this.lblSubject.Name = "lblSubject";
			this.lblSubject.Size = new System.Drawing.Size(32, 18);
			this.lblSubject.TabIndex = 5;
			this.lblSubject.Text = "科目";
			this.lblSubject.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
			// 
			// btnClose
			// 
			this.btnClose.BackColor = System.Drawing.Color.Transparent;
			this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.btnClose.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnClose.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.btnClose.Location = new System.Drawing.Point(344, 392);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new System.Drawing.Size(80, 24);
			this.btnClose.TabIndex = 9;
			this.btnClose.Text = "关闭(&O)";
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// btnHelp
			// 
			this.btnHelp.BackColor = System.Drawing.Color.Transparent;
			this.btnHelp.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.btnHelp.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnHelp.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.btnHelp.Location = new System.Drawing.Point(576, 15);
			this.btnHelp.Name = "btnHelp";
			this.btnHelp.Size = new System.Drawing.Size(72, 24);
			this.btnHelp.TabIndex = 10;
			this.btnHelp.Text = "帮助(&H)";
			this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
			// 
			// btnSearch
			// 
			this.btnSearch.BackColor = System.Drawing.Color.Transparent;
			this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.btnSearch.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnSearch.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.btnSearch.Location = new System.Drawing.Point(560, 104);
			this.btnSearch.Name = "btnSearch";
			this.btnSearch.Size = new System.Drawing.Size(80, 24);
			this.btnSearch.TabIndex = 11;
			this.btnSearch.Text = "搜索(&S)";
			this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
			// 
			// dbgStudentDetails
			// 
			this.dbgStudentDetails.BackgroundColor = System.Drawing.Color.LightSteelBlue;
			this.dbgStudentDetails.DataMember = "";
			this.dbgStudentDetails.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dbgStudentDetails.Location = new System.Drawing.Point(120, 152);
			this.dbgStudentDetails.Name = "dbgStudentDetails";
			this.dbgStudentDetails.ReadOnly = true;
			this.dbgStudentDetails.Size = new System.Drawing.Size(528, 224);
			this.dbgStudentDetails.TabIndex = 6;
			// 
			// lblViewResult
			// 
			this.lblViewResult.AutoSize = true;
			this.lblViewResult.BackColor = System.Drawing.Color.Transparent;
			this.lblViewResult.Font = new System.Drawing.Font("Century Gothic", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblViewResult.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.lblViewResult.Location = new System.Drawing.Point(120, 8);
			this.lblViewResult.Name = "lblViewResult";
			this.lblViewResult.Size = new System.Drawing.Size(290, 39);
			this.lblViewResult.TabIndex = 8;
			this.lblViewResult.Text = "查  看  学  生  结  果";
			// 
			// dtpDate
			// 
			this.dtpDate.CustomFormat = "dd\'/\'MM\'/\'yyyy";
			this.dtpDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
			this.dtpDate.Location = new System.Drawing.Point(488, 104);
			this.dtpDate.Name = "dtpDate";
			this.dtpDate.Size = new System.Drawing.Size(80, 21);
			this.dtpDate.TabIndex = 27;
			this.dtpDate.Value = new System.DateTime(2004, 12, 7, 0, 0, 0, 0);
			// 
			// lblDate
			// 
			this.lblDate.AutoSize = true;
			this.lblDate.BackColor = System.Drawing.Color.Transparent;
			this.lblDate.Font = new System.Drawing.Font("Century Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblDate.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.lblDate.Location = new System.Drawing.Point(416, 104);
			this.lblDate.Name = "lblDate";
			this.lblDate.Size = new System.Drawing.Size(65, 18);
			this.lblDate.TabIndex = 29;
			this.lblDate.Text = "日期(>=)";
			this.lblDate.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
			// 
			// lblUserName
			// 
			this.lblUserName.AutoSize = true;
			this.lblUserName.BackColor = System.Drawing.Color.Transparent;
			this.lblUserName.Font = new System.Drawing.Font("Century Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblUserName.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.lblUserName.Location = new System.Drawing.Point(264, 104);
			this.lblUserName.Name = "lblUserName";
			this.lblUserName.Size = new System.Drawing.Size(45, 18);
			this.lblUserName.TabIndex = 30;
			this.lblUserName.Text = "用户名";
			this.lblUserName.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
			// 
			// grpSearch
			// 
			this.grpSearch.BackColor = System.Drawing.Color.Transparent;
			this.grpSearch.Controls.Add(this.cboUserName);
			this.grpSearch.Controls.Add(this.cboSubject);
			this.grpSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.grpSearch.Font = new System.Drawing.Font("Century Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.grpSearch.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.grpSearch.Location = new System.Drawing.Point(120, 64);
			this.grpSearch.Name = "grpSearch";
			this.grpSearch.Size = new System.Drawing.Size(528, 80);
			this.grpSearch.TabIndex = 31;
			this.grpSearch.TabStop = false;
			this.grpSearch.Text = "搜索结果";
			// 
			// cboUserName
			// 
			this.cboUserName.BackColor = System.Drawing.SystemColors.Info;
			this.cboUserName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboUserName.Location = new System.Drawing.Point(216, 40);
			this.cboUserName.Name = "cboUserName";
			this.cboUserName.Size = new System.Drawing.Size(72, 25);
			this.cboUserName.TabIndex = 32;
			// 
			// frmViewExamResult
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.ClientSize = new System.Drawing.Size(797, 484);
			this.ControlBox = false;
			this.Controls.Add(this.lblUserName);
			this.Controls.Add(this.lblDate);
			this.Controls.Add(this.dtpDate);
			this.Controls.Add(this.btnSearch);
			this.Controls.Add(this.btnHelp);
			this.Controls.Add(this.btnClose);
			this.Controls.Add(this.lblSubject);
			this.Controls.Add(this.dbgStudentDetails);
			this.Controls.Add(this.lblViewResult);
			this.Controls.Add(this.grpSearch);
			this.Font = new System.Drawing.Font("Times New Roman", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
			this.Location = new System.Drawing.Point(146, 115);
			this.Name = "frmViewExamResult";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
			this.Text = "Result";
			this.TopMost = true;
			this.Load += new System.EventHandler(this.frmViewExamResult_Load);
			((System.ComponentModel.ISupportInitialize)(this.dbgStudentDetails)).EndInit();
			this.grpSearch.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		//		[STAThread]
		//		static void Main() 
		//		{	f=new frmExamResult();
		//			Application.Run(f);
		//		}

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

		private void frmViewExamResult_Load(object sender, System.EventArgs e)
		{
			this.cboSubject.Items.Add("Java");
			this.cboSubject.Items.Add("C#");
			this.cboSubject.Items.Add("SQL Server");
			this.cboSubject.Items.Add("Html");
			
			searchValue[0]= "";
            searchValue[1]="Student";
			searchValue[2]="ALL_USER_BY_TYPE";
			searchValue[3]=string.Empty;
			//DataTable dt1= objExam.FetchExamResult(searchValue);
			User user = new User();
			DataTable dt1 = user.FetchRecords(searchValue);
			foreach( DataRow dr in dt1.Rows)
			{
				this.cboUserName.Items.Add(dr["UsrId"]);
			}

		}
		/// <summary>
		/// ///所添加的CODES
		/// </summary>
		void emptySearchValue()
		{
			for (int i = 0; i<searchValue.Length; i++)
				searchValue.SetValue(string.Empty, i);
		}
		///王文
		private void btnSearch_Click(object sender, System.EventArgs e)
		{
			/// ///所添加的CODES
			emptySearchValue();
			///
		    searchValue[0]=this.cboSubject.Text;
			searchValue[1]=this.cboUserName.Text;
			searchValue[2]=this.dtpDate.Value.ToString("dd/MM/yyyy");

            searchValue[3]="examsresult";

			DataTable dt2=objExam.FetchExamDetails(searchValue);
			if(dt2.Rows.Count==0)
			{
//	删除			MessageBox.Show("No Records Found");
				this.dbgStudentDetails.DataSource=null;
			}
			else
			{
				this.dbgStudentDetails.DataSource=dt2;
			}
		}

		private void btnHelp_Click(object sender, System.EventArgs e)
		{
			Help.ShowHelp(this,Environment.CurrentDirectory +@"\\OES_Help\OES_Help.chm");
		}
	}
}

⌨️ 快捷键说明

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