kaqintongjiframe.cs

来自「独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 」· CS 代码 · 共 1,262 行 · 第 1/4 页

CS
1,262
字号
			this.btnDaoChu.Name = "btnDaoChu";
			this.btnDaoChu.TabIndex = 12;
			this.btnDaoChu.Text = "导出(&L)";
			this.btnDaoChu.Click += new System.EventHandler(this.btnDaoChu_Click);
			this.btnDaoChu.MouseEnter += new System.EventHandler(this.btnDaoChu_MouseEnter);
			this.btnDaoChu.MouseLeave += new System.EventHandler(this.btnDaoChu_MouseLeave);
			// 
			// btnCancel
			// 
			this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnCancel.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnCancel.ForeColor = System.Drawing.Color.Blue;
			this.btnCancel.Location = new System.Drawing.Point(352, 272);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.TabIndex = 13;
			this.btnCancel.Text = "取消(&C)";
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			this.btnCancel.MouseEnter += new System.EventHandler(this.btnDaoChu_MouseEnter);
			this.btnCancel.MouseLeave += new System.EventHandler(this.btnDaoChu_MouseLeave);
			// 
			// emp_NameComboBox
			// 
			this.emp_NameComboBox.Location = new System.Drawing.Point(136, 216);
			this.emp_NameComboBox.Name = "emp_NameComboBox";
			this.emp_NameComboBox.Size = new System.Drawing.Size(121, 20);
			this.emp_NameComboBox.TabIndex = 14;
			// 
			// btnMonth
			// 
			this.btnMonth.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnMonth.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnMonth.ForeColor = System.Drawing.Color.Blue;
			this.btnMonth.Location = new System.Drawing.Point(144, 272);
			this.btnMonth.Name = "btnMonth";
			this.btnMonth.Size = new System.Drawing.Size(96, 24);
			this.btnMonth.TabIndex = 15;
			this.btnMonth.Text = "统计月考勤(&O)";
			this.btnMonth.Click += new System.EventHandler(this.btnMonth_Click);
			// 
			// sqlDataAdapter
			// 
			this.sqlDataAdapter.DeleteCommand = this.sqlDeleteCommand1;
			this.sqlDataAdapter.InsertCommand = this.sqlInsertCommand1;
			this.sqlDataAdapter.SelectCommand = this.sqlSelectCommand1;
			this.sqlDataAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																									 new System.Data.Common.DataTableMapping("Table", "KaoQinManager_History", 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("迟到人数", "迟到人数"),
																																																							  new System.Data.Common.DataColumnMapping("未到人数", "未到人数"),
																																																							  new System.Data.Common.DataColumnMapping("请假人数", "请假人数"),
																																																							  new System.Data.Common.DataColumnMapping("状态", "状态")})});
			this.sqlDataAdapter.UpdateCommand = this.sqlUpdateCommand1;
			// 
			// sqlDeleteCommand1
			// 
			this.sqlDeleteCommand1.CommandText = @"DELETE FROM KaoQinManager_History 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) 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)";
			this.sqlDeleteCommand1.Connection = this.sqlConnection;
			this.sqlDeleteCommand1.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.sqlDeleteCommand1.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.sqlDeleteCommand1.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.sqlDeleteCommand1.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.sqlDeleteCommand1.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.sqlDeleteCommand1.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.sqlDeleteCommand1.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.sqlDeleteCommand1.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));
			// 
			// sqlConnection
			// 
			this.sqlConnection.ConnectionString = "workstation id=localhost;integrated security=SSPI;database=SystemODBC";
			// 
			// sqlInsertCommand1
			// 
			this.sqlInsertCommand1.CommandText = "INSERT INTO KaoQinManager_History(日期, 时间, 早退人数, 迟到人数, 未到人数, 请假人数, 状态) VALUES (@日期" +
				", @时间, @早退人数, @迟到人数, @未到人数, @请假人数, @状态); SELECT 编号, 日期, 时间, 早退人数, 迟到人数, 未到人数, 请假" +
				"人数, 状态 FROM KaoQinManager_History WHERE (编号 = @@IDENTITY)";
			this.sqlInsertCommand1.Connection = this.sqlConnection;
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@日期", System.Data.SqlDbType.VarChar, 50, "日期"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@时间", System.Data.SqlDbType.VarChar, 50, "时间"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@早退人数", System.Data.SqlDbType.Int, 4, "早退人数"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@迟到人数", System.Data.SqlDbType.Int, 4, "迟到人数"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@未到人数", System.Data.SqlDbType.Int, 4, "未到人数"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@请假人数", System.Data.SqlDbType.Int, 4, "请假人数"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@状态", System.Data.SqlDbType.VarChar, 50, "状态"));
			// 
			// sqlSelectCommand1
			// 
			this.sqlSelectCommand1.CommandText = "SELECT 编号, 日期, 时间, 早退人数, 迟到人数, 未到人数, 请假人数, 状态 FROM KaoQinManager_History";
			this.sqlSelectCommand1.Connection = this.sqlConnection;
			// 
			// sqlUpdateCommand1
			// 
			this.sqlUpdateCommand1.CommandText = @"UPDATE KaoQinManager_History SET 日期 = @日期, 时间 = @时间, 早退人数 = @早退人数, 迟到人数 = @迟到人数, 未到人数 = @未到人数, 请假人数 = @请假人数, 状态 = @状态 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) 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 KaoQinManager_History 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("@早退人数", System.Data.SqlDbType.Int, 4, "早退人数"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@迟到人数", System.Data.SqlDbType.Int, 4, "迟到人数"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@未到人数", System.Data.SqlDbType.Int, 4, "未到人数"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@请假人数", System.Data.SqlDbType.Int, 4, "请假人数"));
			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.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.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.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.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("@编号", System.Data.SqlDbType.Int, 4, "编号"));
			// 
			// kaoQinManagerSet
			// 
			this.kaoQinManagerSet.DataSetName = "KaoQinManagerSet";
			this.kaoQinManagerSet.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// kaqintongjiFrame
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.CancelButton = this.btnCancel;
			this.ClientSize = new System.Drawing.Size(458, 319);
			this.Controls.Add(this.btnMonth);
			this.Controls.Add(this.emp_NameComboBox);
			this.Controls.Add(this.btnCancel);
			this.Controls.Add(this.btnDaoChu);
			this.Controls.Add(this.btnOk);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.radioLastWeek);
			this.Controls.Add(this.radioWeek);
			this.Controls.Add(this.radioToday);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.label4);
			this.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "kaqintongjiFrame";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "kaqintongjiFrame";
			this.Load += new System.EventHandler(this.kaqintongjiFrame_Load);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.kaoQinManagerSet)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion
		#region 初始化事件....
		private void kaqintongjiFrame_Load(object sender, System.EventArgs e)
		{
			try
			{
				#region 初始值...
				InitValues();
				#endregion
				#region 填充下拉表框...
				FillComboBox();
				#endregion
			}
			catch(Exception ele)
			{
				ele.ToString();
			}
		}
		#endregion
		#region 确定事件...
		private void btnOk_Click(object sender, System.EventArgs e)
		{
			try
			{
				#region 职工名称日考勤统计
                string emp_Name=this.emp_NameComboBox.Text.ToString().Trim();//职工名称...
                string day_statictis=System.DateTime.Now.ToLongDateString().Trim();//日期...
				string weekDay=returnWeekDay();//星期几...
				string strTime=System.DateTime.Now.ToLongTimeString().Trim();//时间...
				string CountUncome=StaticUnCome();//未到次数...
				string CountLate=StaticLate();//迟到次数...
				string System_Autor=returnString();//备注...
				string insertDayStatictis="Insert into Day_Statictis_Table(职工名称,统计日期,统计星期,统计时间,未到次数,迟到次数,备注)values('"+emp_Name+"','"+day_statictis+"','"+weekDay+"','"+strTime+"','"+CountUncome+"','"+CountLate+"','"+System_Autor+"')";
				int k=conn.ExcuteStrSql(insertDayStatictis);
				if(k>0)
				{
					string str="成功";
					kaoqintongjihistory(str);
					MessageBox.Show(this,"统计日考勤成功啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				}
				else 
				{
					string str="失败";
					kaoqintongjihistory(str);
					MessageBox.Show(this,"统计日考勤失败啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
				}
				#endregion
			}
			catch(Exception ele)
			{
				ele.ToString();
			}
		}
		#endregion
		#region 取消事件...
		private void btnCancel_Click(object sender, System.EventArgs e)
		{
			try
			{}
			catch(Exception ele)
			{
				ele.ToString();
			}
		}
		#endregion
		#region 导出事件...
		private void btnDaoChu_Click(object sender, System.EventArgs e)
		{
			try
			{
				DialogResult result=MessageBox.Show(this,"是则是进行日考勤统计,否则是进月考勤统计啊!!!","提示信息",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
				if(result.Equals(DialogResult.Yes))
				{
					DayStatictisFrame log=new DayStatictisFrame(this.emp_NameComboBox.Text.ToString().Trim(),this.EndDateTime.Text.ToString().Trim());
					log.ShowDialog();
				}
				else
				{
                    MonthStatistisFrame log=new MonthStatistisFrame(this.emp_NameComboBox.Text.ToString(),this.startDateTime.Text.ToString(),this.EndDateTime.Text.ToString());
					log.ShowDialog();
				}
			}
			catch(Exception ele)
			{
				ele.ToString();
			}
		}
		#endregion
		#region 光标移动变化...
		private void resultText_MouseLeave(object sender, System.EventArgs e)
		{
			ComboBox combo=(ComboBox)sender;
			combo.DropDownStyle=System.Windows.Forms.ComboBoxStyle.Simple;
		}

		private void resultText_MouseEnter(object sender, System.EventArgs e)
		{
			ComboBox combo=(ComboBox)sender;
			combo.DropDownStyle=System.Windows.Forms.ComboBoxStyle.DropDown;
		}
		private void btnDaoChu_MouseLeave(object sender, System.EventArgs e)
		{
			Button butonn=(Button)sender;
			butonn.FlatStyle=FlatStyle.Flat;
		}

		private void btnDaoChu_MouseEnter(object sender, System.EventArgs e)
		{
			Button butonn=(Button)sender;
			butonn.FlatStyle=FlatStyle.Standard;
		}
		private void radioLastWeek_MouseLeave(object sender, System.EventArgs e)
		{
		    RadioButton redio=(RadioButton)sender;
			redio.FlatStyle=FlatStyle.Flat;
		}

		private void radioLastWeek_MouseEnter(object sender, System.EventArgs e)
		{
			RadioButton redio=(RadioButton)sender;
			redio.FlatStyle=FlatStyle.Standard;
		}
		#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 InitValues()
		private void InitValues()
		{
			#region 初始化... 时,分,秒,星期几,年,月,日,时间变量....
			int hour=System.DateTime.Now.Hour;
			int minute=System.DateTime.Now.Minute;
			int second=System.DateTime.Now.Second;
			int year=System.DateTime.Now.Year;
			int month=System.DateTime.Now.Month;
			int day=System.DateTime.Now.Day;
			string week=System.DateTime.Now.DayOfWeek.ToString().Trim();
			string date=System.DateTime.Now.ToLongDateString();
			string time=System.DateTime.Now.ToLongTimeString();
			#endregion
			#region 改变时间显示...ChangeTimeShow()
			string todayTime =ChangeTimeShow( hour, minute, second);
		    #endregion
		    #region 初始化 三个CheckBox控件的值...
            ChangeCheckedBool(hour);
		    #endregion
			#region 选中Radio控件而改变DateTimePicker控件的值...
			//this.resultText.SelectedIndex=1;
            ChangeCheckIsNotChecked(week,year,month,day);

⌨️ 快捷键说明

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