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

📄 hortationmanage.cs

📁 人力资源管理系统采用C#源码 在。NET平台上开发的 代码使用方便
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																									  new System.Data.Common.DataTableMapping("Table", "职员奖励表", 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.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
			// 
			// sqlDeleteCommand1
			// 
			this.sqlDeleteCommand1.CommandText = @"DELETE FROM 职员奖励表 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_职员编号) AND (部门意见 = @Original_部门意见 OR @Original_部门意见 IS NULL AND 部门意见 IS NULL)";
			this.sqlDeleteCommand1.Connection = this.sqlConnection1;
			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, 20, 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.Float, 8, 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, 10, 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, 30, 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, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "部门意见", System.Data.DataRowVersion.Original, null));
			// 
			// sqlConnection1
			// 
			this.sqlConnection1.ConnectionString = "workstation id=localhost;Integrated Security=SSPI;Database=hrmbook;";
			// 
			// sqlInsertCommand1
			// 
			this.sqlInsertCommand1.CommandText = "INSERT INTO 职员奖励表(职员编号, 奖励类型, 奖励金额, 是否计入工资, 奖励原因, 部门意见, 奖励日期) VALUES (@职员编号, @奖励类" +
				"型, @奖励金额, @是否计入工资, @奖励原因, @部门意见, @奖励日期); SELECT 序号, 职员编号, 奖励类型, 奖励金额, 是否计入工资, 奖励" +
				"原因, 部门意见, 奖励日期 FROM 职员奖励表 WHERE (序号 = @@IDENTITY)";
			this.sqlInsertCommand1.Connection = this.sqlConnection1;
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@职员编号", System.Data.SqlDbType.VarChar, 30, "职员编号"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@奖励类型", System.Data.SqlDbType.VarChar, 20, "奖励类型"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@奖励金额", System.Data.SqlDbType.Float, 8, "奖励金额"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@是否计入工资", System.Data.SqlDbType.VarChar, 10, "是否计入工资"));
			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, 100, "部门意见"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@奖励日期", System.Data.SqlDbType.Int, 4, "奖励日期"));
			// 
			// sqlSelectCommand1
			// 
			this.sqlSelectCommand1.CommandText = "SELECT 序号, 职员编号, 奖励类型, 奖励金额, 是否计入工资, 奖励原因, 部门意见, 奖励日期 FROM 职员奖励表";
			this.sqlSelectCommand1.Connection = this.sqlConnection1;
			// 
			// sqlUpdateCommand1
			// 
			this.sqlUpdateCommand1.CommandText = @"UPDATE 职员奖励表 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_职员编号) AND (部门意见 = @Original_部门意见 OR @Original_部门意见 IS NULL AND 部门意见 IS NULL); SELECT 序号, 职员编号, 奖励类型, 奖励金额, 是否计入工资, 奖励原因, 部门意见, 奖励日期 FROM 职员奖励表 WHERE (序号 = @序号)";
			this.sqlUpdateCommand1.Connection = this.sqlConnection1;
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@职员编号", System.Data.SqlDbType.VarChar, 30, "职员编号"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@奖励类型", System.Data.SqlDbType.VarChar, 20, "奖励类型"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@奖励金额", System.Data.SqlDbType.Float, 8, "奖励金额"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@是否计入工资", System.Data.SqlDbType.VarChar, 10, "是否计入工资"));
			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, 100, "部门意见"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@奖励日期", System.Data.SqlDbType.Int, 4, "奖励日期"));
			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, 20, 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.Float, 8, 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, 10, 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, 30, 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, 100, 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, "序号"));
			// 
			// imageList1
			// 
			this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
			this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// toolBar
			// 
			this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
																					   this.toolBarFirst,
																					   this.toolBarPre,
																					   this.toolBarNext,
																					   this.toolBarLast,
																					   this.tbarBtnNew,
																					   this.tbarBtnDelete,
																					   this.toolBarSubmit,
																					   this.toolBarCancel,
																					   this.toolBarQuit});
			this.toolBar.DropDownArrows = true;
			this.toolBar.ImageList = this.imageList1;
			this.toolBar.Location = new System.Drawing.Point(0, 0);
			this.toolBar.Name = "toolBar";
			this.toolBar.ShowToolTips = true;
			this.toolBar.Size = new System.Drawing.Size(640, 41);
			this.toolBar.TabIndex = 26;
			this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
			// 
			// toolBarFirst
			// 
			this.toolBarFirst.ImageIndex = 0;
			this.toolBarFirst.Text = "首记录";
			this.toolBarFirst.ToolTipText = "首记录";
			// 
			// toolBarPre
			// 
			this.toolBarPre.ImageIndex = 1;
			this.toolBarPre.Text = "上一记录";
			this.toolBarPre.ToolTipText = "上一记录";
			// 
			// toolBarNext
			// 
			this.toolBarNext.ImageIndex = 2;
			this.toolBarNext.Text = "下一记录";
			this.toolBarNext.ToolTipText = "下一记录";
			// 
			// toolBarLast
			// 
			this.toolBarLast.ImageIndex = 3;
			this.toolBarLast.Text = "尾记录";
			this.toolBarLast.ToolTipText = "尾记录";
			// 
			// tbarBtnNew
			// 
			this.tbarBtnNew.ImageIndex = 4;
			this.tbarBtnNew.Text = "新增记录";
			this.tbarBtnNew.ToolTipText = "新增记录";
			// 
			// tbarBtnDelete
			// 
			this.tbarBtnDelete.ImageIndex = 5;
			this.tbarBtnDelete.Text = "删除记录";
			this.tbarBtnDelete.ToolTipText = "删除记录";
			// 
			// toolBarSubmit
			// 
			this.toolBarSubmit.ImageIndex = 6;
			this.toolBarSubmit.Text = "提交修改";
			this.toolBarSubmit.ToolTipText = "提交修改";
			// 
			// toolBarCancel
			// 
			this.toolBarCancel.ImageIndex = 7;
			this.toolBarCancel.Text = "取消修改";
			this.toolBarCancel.ToolTipText = "取消修改";
			// 
			// toolBarQuit
			// 
			this.toolBarQuit.ImageIndex = 8;
			this.toolBarQuit.Text = "退出";
			this.toolBarQuit.ToolTipText = "退出";
			// 
			// dataSet11
			// 
			this.dataSet11.DataSetName = "DataSet1";
			this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// HortationManage
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(640, 357);
			this.Controls.Add(this.toolBar);
			this.Controls.Add(this.groupBox1);
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Name = "HortationManage";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "【职员奖励管理】";
			this.Load += new System.EventHandler(this.HortationManage_Load);
			this.groupBox1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		//--------------------初始化窗体,读入数据------------------
		private void HortationManage_Load(object sender, System.EventArgs e)
		{
			this.sqlDataAdapter1.Fill(this.dataSet11.职员奖励表);
			cmManage = (CurrencyManager) BindingContext[this.dataSet11,"职员奖励表"];
			cmManage.Position = 0;
		}
		//------------------处理数据导航条和新增修改等事务---------------------
		private void toolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			if (e.Button.ToolTipText == "首记录")
			{
				cmManage.Position = 0;
				return;
			}
			if (e.Button.ToolTipText == "上一记录")
			{
				if (cmManage.Position > 0)
					cmManage.Position--;
				return;
			}
			if (e.Button.ToolTipText == "下一记录")
			{
				if (cmManage.Position < cmManage.Count-1)
					cmManage.Position++;
				return;
			}
			if (e.Button.ToolTipText == "尾记录")
			{
				cmManage.Position = cmManage.Count-1;
				return;
			}
			if (e.Button.ToolTipText == "新增记录")
			{
				cmManage.AddNew();
				return;
			}
			if (e.Button.ToolTipText == "删除记录")
			{
				if (MessageBox.Show("确实要删除这条记录吗?","询问",MessageBoxButtons.YesNo) == DialogResult.Yes)
				{
					if (cmManage.Count > 0)
						cmManage.RemoveAt(cmManage.Position);
					else
					{
						MessageBox.Show("没有可以删除的数据","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
					}
					return;
				}
			}
			if (e.Button.ToolTipText == "提交修改")
			{
				if (this.txt1.Text.Trim() == "")
				{
					MessageBox.Show("职员编号不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
					return;
				}
				cmManage.EndCurrentEdit();
				if (this.dataSet11.职员奖励表.GetChanges() != null)
				{
					try
					{
						this.sqlDataAdapter1.Update(this.dataSet11.职员奖励表);
					}
					catch(Exception express)
					{
						MessageBox.Show(express.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
					}
				}
				return;
			}
			if (e.Button.ToolTipText == "取消修改")
			{
				try
				{
					cmManage.CancelCurrentEdit();  //取消编辑
				}
				catch(Exception express)
				{
					MessageBox.Show(express.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
				}
				return;
			}
			if (e.Button.ToolTipText == "退出")
			{
				this.Close();
			}
		}
	}
}

⌨️ 快捷键说明

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