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

📄 frmtopics.cs

📁 考试管理系统CS架构 不需更多说明
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using TeachersClient.TopicsFrm;
using ExamSystem.BusinessFacade.TeacherFac;
using ExamSystem.BusinessFacade.TopicsFacade;
using System.Data;
using ExamSystem.Common;
namespace TeachersClient
{
	/// <summary>
	/// TopicsFrm 的摘要说明。
	/// </summary>
	public class FrmTopics : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Panel panBtn;
		private System.Windows.Forms.Panel panel2;
		private System.Windows.Forms.Panel panel3;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.RichTextBox rtbTitle;
		private System.Windows.Forms.Panel panSearch;
		private System.Windows.Forms.Panel panel1;
		private System.Windows.Forms.Splitter splitter1;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Button btnShow;
		private System.Windows.Forms.GroupBox gpSearch;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.Panel panel4;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Panel panel5;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Panel panel6;
		private System.Windows.Forms.Panel panel7;
		private System.Windows.Forms.Panel panButtom;
		private System.Windows.Forms.Panel panel8;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.CheckBox chkSearchType;
		private System.Windows.Forms.ComboBox cmbCate;
		private System.Windows.Forms.ComboBox cmbSearchCate;
		private System.Windows.Forms.RichTextBox rtbSearchTitle;
		private System.Windows.Forms.Panel panel9;
		private ExamSystem.Common.DataListView dlvTopics;
		private System.Windows.Forms.NumericUpDown nudLevel;
		private System.Windows.Forms.NumericUpDown nudAnwsers;
		private System.Windows.Forms.CheckedListBox clbAnwser;
		private System.Windows.Forms.Button btnDel;
		private System.Windows.Forms.Button btnUpdate;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;
		
		private void fillSearch()
		{
			SearchType type=SearchType.Accurate;
			if(this.chkSearchType.Checked)
			{
				type=SearchType.Fuzzy;
			}
			TopicsFac topFac=new TopicsFac();
			int cateID=(int)this.cmbSearchCate.SelectedValue;
			DataSet ds=topFac.getTopicByAnd(-1,this.rtbSearchTitle.Text,"",-1,cateID,-1,type);
			fillList(ds);
		}
		
		private void fillList(DataSet ds)
		{
			dlvTopics.BindTable=ds.Tables[0];
			dlvTopics.Columns[2].Text="题目";
			dlvTopics.Columns[6].Text="难度";
//			dlvTopics.Columns[1].Width=-1;
//			dlvTopics.Columns[3].Width=-1;
//			dlvTopics.Columns[4].Width=-1;
//			dlvTopics.Columns[5].Width=-1;
			dlvTopics.Columns.RemoveAt(5);
			dlvTopics.Columns.RemoveAt(4);
			dlvTopics.Columns.RemoveAt(3);
			dlvTopics.Columns.RemoveAt(1);
			dlvTopics.AutoColumnsWidth=true;
		}

		private void fillSelector()
		{
			CateFac cateFac=new CateFac();
			DataSet ds=cateFac.getCate(-1,"",-1);
			fillSearchCate(ds);
			fillCate(ds);
		}
		private void fillSearchCate(DataSet ds)
		{
			DataSet dsTmp=ds.Copy();
			DataRow dr=dsTmp.Tables[0].NewRow();
			dr["CateID"]=-1;
			dr["CateName"]="不限";
			dr["GradeID"]=-1;
			dsTmp.Tables[0].Rows.InsertAt(dr,0);

			DataView dv=dsTmp.Tables[0].DefaultView;
			dv.RowFilter="CateID<>0";
			cmbSearchCate.DataSource=dv;
			cmbSearchCate.DisplayMember="CateName";
			cmbSearchCate.ValueMember="CateID";
		}
		private void fillCate(DataSet ds)
		{
			DataView dv=ds.Tables[0].DefaultView;
			dv.RowFilter="CateID<>0";
			cmbCate.DataSource=dv;
			cmbCate.DisplayMember="CateName";
			cmbCate.ValueMember="CateID";
		}

		private void enText(bool en)
		{
			rtbTitle.Enabled=en;
			nudAnwsers.Enabled=en;
			nudLevel.Enabled=en;
			cmbCate.Enabled=en;
			btnDel.Enabled=en;
			btnUpdate.Enabled=en;
		}
		
		private void clearText()
		{
			rtbTitle.Text="";
			nudAnwsers.Value=3;
			nudLevel.Value=nudLevel.Minimum;
		}

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

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <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.panBtn = new System.Windows.Forms.Panel();
			this.btnShow = new System.Windows.Forms.Button();
			this.panel2 = new System.Windows.Forms.Panel();
			this.panel3 = new System.Windows.Forms.Panel();
			this.splitter1 = new System.Windows.Forms.Splitter();
			this.panel1 = new System.Windows.Forms.Panel();
			this.panButtom = new System.Windows.Forms.Panel();
			this.panel8 = new System.Windows.Forms.Panel();
			this.btnDel = new System.Windows.Forms.Button();
			this.btnUpdate = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.cmbCate = new System.Windows.Forms.ComboBox();
			this.label6 = new System.Windows.Forms.Label();
			this.nudLevel = new System.Windows.Forms.NumericUpDown();
			this.label4 = new System.Windows.Forms.Label();
			this.nudAnwsers = new System.Windows.Forms.NumericUpDown();
			this.label3 = new System.Windows.Forms.Label();
			this.clbAnwser = new System.Windows.Forms.CheckedListBox();
			this.label2 = new System.Windows.Forms.Label();
			this.rtbTitle = new System.Windows.Forms.RichTextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.panSearch = new System.Windows.Forms.Panel();
			this.panel5 = new System.Windows.Forms.Panel();
			this.button1 = new System.Windows.Forms.Button();
			this.gpSearch = new System.Windows.Forms.GroupBox();
			this.panel6 = new System.Windows.Forms.Panel();
			this.rtbSearchTitle = new System.Windows.Forms.RichTextBox();
			this.panel4 = new System.Windows.Forms.Panel();
			this.chkSearchType = new System.Windows.Forms.CheckBox();
			this.cmbSearchCate = new System.Windows.Forms.ComboBox();
			this.label7 = new System.Windows.Forms.Label();
			this.label9 = new System.Windows.Forms.Label();
			this.panel7 = new System.Windows.Forms.Panel();
			this.panel9 = new System.Windows.Forms.Panel();
			this.dlvTopics = new ExamSystem.Common.DataListView();
			this.panBtn.SuspendLayout();
			this.panel2.SuspendLayout();
			this.panel3.SuspendLayout();
			this.panel1.SuspendLayout();
			this.panButtom.SuspendLayout();
			this.panel8.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.nudLevel)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.nudAnwsers)).BeginInit();
			this.panSearch.SuspendLayout();
			this.panel5.SuspendLayout();
			this.gpSearch.SuspendLayout();
			this.panel6.SuspendLayout();
			this.panel4.SuspendLayout();
			this.panel7.SuspendLayout();
			this.panel9.SuspendLayout();
			this.SuspendLayout();
			// 
			// panBtn
			// 
			this.panBtn.Controls.Add(this.btnShow);
			this.panBtn.Dock = System.Windows.Forms.DockStyle.Right;
			this.panBtn.Location = new System.Drawing.Point(688, 0);
			this.panBtn.Name = "panBtn";
			this.panBtn.Size = new System.Drawing.Size(14, 359);
			this.panBtn.TabIndex = 0;
			// 
			// btnShow
			// 
			this.btnShow.Dock = System.Windows.Forms.DockStyle.Fill;
			this.btnShow.Location = new System.Drawing.Point(0, 0);
			this.btnShow.Name = "btnShow";
			this.btnShow.Size = new System.Drawing.Size(14, 359);
			this.btnShow.TabIndex = 0;
			this.btnShow.Text = "<";
			this.btnShow.Click += new System.EventHandler(this.btnShow_Click);
			// 
			// panel2
			// 
			this.panel2.Controls.Add(this.panel3);
			this.panel2.Controls.Add(this.panSearch);
			this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
			this.panel2.Location = new System.Drawing.Point(172, 0);
			this.panel2.Name = "panel2";
			this.panel2.Size = new System.Drawing.Size(516, 359);
			this.panel2.TabIndex = 1;
			// 
			// panel3
			// 
			this.panel3.Controls.Add(this.splitter1);
			this.panel3.Controls.Add(this.panel1);
			this.panel3.Controls.Add(this.rtbTitle);
			this.panel3.Controls.Add(this.label1);
			this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
			this.panel3.Location = new System.Drawing.Point(0, 0);
			this.panel3.Name = "panel3";
			this.panel3.Size = new System.Drawing.Size(332, 359);
			this.panel3.TabIndex = 2;
			// 
			// splitter1
			// 
			this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.splitter1.Location = new System.Drawing.Point(0, 206);
			this.splitter1.Name = "splitter1";
			this.splitter1.Size = new System.Drawing.Size(332, 5);
			this.splitter1.TabIndex = 3;
			this.splitter1.TabStop = false;
			// 
			// panel1
			// 
			this.panel1.Controls.Add(this.panButtom);
			this.panel1.Controls.Add(this.cmbCate);
			this.panel1.Controls.Add(this.label6);
			this.panel1.Controls.Add(this.nudLevel);
			this.panel1.Controls.Add(this.label4);
			this.panel1.Controls.Add(this.nudAnwsers);
			this.panel1.Controls.Add(this.label3);
			this.panel1.Controls.Add(this.clbAnwser);
			this.panel1.Controls.Add(this.label2);
			this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.panel1.Location = new System.Drawing.Point(0, 211);
			this.panel1.Name = "panel1";
			this.panel1.Size = new System.Drawing.Size(332, 148);
			this.panel1.TabIndex = 2;
			// 
			// panButtom
			// 
			this.panButtom.Controls.Add(this.panel8);
			this.panButtom.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.panButtom.Location = new System.Drawing.Point(0, 110);
			this.panButtom.Name = "panButtom";
			this.panButtom.Size = new System.Drawing.Size(332, 38);
			this.panButtom.TabIndex = 10;
			// 
			// panel8
			// 
			this.panel8.Controls.Add(this.btnDel);
			this.panel8.Controls.Add(this.btnUpdate);
			this.panel8.Controls.Add(this.button2);
			this.panel8.Dock = System.Windows.Forms.DockStyle.Right;
			this.panel8.Location = new System.Drawing.Point(70, 0);
			this.panel8.Name = "panel8";
			this.panel8.Size = new System.Drawing.Size(262, 38);
			this.panel8.TabIndex = 0;
			// 
			// btnDel
			// 
			this.btnDel.Location = new System.Drawing.Point(180, 10);
			this.btnDel.Name = "btnDel";
			this.btnDel.Size = new System.Drawing.Size(70, 22);
			this.btnDel.TabIndex = 2;
			this.btnDel.Text = "删除";
			this.btnDel.Click += new System.EventHandler(this.button4_Click);
			// 
			// btnUpdate
			// 
			this.btnUpdate.Location = new System.Drawing.Point(95, 10);
			this.btnUpdate.Name = "btnUpdate";
			this.btnUpdate.Size = new System.Drawing.Size(70, 22);
			this.btnUpdate.TabIndex = 1;
			this.btnUpdate.Text = "修改";
			this.btnUpdate.Click += new System.EventHandler(this.button3_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(10, 10);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(70, 22);
			this.button2.TabIndex = 0;
			this.button2.Text = "新建";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// cmbCate
			// 
			this.cmbCate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cmbCate.Location = new System.Drawing.Point(224, 74);
			this.cmbCate.Name = "cmbCate";
			this.cmbCate.Size = new System.Drawing.Size(102, 20);
			this.cmbCate.TabIndex = 9;
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(168, 78);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(50, 16);
			this.label6.TabIndex = 8;
			this.label6.Text = "科目:";
			// 
			// nudLevel
			// 
			this.nudLevel.Location = new System.Drawing.Point(224, 44);
			this.nudLevel.Maximum = new System.Decimal(new int[] {
																	 5,
																	 0,
																	 0,
																	 0});
			this.nudLevel.Minimum = new System.Decimal(new int[] {
																	 1,
																	 0,
																	 0,
																	 0});
			this.nudLevel.Name = "nudLevel";
			this.nudLevel.Size = new System.Drawing.Size(56, 21);
			this.nudLevel.TabIndex = 5;
			this.nudLevel.Value = new System.Decimal(new int[] {
																   1,
																   0,
																   0,
																   0});
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(168, 46);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(42, 16);
			this.label4.TabIndex = 4;
			this.label4.Text = "难度:";
			// 
			// nudAnwsers
			// 
			this.nudAnwsers.Location = new System.Drawing.Point(224, 12);
			this.nudAnwsers.Maximum = new System.Decimal(new int[] {
																	   10,
																	   0,
																	   0,
																	   0});
			this.nudAnwsers.Minimum = new System.Decimal(new int[] {
																	   3,
																	   0,
																	   0,
																	   0});
			this.nudAnwsers.Name = "nudAnwsers";
			this.nudAnwsers.Size = new System.Drawing.Size(62, 21);
			this.nudAnwsers.TabIndex = 3;
			this.nudAnwsers.Value = new System.Decimal(new int[] {
																	 3,
																	 0,
																	 0,
																	 0});
			this.nudAnwsers.ValueChanged += new System.EventHandler(this.nudAnswers_ValueChanged);
			this.nudAnwsers.Leave += new System.EventHandler(this.nudAnswers_ValueChanged);
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(168, 16);
			this.label3.Name = "label3";

⌨️ 快捷键说明

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