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

📄 frmeditpro.cs

📁 一个学籍管理系统 以在某高校投入使用了
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace prjClass
{
	/// <summary>
	/// frmEditPro 的摘要说明。
	/// </summary>
	/// 
	public delegate void EditCoursehandler();
	public class frmEditPro : System.Windows.Forms.Form
	{
		private Class1 c = new Class1();
		public event EditCoursehandler EditCourseEvent;
		private CourseInfo course;
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox txtClass;
		private System.Windows.Forms.TextBox txtSeme;
		private System.Windows.Forms.TextBox txtCoruse;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmEditPro(CourseInfo course)
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			this.course=course;

			//
			// 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.btnOK = new System.Windows.Forms.Button();
			this.button1 = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.txtClass = new System.Windows.Forms.TextBox();
			this.txtSeme = new System.Windows.Forms.TextBox();
			this.txtCoruse = new System.Windows.Forms.TextBox();
			this.SuspendLayout();
			// 
			// btnOK
			// 
			this.btnOK.Location = new System.Drawing.Point(80, 208);
			this.btnOK.Name = "btnOK";
			this.btnOK.TabIndex = 0;
			this.btnOK.Text = "确定";
			this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(240, 208);
			this.button1.Name = "button1";
			this.button1.TabIndex = 1;
			this.button1.Text = "取消";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(144, 16);
			this.label1.Name = "label1";
			this.label1.TabIndex = 2;
			this.label1.Text = "修改班级课程";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(48, 56);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(56, 23);
			this.label2.TabIndex = 3;
			this.label2.Text = "班级";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(48, 112);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(56, 23);
			this.label3.TabIndex = 4;
			this.label3.Text = "学期";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(32, 168);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(72, 23);
			this.label4.TabIndex = 5;
			this.label4.Text = "课程名称";
			// 
			// txtClass
			// 
			this.txtClass.Location = new System.Drawing.Point(104, 56);
			this.txtClass.Name = "txtClass";
			this.txtClass.Size = new System.Drawing.Size(208, 21);
			this.txtClass.TabIndex = 6;
			this.txtClass.Text = "";
			// 
			// txtSeme
			// 
			this.txtSeme.Location = new System.Drawing.Point(104, 112);
			this.txtSeme.Name = "txtSeme";
			this.txtSeme.Size = new System.Drawing.Size(208, 21);
			this.txtSeme.TabIndex = 7;
			this.txtSeme.Text = "";
			// 
			// txtCoruse
			// 
			this.txtCoruse.Location = new System.Drawing.Point(104, 168);
			this.txtCoruse.Name = "txtCoruse";
			this.txtCoruse.Size = new System.Drawing.Size(208, 21);
			this.txtCoruse.TabIndex = 8;
			this.txtCoruse.Text = "";
			// 
			// frmEditPro
			// 
			this.AcceptButton = this.btnOK;
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(394, 267);
			this.Controls.Add(this.txtCoruse);
			this.Controls.Add(this.txtSeme);
			this.Controls.Add(this.txtClass);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.btnOK);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.Name = "frmEditPro";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "frmEditPro";
			this.Load += new System.EventHandler(this.frmEditPro_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void frmEditPro_Load(object sender, System.EventArgs e)
		{
			string className;
			string Sql = "select ClassName from Class..ClassInfo where ClassID = "+this.course.ClassID+"";
			className = c.getData(Sql,0);
			this.txtClass.Enabled=false;
			this.txtSeme.Enabled=false;
			this.txtSeme.Text=this.course.Seme;
			this.txtClass.Text=className;
			this.txtCoruse.Text=this.course.Course;
		}

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

		private void btnOK_Click(object sender, System.EventArgs e)
		{
			string Sql = "select * from Class..CourseInfo where ClassID = "+this.course.ClassID+" and Course = '"+this.txtCoruse.Text+"' and Semester = '"+this.txtSeme.Text
				+"' and CourseID <> "+this.course.CourseID+"";
			if(c.IsExits(Sql)==true)
			{
				MessageBox.Show("在同一班级同一学期不能添加相同课程!","提示信息!",MessageBoxButtons.OK,MessageBoxIcon.Question);
			}
			else
			{
				string Sql1 = "update Class..CourseInfo set Course = '"+this.txtCoruse.Text+"' where CourseID = "+this.course.CourseID+"";
				c.EditData(Sql1);
				if(this.EditCourseEvent!=null)
				{
					this.EditCourseEvent();
				}
				this.Close();
			}
		}
	}
}

⌨️ 快捷键说明

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