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

📄 login.aspx.cs

📁 考勤系统
💻 CS
📖 第 1 页 / 共 2 页
字号:
							{
								count++;
							}
							reader.Close();
							com.Dispose();
							con.Close();
							if(count!=0)
							{
								con.Open();
								com=new OleDbCommand(selSql5,con);
								reader=com.ExecuteReader();
								while(reader.Read())
								{
									count4++;
								}
								reader.Close();
								com.Dispose();
								con.Close();
								if(count4==0)
								{
									if(System.Convert.ToInt32(strHour)<17)
									{
										strKuangGong="旷工";
										strZaoTui="否";
									}
									else if(System.Convert.ToInt32(strHour)==17 && System.Convert.ToInt32(strMinute)<30)
									{
										strZaoTui="早退";
										strKuangGong=" ";
									}
									else
									{
										strKuangGong=" ";
										strZaoTui="否";
									}
									insertSql="update kaoqin set lgdate='"+strTime+"',zt='"+strZaoTui+"',kg='"+strKuangGong+"',cd='否' where id='"+id+"' and kqdate='"+strToday+"'";
									con.Open();
									com=new OleDbCommand(insertSql,con);
									com.ExecuteNonQuery();
									com.Dispose();
									con.Close();
									info.Text="考勤成功!";
								}
								else
								{
									string insert="update kaoqin set lgdate='"+strTime+"' where id='"+id+"' and kqdate='"+strToday+"'";
									con.Open();
									com=new OleDbCommand(insert,con);
									com.ExecuteNonQuery();
									com.Dispose();
									con.Close();
									info.Text="考勤成功!";
								}
							}
							else
							{
								info.Text="系统已经记录您的考勤信息,不能重新记录!";
							}
						}
					}
				}
				else
				{
					info.Text="用户密码错误!";
				}
			}
			con.Close();
		}

		/******************************
		 * 当点击事假按钮时执行此方法 *
		 * ****************************/
		private void btnShiJia_Click(object sender, System.EventArgs e)
		{
			string id,selSql,selSql2,strPwd="",insertSql,strToday,strTime,strHour,strMinute,strYear,strMon;
			int count=0;
			id=ddId.SelectedItem.Text.Trim();
			strToday=System.DateTime.Today.ToShortDateString();
			strTime=System.DateTime.Now.ToShortTimeString();
			strHour=System.DateTime.Now.Hour.ToString();
			strMinute=System.DateTime.Now.Minute.ToString();
			strYear=System.DateTime.Now.Year.ToString();
			strMon=System.DateTime.Now.Month.ToString();
			selSql="select password from usermessage where id='"+id+"'";
			selSql2="select name from kaoqin where id='"+id+"' and kqdate='"+strToday+"'";
			insertSql="insert into kaoqin values('"+id+"','"+txtName.Text+"','"+strToday+"','0','0','否','否',' ','事假',' ','"+strYear+"','"+strMon+"')";
			if(txtName.Text.Equals(""))
			{
				info.Text="请选择用户编号!";
			}
			else
			{
				con.Open();
				com=new OleDbCommand(selSql,con);
				reader=com.ExecuteReader();
				while(reader.Read())
				{
					strPwd=reader.GetString(0);
				}
				reader.Close();
				com.Dispose();
				con.Close();
				if(txtPwd.Text.Equals(strPwd))
				{
					con.Open();
					com=new OleDbCommand(selSql2,con);
					reader=com.ExecuteReader();
					while(reader.Read())
					{
						count++;
					}
					reader.Close();
					com.Dispose();
					con.Close();
					if(count==0)
					{
						con.Open();
						com=new OleDbCommand(insertSql,con);
						com.ExecuteNonQuery();
						com.Dispose();
						con.Close();
						info.Text="考勤成功!";
					}
					else
					{
						info.Text="系统已经记录您的考勤信息,不能重新记录";
					}
				}
				else
				{
					info.Text="用户密码错误!";
				}
			}
			con.Close();
		}

		/******************************
		 * 当点击病假按钮时执行此方法 *
		 * ****************************/
		private void btnBingJia_Click(object sender, System.EventArgs e)
		{
			string id,selSql,selSql2,strPwd="",insertSql,strToday,strTime,strHour,strMinute,strYear,strMon;
			int count=0;
			id=ddId.SelectedItem.Text.Trim();
			strToday=System.DateTime.Today.ToShortDateString();
			strTime=System.DateTime.Now.ToShortTimeString();
			strHour=System.DateTime.Now.Hour.ToString();
			strMinute=System.DateTime.Now.Minute.ToString();
			strYear=System.DateTime.Now.Year.ToString();
			strMon=System.DateTime.Now.Month.ToString();
			selSql="select password from usermessage where id='"+id+"'";
			selSql2="select name from kaoqin where id='"+id+"' and kqdate='"+strToday+"'";
			insertSql="insert into kaoqin values('"+id+"','"+txtName.Text+"','"+strToday+"','0','0','否','否','病假',' ',' ','"+strYear+"','"+strMon+"')";
			if(txtName.Text.Equals(""))
			{
				info.Text="请选择用户编号!";
			}
			else
			{
				con.Open();
				com=new OleDbCommand(selSql,con);
				reader=com.ExecuteReader();
				while(reader.Read())
				{
					strPwd=reader.GetString(0);
				}
				reader.Close();
				com.Dispose();
				con.Close();
				if(txtPwd.Text.Equals(strPwd))
				{
					con.Open();
					com=new OleDbCommand(selSql2,con);
					reader=com.ExecuteReader();
					while(reader.Read())
					{
						count++;
					}
					reader.Close();
					com.Dispose();
					con.Close();
					if(count==0)
					{
						con.Open();
						com=new OleDbCommand(insertSql,con);
						com.ExecuteNonQuery();
						com.Dispose();
						con.Close();
						info.Text="考勤成功!";
					}
					else
					{
						info.Text="系统已经记录您的考勤信息,不能重新记录";
					}
				}
				else
				{
					info.Text="用户密码错误!";
				}
			}
			con.Close();
		}

		/******************************
		 * 当点击旷工按钮时执行此方法 *
		 * ****************************/
		private void Button1_Click(object sender, System.EventArgs e)
		{
			string id,selSql,selSql2,strPwd="",insertSql,strToday,strTime,strHour,strMinute,strYear,strMon;
			int count=0;
			id=ddId.SelectedItem.Text.Trim();
			strToday=System.DateTime.Today.ToShortDateString();
			strTime=System.DateTime.Now.ToShortTimeString();
			strHour=System.DateTime.Now.Hour.ToString();
			strMinute=System.DateTime.Now.Minute.ToString();
			strYear=System.DateTime.Now.Year.ToString();
			strMon=System.DateTime.Now.Month.ToString();
			selSql="select password from usermessage where id='"+id+"'";
			selSql2="select name from kaoqin where id='"+id+"' and kqdate='"+strToday+"'";
			insertSql="insert into kaoqin values('"+id+"','"+txtName.Text+"','"+strToday+"','0','0','否','否',' ',' ','旷工','"+strYear+"','"+strMon+"')";
			if(txtName.Text.Equals(""))
			{
				info.Text="请选择用户编号!";
			}
			else
			{
				con.Open();
				com=new OleDbCommand(selSql,con);
				reader=com.ExecuteReader();
				while(reader.Read())
				{
					strPwd=reader.GetString(0);
				}
				reader.Close();
				com.Dispose();
				con.Close();
				if(txtPwd.Text.Equals(strPwd))
				{	
					con.Open();
					com=new OleDbCommand(selSql2,con);
					reader=com.ExecuteReader();
					while(reader.Read())
					{
						count++;
					}
					reader.Close();
					com.Dispose();
					con.Close();
					if(count==0)
					{
						con.Open();
						com=new OleDbCommand(insertSql,con);
						com.ExecuteNonQuery();
						com.Dispose();
						con.Close();
						info.Text="考勤成功!";
					}
					else
					{
						info.Text="系统已经记录您的考勤信息,不能重新记录";
					}
				}
				else
				{
					info.Text="用户密码错误!";
				}
			}
			con.Close();
		}
	}
}

⌨️ 快捷键说明

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