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

📄 fakaframe.cs

📁 独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 
💻 CS
📖 第 1 页 / 共 4 页
字号:
		private void InsertData()
		{

		}
		private void SearchData()
		{

		}
		private void UpdateData()
		{

		}
		private void SelectData()
		{

		}
		public static void result()
		{

		}
		#endregion
		#region 
		private void CheckEnableISNOT(bool f)
		{
             this.empIDFa.Enabled=f;
			 this.textFaHao.Enabled=f;
			 this.textFaName.Enabled=f;
			 this.textBuHao.Enabled=!f;
			 this.empIDBu.Enabled=!f;
			 this.textBuName.Enabled=!f;
			 this.buCheckBox.Enabled=!f;
			 this.FaCheckBox.Enabled=!f;
		}
		#endregion
		#region 下列表框改变时发生事件...发补事件....
		private void empIDBu_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if(this.empIDBu.Text.Equals(""))
			{
				this.textBuHao.Text="";
			}
			try
			{
				string selectEmployeeSql="select 职工号,职工名称,ID号 from Employee";
				DataSet searchEmployeeSet=new DataSet();
				DataTable searchEmployeeTable=new DataTable();
				searchEmployeeSet=conn.ExcuteDataSetResult(selectEmployeeSql,"Employee");
				searchEmployeeTable=searchEmployeeSet.Tables[0];
				for(int i=0;i<searchEmployeeTable.Rows.Count;i++)
				{
					if(searchEmployeeTable.Rows[i][0].ToString().Equals(this.empIDBu.Text.ToString().Trim()))
					{
						this.textBuName.Text=searchEmployeeTable.Rows[i][1].ToString();
						this.textBuHao.Text=searchEmployeeTable.Rows[i][2].ToString();
						FaKaFrame.strBuKa=searchEmployeeTable.Rows[i][2].ToString();
                        this.empIDBu.Text=searchEmployeeTable.Rows[i][0].ToString();//保存当前需要补卡号的职工号...
                        strBuEmpID=this.empIDBu.Text.ToString().Trim();
					}
				}
				if(this.textBuHao.Text.Length.Equals(0))
				{
					this.buCheckBox.Checked=true;
					this.FaCheckBox.Checked=false;
					if(this.buCheckBox.Checked.Equals(true))
					{
						ClearText();
						DialogResult result=MessageBox.Show(this,"是否要补卡啊!!!","提示信息",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
						if(result.Equals(DialogResult.Yes))
						{
							this.CheckEnableISNOT(true);
                            BuEmployeeID(strBuEmpID);
						}
						else
						{
							this.CheckEnableISNOT(false);
							ClearText();
						}
					}
				}
				else if(this.textBuHao.Text.Length>0)
				{
					this.buCheckBox.Checked=false;
					this.FaCheckBox.Checked=true;
				}
			}
			catch(Exception exe)
			{
				MessageBox.Show(exe.ToString());
			}
		}
		private void empIDFa_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if(this.empIDFa.Text.Equals(""))
			{
				this.textFaHao.Text="";
			}
			try
			{
				string selectEmployeeSql="select 职工号,职工名称 from Employee";
				DataSet searchEmployeeSet=new DataSet();
				DataTable searchEmployeeTable=new DataTable();
				searchEmployeeSet=conn.ExcuteDataSetResult(selectEmployeeSql,"Employee");
				searchEmployeeTable=searchEmployeeSet.Tables[0];
				for(int i=0;i<searchEmployeeTable.Rows.Count;i++)
				{
					if(searchEmployeeTable.Rows[i][0].ToString().Equals(this.empIDFa.Text.ToString().Trim()))
					{
						this.textFaName.Text=searchEmployeeTable.Rows[i][1].ToString();
					}
				}
			}
			catch(Exception exe)
			{
				MessageBox.Show(exe.ToString());
			}
		}
		#endregion
		#region 下拉列框表值变化时
		private void empIDFa_SelectedValueChanged(object sender, System.EventArgs e)
		{
			if(this.empIDFa.Text.Equals(""))
			{
				this.textFaHao.Text="";
			}
		}
		#endregion
        #region 下拉列框表值变化时键盘事件
		private void empIDFa_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode.Equals(13))
			{
				if(this.empIDFa.Text.Equals(""))
				{
					this.textFaHao.Text="";
				}
			}
		}
		#endregion
		#region 取卡号码...
		private void btnReadID_Click(object sender, System.EventArgs e)
		{
			try
			{
                RemoveFrame log=new RemoveFrame();
				log.ShowDialog();
			}
			catch(Exception exse)
			{
				MessageBox.Show(this,exse.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
		}
		#endregion
		#region 鼠标移到控件所发生变化...
		private void btnOk_MouseEnter(object sender, System.EventArgs e)
		{
		    Button button=(Button)sender;
			button.FlatStyle=FlatStyle.Standard;
		}

		private void btnOk_MouseLeave(object sender, System.EventArgs e)
		{
			Button button=(Button)sender;
			button.FlatStyle=FlatStyle.Flat;
		}
		#endregion
		#region 向数据库中插入数据函数
		private void BrushClipFunction(string brushclipStr)
		{
			try
			{
				string connectionStr="Workstation id=localhost;Integrated Security=SSPI;DataBase=SystemODBC;";
				string searchSql="select distinct 职工号 from Employee where ID号='"+brushclipStr+"'";
				SqlConnection con=new SqlConnection(connectionStr);
				SqlDataAdapter searchCom=new SqlDataAdapter(searchSql,con);//InsertCom=new SqlDataAdapter(InsertSql,con);
                DataSet searchDataSet=new DataSet();//InsertDataSet=new DataSet();
				DataTable searchDataTable=new DataTable();//InsertDataTable=new DataTable();
		        searchCom.Fill(searchDataSet);
                searchDataTable=searchDataSet.Tables[0];
				for(int i=0;i<searchDataTable.Rows.Count;i++)
				{
					for(int k=0;k<this.empIDFa.Items.Count;k++)
					{
						if(searchDataTable.Rows[i][0].ToString().Trim().Equals(this.empIDFa.Items[k].ToString()))
						{
                             this.empIDFa.SelectedIndex=k;
						}
					}
				}
			}
			catch(Exception exty)
			{
				MessageBox.Show(this,exty.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
		}
		#endregion
		#region 读号事件
		private void btnReadClipID_Click(object sender, System.EventArgs e)
		{
			ReadBrushIDFrame log=new ReadBrushIDFrame();
			log.ShowDialog();
			if(ReadBrushIDFrame.strID.Equals(""))
			{
				MessageBox.Show(this,"你还没有刷卡呢???","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				return;
			}
			else
			{
                this.textFaHao.Text=ReadBrushIDFrame.strID;
                strKaHao=this.textFaHao.Text.ToString().Trim();
				#region  刷卡程序段...
				string strBrush=ReadBrushIDFrame.strID.ToString().Trim();
				BrushClipFunction(strBrush);
				#endregion
			}
		}
		#endregion
		#region 补卡函数
		private void BuEmployeeID(string tempStr)
		{
			try
			{
				for(int r=0;r<this.empIDFa.Items.Count;r++)
				{
					if(this.empIDFa.Items[r].ToString().Equals(tempStr))
					{
						this.empIDFa.SelectedIndex=r;
					}
				}
			}
			catch(Exception elee)
			{
				MessageBox.Show(this,elee.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
		}
		#endregion
		#region 添加发卡记录
		private void BrushIDFrameHistory(string strStauts)
		{
			try
			{
				this.sqlConnection.Open();
				this.sqlInsertCommand1.Parameters["@日期"].Value=DateTime.Now.ToString("yyyy-MM-dd").Trim();
				this.sqlInsertCommand1.Parameters["@时间"].Value=WindowsApplication.dealTime.dealTime.dealTimeString(System.DateTime.Now.Hour,System.DateTime.Now.Minute,System.DateTime.Now.Second).Trim();
				this.sqlInsertCommand1.Parameters["@卡号"].Value=this.textFaHao.Text.ToString().Trim();
				this.sqlInsertCommand1.Parameters["@姓名"].Value=this.textFaName.Text.ToString().Trim();
				this.sqlInsertCommand1.Parameters["@状态"].Value=strStauts;
				int j=this.sqlInsertCommand1.ExecuteNonQuery();
				if(j>0)
				{}
				else
				{
					MessageBox.Show(this,"记录失败!!!","提示作息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				}
			}
			catch(Exception ele)
			{
				MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
			finally
			{
				if(this.sqlConnection.State.Equals(ConnectionState.Open))
				{
					this.sqlConnection.Close();
				}
			}
		}
		#endregion
	}
	#endregion
}

⌨️ 快捷键说明

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