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

📄 zhaotuiframe.cs

📁 独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 
💻 CS
📖 第 1 页 / 共 2 页
字号:
			// 
			this.sqlSelectCommand1.CommandText = "SELECT 编号, 职工名称, 状态, [上/下], 日期 FROM Emp_ZhaoTui";
			this.sqlSelectCommand1.Connection = this.sqlConnection;
			// 
			// sqlUpdateCommand1
			// 
			this.sqlUpdateCommand1.CommandText = @"UPDATE Emp_ZhaoTui SET 职工名称 = @职工名称, 状态 = @状态, [上/下] = @Param2, 日期 = @日期 WHERE (编号 = @Original_编号) AND ([上/下] = @Original_上_下 OR @Original_上_下 IS NULL AND [上/下] IS NULL) AND (日期 = @Original_日期 OR @Original_日期 IS NULL AND 日期 IS NULL) AND (状态 = @Original_状态 OR @Original_状态 IS NULL AND 状态 IS NULL) AND (职工名称 = @Original_职工名称 OR @Original_职工名称 IS NULL AND 职工名称 IS NULL); SELECT 编号, 职工名称, 状态, [上/下], 日期 FROM Emp_ZhaoTui WHERE (编号 = @编号)";
			this.sqlUpdateCommand1.Connection = this.sqlConnection;
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@职工名称", System.Data.SqlDbType.VarChar, 50, "职工名称"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@状态", System.Data.SqlDbType.VarChar, 50, "状态"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param2", System.Data.SqlDbType.VarChar, 50, "上/下"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@日期", System.Data.SqlDbType.VarChar, 50, "日期"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "编号", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_上_下", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "上/下", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_日期", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "日期", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_状态", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "状态", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_职工名称", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "职工名称", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@编号", System.Data.SqlDbType.Int, 4, "编号"));
			// 
			// zhaoTuiTableSet
			// 
			this.zhaoTuiTableSet.DataSetName = "zhaoTuiTableSet";
			this.zhaoTuiTableSet.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// searchZhaoTuiDataAdapter
			// 
			this.searchZhaoTuiDataAdapter.SelectCommand = this.sqlSelectCommand2;
			this.searchZhaoTuiDataAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																											   new System.Data.Common.DataTableMapping("Table", "Emp_ZhaoTui", new System.Data.Common.DataColumnMapping[] {
																																																							  new System.Data.Common.DataColumnMapping("编号", "编号"),
																																																							  new System.Data.Common.DataColumnMapping("职工名称", "职工名称"),
																																																							  new System.Data.Common.DataColumnMapping("状态", "状态"),
																																																							  new System.Data.Common.DataColumnMapping("上/下", "上/下"),
																																																							  new System.Data.Common.DataColumnMapping("日期", "日期")})});
			// 
			// sqlSelectCommand2
			// 
			this.sqlSelectCommand2.CommandText = "SELECT 编号, 职工名称, 状态, [上/下], 日期 FROM Emp_ZhaoTui WHERE (日期 LIKE @Param4) AND (职工名称" +
				" LIKE @Param5) AND (状态 LIKE @Param6)";
			this.sqlSelectCommand2.Connection = this.sqlConnection1;
			this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param4", System.Data.SqlDbType.VarChar, 50, "日期"));
			this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param5", System.Data.SqlDbType.VarChar, 50, "职工名称"));
			this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param6", System.Data.SqlDbType.VarChar, 50, "状态"));
			// 
			// sqlConnection1
			// 
			this.sqlConnection1.ConnectionString = "workstation id=localhost;integrated security=SSPI;database=SystemODBC";
			// 
			// zhaoTuiFrame
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(746, 423);
			this.Name = "zhaoTuiFrame";
			this.Text = "早退管理";
			this.Load += new System.EventHandler(this.zhaoTuiFrame_Load);
			((System.ComponentModel.ISupportInitialize)(this.statusZhuangTai)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.ds)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusText)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.zhaoTuiTableSet)).EndInit();
			this.ResumeLayout(false);

		}		#endregion		#region 变量定义...
		DataTable zhaoTuiTable=new DataTable();
		//string zhaoTuiStr="";
		private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
		private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
		private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
		private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
		private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter;
		private System.Data.SqlClient.SqlConnection sqlConnection;
		private WindowsApplication.zhaoTuiTableSet zhaoTuiTableSet;
		ConnectionData conn=new ConnectionData();
		#endregion
		#region 初始化事件...
		private void zhaoTuiFrame_Load(object sender, System.EventArgs e)
		{
			#region  初始化serchZhaoTuiDataAdapter...
			this.searchZhaoTuiDataAdapter.SelectCommand.Parameters[0].Value="%%";
			this.searchZhaoTuiDataAdapter.SelectCommand.Parameters[1].Value="%%";
			this.searchZhaoTuiDataAdapter.SelectCommand.Parameters[2].Value="%%";
			#endregion
			#region 初始化DataGrid...
			//zhaoTuiTable=ExcuteSql("select * from Emp_ZhaoTui","Emp_ZhaoTui");
			this.searchZhaoTuiDataAdapter.Fill(this.zhaoTuiTableSet);
			this.sqlDataAdapter.Fill(this.zhaoTuiTableSet);
			zhaoTuiTable=this.zhaoTuiTableSet.Tables[0];
			base.dataGrid.DataSource=zhaoTuiTable;
			base.ds=this.zhaoTuiTableSet;
			base.dataAdapter=this.sqlDataAdapter;
			base.cmOrders=(System.Windows.Forms.CurrencyManager) BindingContext[zhaoTuiTable];
			base.statusText.Text="今天早退人数:"+selectCount().Trim();
			intZhaoTui=Int32.Parse(selectCount().Trim());
			#endregion
			#region 初始化工具栏...
			#endregion
		}		#endregion		#region DataFunction
		private DataTable ExcuteSql(string strSql,string tableName)
		{
			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 tempstr="";			try			{				DataTable tempTable=new DataTable();				tempTable=ExcuteSql("select count(*) from Emp_ZhaoTui where 日期='"+System.DateTime.Now.ToLongDateString()+"'","Emp_ZhaoTui");				for(int i=0;i<tempTable.Rows.Count;i++)				{					tempstr=tempTable.Rows[i][0].ToString().Trim();				}			}			catch(Exception ele)			{				MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);			}			return tempstr;		}		#endregion
		#region 查询事件...
		private void btnSearch_Click(object sender, System.EventArgs e)
		{
			try
			{
				this.searchZhaoTuiDataAdapter.SelectCommand.Parameters[0].Value="%%";
				this.searchZhaoTuiDataAdapter.SelectCommand.Parameters[1].Value="%%";
				this.searchZhaoTuiDataAdapter.SelectCommand.Parameters[2].Value="%%";
				if(this.textSearchA.Text !="")
				{
                    this.searchZhaoTuiDataAdapter.SelectCommand.Parameters[0].Value="%"+this.textSearchA.Text+"%";
				}
				if(this.textSearchB.Text !="")
				{
                    this.searchZhaoTuiDataAdapter.SelectCommand.Parameters[1].Value="%"+this.textSearchB.Text+"%";
				}
				if(this.textSearchC.Text!="")
				{
                    this.searchZhaoTuiDataAdapter.SelectCommand.Parameters[2].Value="%"+this.textSearchC.Text+"%";
				}
				this.zhaoTuiTableSet.Emp_ZhaoTui.Clear();
				this.searchZhaoTuiDataAdapter.Fill(this.zhaoTuiTableSet);
				base.dataGrid.DataSource=this.zhaoTuiTableSet.Tables[0];
//				base.dataAdapter=this.searchZhaoTuiDataAdapter;
//				base.ds=this.zhaoTuiTableSet;
			}
			catch(Exception ele)
			{
                MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
		}		#endregion	}}

⌨️ 快捷键说明

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