📄 statusmanage.cs
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Text;
namespace StudentManager.BusinessRule
{
class StatusManage
{
private SqlConnection conn1 = null;
private string commandstr = null;
private SqlCommand Command1 = null;
public StatusManage()
{
conn1 = new SqlConnection(DataLevel.Connection.ConnString);
Command1 = new SqlCommand();
// this.Command1.CommandText = commandstr;
this.Command1.Connection = conn1;
// this.DataReader = Command1.ExecuteReader();
}
public bool Student_Move(string studentId, string department, string Class)
{
/* this.commandstr = "Update Student Set Dapartment='" + department + "',Class='" + Class + "'where StudentID='" + studentId + "'";
this.Command1.CommandText = this.commandstr;*/
this.commandstr = "update Student set Department='" + department + "',Class='" + Class + "' where StudentID='" + studentId + "'";
this.Command1.CommandText = this.commandstr;
try
{
if (conn1.State == ConnectionState.Closed)
conn1.Open();
this.Command1.ExecuteNonQuery();
return true;
}
catch (Exception E)
{
Console.WriteLine(E.ToString());
}
finally
{
this.conn1.Close();
}
return false;
}
public bool StuMove_Insert(string studentId, string originDep, string originCla, string PresentDep, string PresentCla, string date)
{
this.commandstr = "Insert into StudentMove(StudentID,OriginDep,OriginClass,PresentDep,PresentClass,Date) values('" + studentId + "','" + originDep + "','" + originCla + "','" + PresentDep + "','" + PresentCla + "','" + date + "')";
this.Command1.CommandText = this.commandstr;
try
{
if (this.conn1.State == ConnectionState.Closed)
this.conn1.Open();
this.Command1.ExecuteNonQuery();
return true;
}
catch (Exception E)
{
Console.WriteLine(E.ToString());
}
finally
{
this.conn1.Close();
}
return false;
}
public bool student_leave(string studentID)
{
this.commandstr = "delete from Student where StudentID = '" + studentID + "'";
this.Command1.CommandText = this.commandstr;
try
{
if (conn1.State == ConnectionState.Closed)
conn1.Open();
this.Command1.ExecuteNonQuery();
return true;
}
catch (Exception E)
{
Console.WriteLine(E.ToString());
}
finally
{
this.conn1.Close();
}
return false;
}
public bool studentleave_Insert(string studentId, string department, string Class, string leavetype, string date)
{
this.commandstr = "Insert into StudentLeave(StudentID,Department,Class,LeaveType,Date) values('" + studentId + "','" + department + "','" + Class + "','" + leavetype + "','" + date + "')";
// this.commandstr = "Insert StudentLeave(StudentID,Department,Class,LeaveType,Date) values('" + studentId + "','" + department + "','" + Class + "','" + leavetype + "','" + date + "')";
this.Command1.CommandText = this.commandstr;
try
{
if (this.conn1.State == ConnectionState.Closed)
conn1.Open();
this.Command1.ExecuteNonQuery();
return true;
}
catch (Exception E)
{
Console.WriteLine(E.ToString());
}
finally
{
this.conn1.Close();
}
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -