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

📄 statusmanage.cs

📁 c#写图书管理系统 界面美观 功能齐全 配有完整的数据库
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using StudentManage.DataLevel;

namespace StudentManage.BussinessRule
{
	/// <summary>
	/// StatusManage 的摘要说明。
	/// </summary>
	public class StatusManage
	{
		private string selectStr;
		private SqlConnection Connection1=null;
		private SqlCommand  Command1=null;
		private SqlDataReader DataReader1=null;
										


		public StatusManage()
		{			
			this.Connection1=new SqlConnection(DataLevel.Connection.ConnString);
			this.Command1=new SqlCommand();		
			this.Command1.Connection=this.Connection1;									
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		
		public bool Student_Move(string studentId, string department,string Class)
		{
			this.selectStr="update Student set Department='"+department+"',Class='"+Class+"' where StudentID='"+studentId+"'"; 
			this.Command1.CommandText=this.selectStr;
			try
			{
				if(this.Connection1.State==ConnectionState.Closed)
					this.Connection1.Open();										
				this.Command1.ExecuteNonQuery();									
				return true;
				
			}
			catch(Exception E)
			{
				Console.WriteLine(E.ToString());
				
			}
			finally
			{				
				this.Connection1.Close();	
			}	
			return false;
		}

		public bool StuMove_Insert(string studentId,string originDep,string originCla,string PresentDep,string PresentCla,string date)
		{
			this.selectStr="Insert into StudentMove(StudentID,OriginDep,OriginClass,PresentDep,PresentClass,Date) values('"+studentId+"','"+originDep+"','"+originCla+"','"+PresentDep+"','"+PresentCla+"','"+date+"')";
			this.Command1.CommandText=this.selectStr;
			try
			{
				if(this.Connection1.State==ConnectionState.Closed)
					this.Connection1.Open();										
				this.Command1.ExecuteNonQuery();	
				return true;
				
			}
			catch(Exception E)
			{
				Console.WriteLine(E.ToString());				
			}
			finally
			{				
				this.Connection1.Close();	
			}
			return false;

		}

		public bool StuLeave_Insert(string studentId,string department,string Class,string leavetype,string date)
		{
			this.selectStr="Insert StudentLeave(StudentID,Department,Class,LeaveType,Date) values('"+studentId+"','"+department+"','"+Class+"','"+leavetype+"','"+date+"')";
			this.Command1.CommandText=this.selectStr;
			try
			{
				if(this.Connection1.State==ConnectionState.Closed)
					this.Connection1.Open();										
				this.Command1.ExecuteNonQuery();		
				return true;				
			}
			catch(Exception E)
			{
				Console.WriteLine(E.ToString());;
			}
			finally
			{				
				this.Connection1.Close();	
			}
			return false;
		}

		public bool StuLeave(string studentId)
		{
			this.selectStr="delete from  Student where StudentID='"+studentId+"'"; 
			this.Command1.CommandText=this.selectStr;
			try
			{
				if(this.Connection1.State==ConnectionState.Closed)
					this.Connection1.Open();										
				this.Command1.ExecuteNonQuery();						
				return true;				
			}
			catch(Exception E)
			{
				Console.WriteLine(E.ToString());;
			}
			finally
			{				
				this.Connection1.Close();	
			}	
			return false;
		}

	}
}

⌨️ 快捷键说明

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