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

📄 员工考勤.cs

📁 独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 
💻 CS
📖 第 1 页 / 共 4 页
字号:
				emp_TimeRule=emp_BrushFrameIDSet.Tables[0];
                this.dataGrid.DataSource=emp_TimeRule;
			}
			catch(Exception ele)
			{
                ele.ToString();
			}
		}
		#endregion
		#region DataFunction
		private DataTable ExcuteSql(string strSql,string tableName)
		{
			ConnectionData conn=new ConnectionData();
			DataSet dsSet=new DataSet();
			DataTable dsTable=new DataTable();
			try
			{
				dsSet=conn.ExcuteDataSetResult(strSql,tableName);
				dsTable=dsSet.Tables[0];
			}
			catch(Exception eles)
			{
				MessageBox.Show(this,eles.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
			return dsTable;
		}
		#endregion
		#region 统计今天刷卡人数
		private String  selectCount()
		{
			string tempBrushCount="";
			try
			{
				DataTable tempBrushTable=new DataTable();
				tempBrushTable=ExcuteSql("select count(*) from Emp_BrushID","Emp_BrushID");
				for(int i=0;i<tempBrushTable.Rows.Count;i++)
				{
					tempBrushCount=tempBrushTable.Rows[i][0].ToString().Trim();
				}
			}
			catch(Exception ele)
			{
				MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
			return tempBrushCount;
		}
		#endregion
		#region 处理时间变量
		private String  dealTime()
		{
			#region 时间变量..
			int hour=System.DateTime.Now.Hour;
			int minute=System.DateTime.Now.Minute;
			int second=System.DateTime.Now.Second;
			#endregion
			string currentTimeStr="";
			int h=1;
			int w=1;
			//			MessageBox.Show(hour.ToString());
			if(hour>=12)
			{
				h=hour-12;
				#region 如果时,分,秒都小于10...
				if(h<10 && minute<10 && second<10) //如果时,分,秒都小于10例如:02:01:01
				{
					currentTimeStr="0"+h.ToString()+":0"+minute.ToString()+":0"+second.ToString()+""+"PM";
				}
					#endregion
					#region 如果时小于10,分小于10,秒大于10
				else if(h<10 && minute<10 && second>=10)//05;02;28
				{
					currentTimeStr="0"+h.ToString()+":0"+minute.ToString()+":"+second.ToString()+""+"PM";
				}
					#endregion
					#region 如果时小于10,分大于10,秒小于10 //01:21:01
				else if(h<10 && minute>=10 && second<10)
				{
					currentTimeStr="0"+h.ToString()+":"+minute.ToString()+":0"+second.ToString()+""+"PM";
				}
					#endregion
					#region 如果时小于10,分大于10,秒大于10
				else if(h<10 && minute>=10 && second>=10)//02;21;28
				{
					currentTimeStr="0"+h.ToString()+":"+minute.ToString()+":"+second.ToString()+""+"PM";
				}
					#endregion
					#region 如果时大于10, 分小于10,秒小于10
				else if(h>=10 && minute<10 && second<10)//如果时大于10,分小于10,秒小于10 例如:10;01;01
				{
					currentTimeStr=h.ToString()+":0"+minute.ToString()+":0"+second.ToString()+""+"PM";
				}
					#endregion
					#region 如果时大于10,分小于10,秒大于10
				else if(h>=10 && minute<10 && second>=10)//10;02;28
				{
					currentTimeStr=h.ToString()+":0"+minute.ToString()+":"+second.ToString()+""+"PM";
				}
					#endregion
					#region 如果时大于10,分大于10,秒小于10
				else if(h>=10 && minute>=10 && second<10)//如果时大于10,分大于10,秒小于10    10;10;05
				{
					currentTimeStr=h.ToString()+":"+minute.ToString()+":0"+second.ToString()+""+"PM";
				}
					#endregion
					#region 如果时,分,秒都大于10..
				else if(h>=10 && minute>=10 && second>=10)//如果时,分,秒都大于10   10;10;10
				{
					currentTimeStr=h.ToString()+":"+minute.ToString()+":"+second.ToString()+""+"PM";
				}
				#endregion	
			}
			else if(hour<12)
			{
				w=hour;
				#region 如果时,分,秒都小于10...
				if(w<10 && minute<10 && second<10) //如果时,分,秒都小于10例如:02:01:01
				{
					currentTimeStr="0"+w.ToString()+":0"+minute.ToString()+":0"+second.ToString()+"AM";
				}
					#endregion
					#region 如果时小于10,分小于10,秒大于10
				else if(w<10 && minute<10 && second>=10)//05;02;28
				{
					currentTimeStr="0"+w.ToString()+":0"+minute.ToString()+":"+second.ToString()+"AM";
				}
					#endregion
					#region 如果时小于10,分大于10,秒小于10 //01:21:01
				else if(w<10 && minute>=10 && second<10)
				{
					currentTimeStr="0"+w.ToString()+":"+minute.ToString()+":0"+second.ToString()+"AM";
				}
					#endregion
					#region 如果时小于10,分大于10,秒大于10
				else if(w<10 && minute>=10 && second>=10)//02;21;28
				{
					currentTimeStr="0"+w.ToString()+":"+minute.ToString()+":"+second.ToString()+"AM";
				}
					#endregion
					#region 如果时大于10, 分小于10,秒小于10
				else if(w>=10 && minute<10 && second<10)//如果时大于10,分小于10,秒小于10 例如:10;01;01
				{
					currentTimeStr=w.ToString()+":0"+minute.ToString()+":0"+second.ToString()+"AM";
				}
					#endregion
					#region 如果时大于10,分小于10,秒大于10
				else if(w>=10 && minute<10 && second>=10)//10;02;28
				{
					currentTimeStr=w.ToString()+":0"+minute.ToString()+":"+second.ToString()+"AM";
				}
					#endregion
					#region 如果时大于10,分大于10,秒小于10
				else if(w>=10 && minute>=10 && second<10)//如果时大于10,分大于10,秒小于10    10;10;05
				{
					currentTimeStr=w.ToString()+":"+minute.ToString()+":0"+second.ToString()+"AM";
				}
					#endregion
					#region 如果时,分,秒都大于10..
				else if(w>=10 && minute>=10 && second>=10)//如果时,分,秒都大于10   10;10;10
				{
					currentTimeStr=w.ToString()+":"+minute.ToString()+":"+second.ToString()+"AM";
				}
				#endregion	
			}
			return currentTimeStr;
		}
		#endregion
		#region 查询Emp_Time
		private DataTable selectEmp_Time()
		{
			DataTable tempEmpTime=new DataTable();
			try
			{
				tempEmpTime=ExcuteSql("select 职工名称,时间,日期 from Emp_Time","Emp_Time");
			}
			catch(Exception ele)
			{
				MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
			return tempEmpTime;
		}
		#endregion
		#region 刷卡函数表
		private void BrushFrameID(string emp_name,string emp_timeStr)
		{
			
			
		}
		#endregion
		#region 添加刷卡事件...
		private void insertBrushID()
		{
			try
			{
				ConnectionData conn=new ConnectionData();
				DataTable tempTable=new DataTable();
				tempTable=selectEmp_Time();
				int p=this.selectEmpCount();
				for(int i=p-BrushKaIDFrame.BrushCounts;i<tempTable.Rows.Count;i++)
				{
					if(Int32.Parse(tempTable.Rows[i][1].ToString().Substring(0,2).Trim())<11)
					{
						string insertStr="insert into Emp_BrushID(职工名称,上午上班,日期) values('"+tempTable.Rows[i][0].ToString()+"','"+tempTable.Rows[i][1].ToString()+"','"+tempTable.Rows[i][2].ToString()+"')";
						int a=conn.ExcuteStrSql(insertStr);
					}
					else  if(Int32.Parse(tempTable.Rows[i][1].ToString().Substring(0,2)).Equals(11))
					{
						string insertStr="insert into Emp_BrushID(职工名称,上午下班,日期) values('"+tempTable.Rows[i][0].ToString()+"','"+tempTable.Rows[i][1].ToString()+"','"+tempTable.Rows[i][2].ToString()+"')";
						int b=conn.ExcuteStrSql(insertStr);
					}
					else if(Int32.Parse(tempTable.Rows[i][1].ToString().Substring(0,2)).Equals(12))
					{
						string insertStr="insert into Emp_BrushID(职工名称,下午上班,日期) values('"+tempTable.Rows[i][0].ToString()+"','"+tempTable.Rows[i][1].ToString()+"','"+tempTable.Rows[i][2].ToString()+"')";
						int c=conn.ExcuteStrSql(insertStr);
					}
					else if(Int32.Parse(tempTable.Rows[i][1].ToString().Substring(0,2))>12 && Int32.Parse(tempTable.Rows[i][1].ToString().Substring(0,2))<16)
					{
						string insertStr="insert into Emp_BrushID(职工名称,下午上班,日期) values('"+tempTable.Rows[i][0].ToString()+"','"+tempTable.Rows[i][1].ToString()+"','"+tempTable.Rows[i][2].ToString()+"')";
						int d=conn.ExcuteStrSql(insertStr);
					}
					else if(Int32.Parse(tempTable.Rows[i][1].ToString().Substring(0,2)).Equals(16))
					{
						string insertStr="insert into Emp_BrushID(职工名称,下午上班,日期) values('"+tempTable.Rows[i][0].ToString()+"','"+tempTable.Rows[i][1].ToString()+"','"+tempTable.Rows[i][2].ToString()+"')";
						int e=conn.ExcuteStrSql(insertStr);
					}
					else if(Int32.Parse(tempTable.Rows[i][1].ToString().Substring(0,2)).Equals(17))
					{
						string insertStr="insert into Emp_BrushID(职工名称,下午下班,日期) values('"+tempTable.Rows[i][0].ToString()+"','"+tempTable.Rows[i][1].ToString()+"','"+tempTable.Rows[i][2].ToString()+"')";
						int f=conn.ExcuteStrSql(insertStr);
					}
					else if(Int32.Parse(tempTable.Rows[i][1].ToString().Substring(0,2))>17)
					{
						string insertStr="insert into Emp_BrushID(职工名称,下午下班,日期) values('"+tempTable.Rows[i][0].ToString()+"','"+tempTable.Rows[i][1].ToString()+"','"+tempTable.Rows[i][2].ToString()+"')";
						int g=conn.ExcuteStrSql(insertStr);
					}
				}
			}
			catch(Exception ele)
			{
				ele.ToString();
			}
		}
		#endregion
		#region 查询Emp_Time记录数
		private int selectEmpCount()
		{
			int k=0;
			try
			{
				ConnectionData conn=new ConnectionData();
		        DataTable temptable=new DataTable();
				temptable=ExcuteSql("select count(*) from Emp_Time","Emp_Time");
				for(int j=0;j<temptable.Rows.Count;j++)
				{
					k=Int32.Parse(temptable.Rows[j][0].ToString().Trim());
				}
			}
			catch(Exception ele)
			{
				ele.ToString();
			}
			return k;
		}
		#endregion
		#region 光标移动时变化...
		private void dataGrid_CurrentCellChanged(object sender, System.EventArgs e)
		{
			try
			{
				this.kaoqinzhuangtai.Text=this.dataGrid[this.dataGrid.CurrentRowIndex,0].ToString().Trim();
			}
			catch(Exception ele)
			{
				MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
		}
		#endregion
		#region 光标移动时变化...
		private void dateTimePicker1_MouseLeave(object sender, System.EventArgs e)
		{
		    this.emp_Name_MouseLeave(sender,e);
		}

		private void dateTimePicker1_MouseEnter(object sender, System.EventArgs e)
		{
		    this.emp_Name_MouseEnter(sender,e);
		}
		#endregion
	}
}

⌨️ 快捷键说明

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