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

📄 dealcourse.cs

📁 排课系统
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
namespace PK
{
	/// <summary>
	/// dealCourse 的摘要说明。
	/// </summary>
	/// 
	public class dealCourse:Connection
	{
		private SqlConnection connConnection;
		public SqlConnection getConnection
		{
			get
			{
				return new SqlConnection(this.getConnectionString);
			}
			set
			{
			}
		}
		public dealCourse()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		public void Open()
		{
			connConnection = this.getConnection;
			connConnection.Open();
		}
		public void Close()
		{
			connConnection.Close();
		}
		public bool AddCourseInfo(string courseNo,string courseName,string studyClassNo,int studentNum,int weekCent,string teacherNo)
		{
			SqlCommand command = new SqlCommand("addCourse",this.connConnection);
			command.CommandType = CommandType.StoredProcedure;
			SqlParameter CourseNo = new SqlParameter("@courseNo",SqlDbType.VarChar,20);
			CourseNo.Value = courseNo;
			command.Parameters.Add(CourseNo);
			SqlParameter TeacherNo = new SqlParameter("@teacherNo",SqlDbType.VarChar,20);
			TeacherNo.Value = teacherNo;
			command.Parameters.Add(TeacherNo);
			SqlParameter WeekCent = new SqlParameter("@weekCent",SqlDbType.Int,4);
			WeekCent.Value = weekCent;
			command.Parameters.Add(WeekCent);
			SqlParameter CourseName = new SqlParameter("@courseName",SqlDbType.VarChar,20);
            CourseName.Value = courseName;
			command.Parameters.Add(CourseName);
			SqlParameter StudentNum = new SqlParameter("@studentNum",SqlDbType.Int,4);
			StudentNum.Value = studentNum;
			command.Parameters.Add(StudentNum);
			SqlParameter StudyClassNo = new SqlParameter("@studyClassNo",SqlDbType.VarChar,20);
			StudyClassNo.Value = studyClassNo;
			command.Parameters.Add(StudyClassNo);
			try
			{
				command.ExecuteNonQuery();
				return true;
			}
			catch
			{
				return false;
			}
		}
		public bool DeleteCourseInfo(string courseNo)
		{
			SqlCommand command = new SqlCommand("deleteCourse",this.connConnection);
			command.CommandType = CommandType.StoredProcedure;
			SqlParameter CourseNo = new SqlParameter("@courseNo",SqlDbType.VarChar,20);
			CourseNo.Value = courseNo;
			command.Parameters.Add(CourseNo);
			try
			{
				command.ExecuteNonQuery();
				return true;
			}
			catch
			{
				return false;
			}
		}
		public bool InsertCourseInfo(string classNo,string classTime,string courseNo,string studyClassNo)
		{
			SqlCommand command = new SqlCommand("insertCourseInfo",this.connConnection);
			command.CommandType = CommandType.StoredProcedure;
			SqlParameter ClassNo = new SqlParameter("@classNo",SqlDbType.VarChar,20);
			ClassNo.Value = classNo;
			command.Parameters.Add(ClassNo);
			SqlParameter ClassTime = new SqlParameter("@classTime",SqlDbType.VarChar,20);
			ClassTime.Value = classTime;
			command.Parameters.Add(ClassTime);
			SqlParameter CourseNo = new SqlParameter("@courseNo",SqlDbType.VarChar,20);
			CourseNo.Value =  courseNo;
			command.Parameters.Add( CourseNo);
			SqlParameter StudyClassNo = new SqlParameter("@studyClassNo ",SqlDbType.VarChar,20);
			StudyClassNo .Value = studyClassNo ;
			command.Parameters.Add(StudyClassNo);
			try
			{
				command.ExecuteNonQuery();
				return true;
			}
			catch
			{
				return false;
			}
		}
	}
}

⌨️ 快捷键说明

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