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

📄 数据处理.cs

📁 射频卡读写程序,C#版
💻 CS
📖 第 1 页 / 共 2 页
字号:
			/// 学号:01171134
			/// 模块名:UpdataRule
			/// 功能:更新评分标准
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public bool UpdataRule(string course,string mark,string score)
			{
				System.Data.SqlClient.SqlCommand cmd=new System.Data.SqlClient.SqlCommand();
				cmd.CommandText = "update score SET score = score WHERE (item = '"+course+"') AND (mark = '"+mark+"')";
				cmd.Connection = this.Conn;
				Conn.Open();
				try
				{
					cmd.ExecuteNonQuery();
					return true;
				}
				catch(Exception e)
				{
					return false;
				}

				finally
				{
					Conn.Close();
				}
			}

			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:NewRule
			/// 功能:新的评分标准
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public bool NewRule(string course,string grade,string score)
			{
				System.Data.SqlClient.SqlCommand cmd=new System.Data.SqlClient.SqlCommand();
				cmd.CommandText = "INSERT INTO score  VALUES ('"+course+"','"+grade+"','"+score+"')";
				cmd.Connection = this.Conn;
				Conn.Open();
				try
				{
					cmd.ExecuteNonQuery();
					return true;
				}
				catch(Exception e)
				{
					return false;
				}

				finally
				{
					Conn.Close();
				}
			}

			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:GetCourseGrade
			/// 功能:获得成绩 根据科目查询
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public DataSet GetCourseGrade(string course)
			{
				try
				{
					System.Data.SqlClient.SqlCommand cmd=new System.Data.SqlClient.SqlCommand();
					cmd.CommandText = "select * from user_score where item = '"+course+"'" ;
					cmd.CommandType = System.Data.CommandType.Text;
					cmd.Connection = this.Conn;
					DataSet dst=new DataSet();
					System.Data.SqlClient.SqlDataAdapter sda=new System.Data.SqlClient.SqlDataAdapter();
					sda.SelectCommand=cmd;
					sda.Fill(dst);
					return dst;
				}
				catch{return null;}
			}

			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:GetAsCardNo
			/// 功能:获得成绩 根据卡号查询
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public DataSet GetAsCardNo(string cardno)
			{
				System.Data.SqlClient.SqlCommand cmd=new System.Data.SqlClient.SqlCommand();
				cmd.CommandText = "select user_score.* from user_score,user_table where user_score.userid=user_table.userid and user_table.cardno='"+cardno+"'";
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.Connection = this.Conn;
				DataSet dst=new DataSet();
				System.Data.SqlClient.SqlDataAdapter sda=new System.Data.SqlClient.SqlDataAdapter();
				sda.SelectCommand=cmd;
				sda.Fill(dst);
				return dst;
			}

			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:GetAsSno
			/// 功能:获得成绩 根据学号查询
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public DataSet GetAsSno(string sno)
			{
				try
				{
					System.Data.SqlClient.SqlCommand cmd=new System.Data.SqlClient.SqlCommand();
					cmd.CommandText = "select * from user_score where userid = '"+sno+"'" ;
					cmd.CommandType = System.Data.CommandType.Text;
					cmd.Connection = this.Conn;
					DataSet dst=new DataSet();
					System.Data.SqlClient.SqlDataAdapter sda=new System.Data.SqlClient.SqlDataAdapter();
					sda.SelectCommand=cmd;
					sda.Fill(dst);
					return dst;
				}catch{
					return null;}
			}

			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:NewCourse
			/// 功能:增加考核项目
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public bool NewCourse(string course,int type)
			{
				System.Data.SqlClient.SqlCommand cmd=new System.Data.SqlClient.SqlCommand();
				cmd.CommandText = "insert into item values('"+course+"',"+type+")";
				cmd.Connection = this.Conn;
				Conn.Open();
				try
				{
					cmd.ExecuteNonQuery();
					return true;
				}
				catch
				{
					return false;
				}
				finally
				{
					Conn.Close();
				}
			}

			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:UpdataCard
			/// 功能:增加考核项目
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public bool UpdataCard(string userid,string cardno)
			{
				System.Data.SqlClient.SqlCommand cmd=new System.Data.SqlClient.SqlCommand();
				cmd.CommandText = "update user_table set cardno='"+cardno+"' where userid ='"+userid+"'";
				cmd.Connection = this.Conn;
				Conn.Open();
				try
				{
					cmd.ExecuteNonQuery();
					return true;
				}
				catch
				{
					return false;
				}
				finally
				{
					Conn.Close();
				}
			}

			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:DeleteCourse
			/// 功能:删除考核项目
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public bool DeleteCourse(string course)
			{
				System.Data.SqlClient.SqlCommand cmd=new System.Data.SqlClient.SqlCommand();
				cmd.CommandText = "delete from item where item = '"+course+"'";
				cmd.Connection = this.Conn;
				Conn.Open();
				try
				{
					cmd.ExecuteNonQuery();
					return true;
				}
				catch
				{
					return false;
				}
				finally
				{
					Conn.Close();
				}
			}

			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:GetAsSno
			/// 功能:获得成绩 根据学生名字查询
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public DataSet GetAsSname(string sname)
			{
				try
				{
					System.Data.SqlClient.SqlCommand cmd=new System.Data.SqlClient.SqlCommand();
					cmd.CommandText = "select user_score.* from user_score,user_table where user_table.userid=user_score.userid and user_table.sname ='"+sname+"'" ;
					cmd.CommandType = System.Data.CommandType.Text;
					cmd.Connection = this.Conn;
					DataSet dst=new DataSet();
					System.Data.SqlClient.SqlDataAdapter sda=new System.Data.SqlClient.SqlDataAdapter();
					sda.SelectCommand=cmd;
					sda.Fill(dst);
					return dst;
				}
				catch{return null;}
			}

			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:GetNoCardUser
			/// 功能:获得没有卡的用户
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public DataSet GetNoCardUser(int usertype)
			{
				try
				{
					System.Data.SqlClient.SqlCommand cmd=new System.Data.SqlClient.SqlCommand();
					if(usertype==-1)
						cmd.CommandText = "select userid from user_table where cardno is NULL" ;
					else
						cmd.CommandText = "select userid from user_table where cardno is NULL and  usertype ="+usertype ;
					cmd.CommandType = System.Data.CommandType.Text;
					cmd.Connection = this.Conn;
					DataSet dst=new DataSet();
					System.Data.SqlClient.SqlDataAdapter sda=new System.Data.SqlClient.SqlDataAdapter();
					sda.SelectCommand=cmd;
					sda.Fill(dst);
					return dst;
				}catch{
					return null;}
			}

			
			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:Registers
			/// 功能:注册
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public bool Registers(string userid,string sname,string pwd,string cardno,string classs,string grade,string sex,int type)
			{
				System.Data.SqlClient.SqlCommand cmd=new System.Data.SqlClient.SqlCommand();
				cmd.CommandText = "INSERT INTO user_table(userid,sname,userpwd,cardno,class,grade,sex,usertype)"+
					"   VALUES ('"+userid+"','"+sname+"','"+pwd+"','"+cardno+"','"+classs+"','"+grade+"','"+sex+"',"+type+")";
				cmd.Connection = this.Conn;
				Conn.Open();
				try
				{
					cmd.ExecuteNonQuery();
					return true;
				}
				catch(Exception e)
				{
					return false;
				}

				finally
				{
					Conn.Close();
				}
				
			}

			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:InsertScore
			/// 功能:插入成绩
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public bool InsertScore(string userid,string course,string score)
			{
				System.Data.SqlClient.SqlCommand cmd=new System.Data.SqlClient.SqlCommand();
				cmd.CommandText = "INSERT INTO user_score  VALUES ('"+userid+"','"+course+"','"+score+")";
				cmd.Connection = this.Conn;
				Conn.Open();
				try
				{
					cmd.ExecuteNonQuery();
					return true;
				}
				catch(Exception e)
				{
					return false;
				}

				finally
				{
					Conn.Close();
				}
				
			}


			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:GetTime
			/// 功能:获得系统当前时间
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			public byte[] GetTime()
			{
				byte [] Time=new byte[7];
				System.DateTime me=System.DateTime.Now;
				Time[0]=convert(me.Year%100);
				Time[1]=(byte)System.Convert.ToInt32(me.DayOfWeek);
				Time[2]=convert(me.Month);
				Time[3]=convert(me.Day);
				Time[4]=convert(me.Hour);
				Time[5]=convert(me.Minute);
				Time[6]=convert(me.Second);

				return Time;

			}

			/// <summary>
			/// 学院:计算机科学与技术
			/// 学号:01171134
			/// 模块名:convert
			/// 功能:时间差转换
			/// 版本:1.0.0.0  
			/// 时间:2005.4.3
			/// </summary>
			private byte convert(int data)
			{
				if(data>=0&&data<10)
				{
					return (byte)data;
				}
				else if(data>9&&data<20)
				{
					data+=6;
					return (byte)data;
				}
				else if(data>19&&data<30)
				{
					data+=12;
				return (byte)data;
				}
				else if(data>29&&data<40)
				{
					data+=18;
					return (byte)data;
				}
				else if(data>39&&data<50)
				{
					data+=24;
					return (byte)data;
				}
				else if(data>49&&data<60)
				{
					data+=30;
					return (byte)data;
				}

				return (byte)data;
				
			}
		}
	}
}

⌨️ 快捷键说明

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