?? classdb.cs
字號:
using System;
using System.Data;
using System.Data.SqlClient;
using Park.Common;
namespace Park.Common
{
/// <summary>
/// ClassDB 的摘要說明。
/// </summary>
public class ClassDB
{
public static void DeleteClass(string classid)
{
SqlConnection myConnection=Utils.GetConnection();
SqlCommand myCommand = new SqlCommand("ClassSystem_Delete_Class", myConnection);
// Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure;
// Add Parameters to SPROC
SqlParameter ClassID = new SqlParameter("@id", SqlDbType.NVarChar, 20);
ClassID.Value = classid;
myCommand.Parameters.Add(ClassID);
// Execute the command
myConnection.Open();
myCommand.ExecuteNonQuery();
myCommand.Dispose();
myConnection.Dispose();
return ;
}
public static void GetClassStatus(string classid,out string classname,out string coursename,out string teachername, out string capicity, out DateTime endtime)
{
SqlConnection myConnection=Utils.GetConnection();
SqlCommand myCommand = new SqlCommand("ClassSystem_Get_ClassStatus", myConnection);
// Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure;
// Add Parameters to SPROC
SqlParameter ClassID = new SqlParameter("@id", SqlDbType.Int);
ClassID.Value = classid;
myCommand.Parameters.Add(ClassID);
// Add Parameters to SPROC
SqlParameter ClassName = new SqlParameter("@classname", SqlDbType.Char, 10);
ClassName.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(ClassName);
// Add Parameters to SPROC
SqlParameter CourseName = new SqlParameter("@coursename", SqlDbType.NVarChar, 20);
CourseName.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(CourseName);
// Add Parameters to SPROC
SqlParameter TeacherName = new SqlParameter("@teachername", SqlDbType.Char, 10);
TeacherName.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(TeacherName);
// Add Parameters to SPROC
SqlParameter Capicity = new SqlParameter("@capicity", SqlDbType.Int);
Capicity.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(Capicity);
// Add Parameters to SPROC
SqlParameter EndTime = new SqlParameter("@endtime", SqlDbType.SmallDateTime);
EndTime.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(EndTime);
// Execute the command
myConnection.Open();
myCommand.ExecuteNonQuery();
classname = ClassName.Value.ToString();
teachername = TeacherName.Value.ToString();
coursename = CourseName.Value.ToString();
capicity = Capicity.Value.ToString();
try
{
endtime = (DateTime)EndTime.Value;
}
catch(Exception)
{
endtime = DateTime.Now;
}
myCommand.Dispose();
myConnection.Dispose();
}
public static void ChangeClassStatus(string classid,string classname, int capicity, DateTime endtime)
{
SqlConnection myConnection=Utils.GetConnection();
SqlCommand myCommand = new SqlCommand("ClassSystem_Change_ClassStatus", myConnection);
// Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure;
// Add Parameters to SPROC
SqlParameter ClassID = new SqlParameter("@id", SqlDbType.Int);
ClassID.Value = classid;
myCommand.Parameters.Add(ClassID);
// Add Parameters to SPROC
SqlParameter ClassName = new SqlParameter("@classname", SqlDbType.Char, 10);
ClassName.Value = classname ;
myCommand.Parameters.Add(ClassName);
// Add Parameters to SPROC
SqlParameter Capicity = new SqlParameter("@capicity", SqlDbType.Int);
Capicity.Value = capicity;
myCommand.Parameters.Add(Capicity);
// Add Parameters to SPROC
SqlParameter EndTime = new SqlParameter("@endtime", SqlDbType.SmallDateTime);
EndTime.Value = endtime;
myCommand.Parameters.Add(EndTime);
// Execute the command
myConnection.Open();
myCommand.ExecuteNonQuery();
myCommand.Dispose();
myConnection.Dispose();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -