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

📄 examitemman.cs

📁 网络考试系统 系统基于 .NET 框架开发
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

using System.Data;
using System.Data.OleDb;

namespace ExamSystem
{
	/// <summary>
	/// ExamItemMan 的摘要说明。
	/// </summary>
	public class ExamItemMan : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.ColumnHeader qStr;
		private System.Windows.Forms.ColumnHeader state;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.ComboBox examType;
		private System.Windows.Forms.TextBox q;
		private System.Windows.Forms.TextBox a;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.ComboBox et;
		private System.Windows.Forms.RadioButton fen10;
		private System.Windows.Forms.RadioButton fen20;
		private System.Windows.Forms.RadioButton fen30;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button button3;
		private System.Windows.Forms.Button button4;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.ColumnHeader etStr;
		private System.Windows.Forms.ColumnHeader fenType;
		private OleDbConnection       conn = null;
		private System.Windows.Forms.ListView listView;
		private System.Windows.Forms.ContextMenu cm;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItem3;
		private System.Windows.Forms.MenuItem menuItem4;
		private System.Windows.Forms.MenuItem menuItem5;
		private string                eID  = "";

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

			conn                        = new OleDbConnection(Config.connStr);
			this.examType.SelectedIndex = 0;
			this.et.SelectedIndex       = 0;
			this.DataBinder();
		}

		//
		private void DataBinder(){
			this.listView.Items.Clear();
			string sql = "select * from ExamItem where examType = '"+ this.examType.Text +"'";
			this.conn.Open();
			OleDbDataAdapter odp = new OleDbDataAdapter(sql,conn);
			DataSet ds = new DataSet();
			odp.Fill(ds,"ExamItem");

			for(int i=0;i<ds.Tables[0].Rows.Count;i++){
				DataRow row = ds.Tables[0].Rows[i];
				string[] values = new string[4];
				values[0] = row["qStr"].ToString();
				values[1] = row["examType"].ToString();
				values[2] = row["fenType"].ToString();
				values[3] = row["state"].ToString();

				ListViewItem lvi = new ListViewItem(values);
				lvi.Tag          = row["eID"].ToString();
				this.listView.Items.Add(lvi);

			}

			this.conn.Close();
		}

		/// <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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ExamItemMan));
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.label2 = new System.Windows.Forms.Label();
			this.examType = new System.Windows.Forms.ComboBox();
			this.listView = new System.Windows.Forms.ListView();
			this.qStr = new System.Windows.Forms.ColumnHeader();
			this.etStr = new System.Windows.Forms.ColumnHeader();
			this.fenType = new System.Windows.Forms.ColumnHeader();
			this.state = new System.Windows.Forms.ColumnHeader();
			this.cm = new System.Windows.Forms.ContextMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.menuItem4 = new System.Windows.Forms.MenuItem();
			this.menuItem5 = new System.Windows.Forms.MenuItem();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.fen30 = new System.Windows.Forms.RadioButton();
			this.fen20 = new System.Windows.Forms.RadioButton();
			this.fen10 = new System.Windows.Forms.RadioButton();
			this.et = new System.Windows.Forms.ComboBox();
			this.label4 = new System.Windows.Forms.Label();
			this.a = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.q = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.button3 = new System.Windows.Forms.Button();
			this.button4 = new System.Windows.Forms.Button();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.examType);
			this.groupBox1.Controls.Add(this.listView);
			this.groupBox1.Location = new System.Drawing.Point(8, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(760, 304);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "题库列表";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(464, 24);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(92, 16);
			this.label2.TabIndex = 2;
			this.label2.Text = "请选择题库类型";
			// 
			// examType
			// 
			this.examType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.examType.Items.AddRange(new object[] {
														  "必考题",
														  "抢答题",
														  "自选题"});
			this.examType.Location = new System.Drawing.Point(560, 16);
			this.examType.Name = "examType";
			this.examType.Size = new System.Drawing.Size(192, 20);
			this.examType.TabIndex = 1;
			this.examType.SelectedIndexChanged += new System.EventHandler(this.examType_SelectedIndexChanged);
			// 
			// listView
			// 
			this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																					   this.qStr,
																					   this.etStr,
																					   this.fenType,
																					   this.state});
			this.listView.ContextMenu = this.cm;
			this.listView.FullRowSelect = true;
			this.listView.Location = new System.Drawing.Point(8, 40);
			this.listView.Name = "listView";
			this.listView.Size = new System.Drawing.Size(744, 256);
			this.listView.TabIndex = 0;
			this.listView.View = System.Windows.Forms.View.Details;
			this.listView.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged);
			// 
			// qStr
			// 
			this.qStr.Text = "问题";
			this.qStr.Width = 400;
			// 
			// etStr
			// 
			this.etStr.Text = "类别";
			this.etStr.Width = 100;
			// 
			// fenType
			// 
			this.fenType.Text = "分数类别";
			this.fenType.Width = 100;
			// 
			// state
			// 
			this.state.Text = "状态";
			// 
			// cm
			// 
			this.cm.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																			   this.menuItem1,
																			   this.menuItem2,
																			   this.menuItem3,
																			   this.menuItem4,
																			   this.menuItem5});
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.Text = "新增试题";
			this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 1;
			this.menuItem2.Text = "修改";
			this.menuItem2.Visible = false;
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 2;
			this.menuItem3.Text = "删除";
			this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
			// 
			// menuItem4
			// 
			this.menuItem4.Index = 3;
			this.menuItem4.Text = "-";
			// 
			// menuItem5
			// 
			this.menuItem5.Index = 4;
			this.menuItem5.Text = "刷新列表";
			this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.textBox1);
			this.groupBox2.Controls.Add(this.label5);
			this.groupBox2.Controls.Add(this.fen30);
			this.groupBox2.Controls.Add(this.fen20);
			this.groupBox2.Controls.Add(this.fen10);
			this.groupBox2.Controls.Add(this.et);
			this.groupBox2.Controls.Add(this.label4);
			this.groupBox2.Controls.Add(this.a);
			this.groupBox2.Controls.Add(this.label3);
			this.groupBox2.Controls.Add(this.q);
			this.groupBox2.Controls.Add(this.label1);
			this.groupBox2.Location = new System.Drawing.Point(8, 320);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(760, 184);
			this.groupBox2.TabIndex = 1;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "新建试题";
			// 
			// textBox1
			// 
			this.textBox1.Enabled = false;
			this.textBox1.Location = new System.Drawing.Point(632, 152);
			this.textBox1.Multiline = true;
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(120, 24);
			this.textBox1.TabIndex = 11;
			this.textBox1.Text = "可用";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(568, 160);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(56, 16);
			this.label5.TabIndex = 10;
			this.label5.Text = "当前状态";
			// 
			// fen30
			// 
			this.fen30.Enabled = false;
			this.fen30.Location = new System.Drawing.Point(320, 152);
			this.fen30.Name = "fen30";
			this.fen30.Size = new System.Drawing.Size(64, 24);
			this.fen30.TabIndex = 9;
			this.fen30.Text = "30分题";
			// 
			// fen20
			// 
			this.fen20.Enabled = false;
			this.fen20.Location = new System.Drawing.Point(256, 152);
			this.fen20.Name = "fen20";
			this.fen20.Size = new System.Drawing.Size(64, 24);
			this.fen20.TabIndex = 8;
			this.fen20.Text = "20分题";
			// 
			// fen10
			// 
			this.fen10.Checked = true;
			this.fen10.Enabled = false;
			this.fen10.Location = new System.Drawing.Point(192, 152);
			this.fen10.Name = "fen10";
			this.fen10.Size = new System.Drawing.Size(64, 24);
			this.fen10.TabIndex = 7;
			this.fen10.TabStop = true;

⌨️ 快捷键说明

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