HortationManage.cs
资源名称:VCSDB.rar [点击查看]
上传用户:hjieqiu
上传日期:2013-05-11
资源大小:16494k
文件大小:26k
源码类别:
企业管理
开发平台:
C#
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- namespace 人力资源管理系统
- {
- /// <summary>
- /// HortationManage 的摘要说明。
- /// </summary>
- public class HortationManage : System.Windows.Forms.Form
- {
- private CurrencyManager cmManage;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.TextBox txt1;
- private System.Windows.Forms.TextBox txt2;
- private System.Windows.Forms.TextBox txt3;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.Label label7;
- private System.Windows.Forms.Label label8;
- private System.Windows.Forms.Label label18;
- private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
- private System.Windows.Forms.TextBox txt7;
- private System.Windows.Forms.TextBox txt6;
- private System.Windows.Forms.TextBox txt5;
- private System.Windows.Forms.TextBox txt4;
- private System.Windows.Forms.ImageList imageList1;
- private System.Windows.Forms.ToolBar toolBar;
- private System.Windows.Forms.ToolBarButton toolBarFirst;
- private System.Windows.Forms.ToolBarButton toolBarPre;
- private System.Windows.Forms.ToolBarButton toolBarNext;
- private System.Windows.Forms.ToolBarButton toolBarLast;
- private System.Windows.Forms.ToolBarButton tbarBtnNew;
- private System.Windows.Forms.ToolBarButton tbarBtnDelete;
- private System.Windows.Forms.ToolBarButton toolBarSubmit;
- private System.Windows.Forms.ToolBarButton toolBarCancel;
- private System.Windows.Forms.ToolBarButton toolBarQuit;
- 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.SqlConnection sqlConnection1;
- private 人力资源管理系统.DataSet1 dataSet11;
- private System.ComponentModel.IContainer components;
- public HortationManage()
- {
- //
- // Windows 窗体设计器支持所必需的
- //
- InitializeComponent();
- //
- // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
- //
- }
- /// <summary>
- /// 清理所有正在使用的资源。
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #region Windows 窗体设计器生成的代码
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(HortationManage));
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.txt7 = new System.Windows.Forms.TextBox();
- this.txt6 = new System.Windows.Forms.TextBox();
- this.txt1 = new System.Windows.Forms.TextBox();
- this.txt2 = new System.Windows.Forms.TextBox();
- this.txt5 = new System.Windows.Forms.TextBox();
- this.txt3 = new System.Windows.Forms.TextBox();
- this.txt4 = new System.Windows.Forms.TextBox();
- this.label3 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.label6 = new System.Windows.Forms.Label();
- this.label7 = new System.Windows.Forms.Label();
- this.label8 = new System.Windows.Forms.Label();
- this.label18 = new System.Windows.Forms.Label();
- this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
- this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
- this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.toolBar = new System.Windows.Forms.ToolBar();
- this.toolBarFirst = new System.Windows.Forms.ToolBarButton();
- this.toolBarPre = new System.Windows.Forms.ToolBarButton();
- this.toolBarNext = new System.Windows.Forms.ToolBarButton();
- this.toolBarLast = new System.Windows.Forms.ToolBarButton();
- this.tbarBtnNew = new System.Windows.Forms.ToolBarButton();
- this.tbarBtnDelete = new System.Windows.Forms.ToolBarButton();
- this.toolBarSubmit = new System.Windows.Forms.ToolBarButton();
- this.toolBarCancel = new System.Windows.Forms.ToolBarButton();
- this.toolBarQuit = new System.Windows.Forms.ToolBarButton();
- this.dataSet11 = new 人力资源管理系统.DataSet1();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox1.Controls.Add(this.txt7);
- this.groupBox1.Controls.Add(this.txt6);
- this.groupBox1.Controls.Add(this.txt1);
- this.groupBox1.Controls.Add(this.txt2);
- this.groupBox1.Controls.Add(this.txt5);
- this.groupBox1.Controls.Add(this.txt3);
- this.groupBox1.Controls.Add(this.txt4);
- this.groupBox1.Controls.Add(this.label3);
- this.groupBox1.Controls.Add(this.label4);
- this.groupBox1.Controls.Add(this.label5);
- this.groupBox1.Controls.Add(this.label6);
- this.groupBox1.Controls.Add(this.label7);
- this.groupBox1.Controls.Add(this.label8);
- this.groupBox1.Controls.Add(this.label18);
- this.groupBox1.Location = new System.Drawing.Point(4, 47);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(632, 249);
- this.groupBox1.TabIndex = 3;
- this.groupBox1.TabStop = false;
- //
- // txt7
- //
- this.txt7.Location = new System.Drawing.Point(336, 192);
- this.txt7.Name = "txt7";
- this.txt7.Size = new System.Drawing.Size(216, 21);
- this.txt7.TabIndex = 6;
- this.txt7.Text = "";
- //
- // txt6
- //
- this.txt6.Location = new System.Drawing.Point(72, 192);
- this.txt6.Name = "txt6";
- this.txt6.Size = new System.Drawing.Size(240, 21);
- this.txt6.TabIndex = 5;
- this.txt6.Text = "";
- //
- // txt1
- //
- this.txt1.Location = new System.Drawing.Point(72, 64);
- this.txt1.Name = "txt1";
- this.txt1.Size = new System.Drawing.Size(128, 21);
- this.txt1.TabIndex = 0;
- this.txt1.Text = "";
- //
- // txt2
- //
- this.txt2.Location = new System.Drawing.Point(232, 64);
- this.txt2.Name = "txt2";
- this.txt2.Size = new System.Drawing.Size(320, 21);
- this.txt2.TabIndex = 1;
- this.txt2.Text = "";
- //
- // txt5
- //
- this.txt5.Location = new System.Drawing.Point(416, 136);
- this.txt5.Name = "txt5";
- this.txt5.Size = new System.Drawing.Size(136, 21);
- this.txt5.TabIndex = 4;
- this.txt5.Text = "";
- //
- // txt3
- //
- this.txt3.Location = new System.Drawing.Point(72, 136);
- this.txt3.Name = "txt3";
- this.txt3.Size = new System.Drawing.Size(128, 21);
- this.txt3.TabIndex = 2;
- this.txt3.Text = "";
- //
- // txt4
- //
- this.txt4.Location = new System.Drawing.Point(232, 136);
- this.txt4.Name = "txt4";
- this.txt4.Size = new System.Drawing.Size(152, 21);
- this.txt4.TabIndex = 3;
- this.txt4.Text = "";
- //
- // label3
- //
- this.label3.Location = new System.Drawing.Point(416, 112);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(88, 16);
- this.label3.TabIndex = 19;
- this.label3.Text = "是否记入工资";
- //
- // label4
- //
- this.label4.Location = new System.Drawing.Point(72, 168);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(64, 16);
- this.label4.TabIndex = 19;
- this.label4.Text = "奖励原因";
- //
- // label5
- //
- this.label5.Location = new System.Drawing.Point(336, 168);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(64, 16);
- this.label5.TabIndex = 19;
- this.label5.Text = "部门意见";
- //
- // label6
- //
- this.label6.Location = new System.Drawing.Point(232, 40);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(64, 16);
- this.label6.TabIndex = 19;
- this.label6.Text = "奖励类型";
- //
- // label7
- //
- this.label7.Location = new System.Drawing.Point(232, 112);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(64, 16);
- this.label7.TabIndex = 19;
- this.label7.Text = "奖励日期";
- //
- // label8
- //
- this.label8.Location = new System.Drawing.Point(72, 40);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(64, 16);
- this.label8.TabIndex = 19;
- this.label8.Text = "职员编号";
- //
- // label18
- //
- this.label18.Location = new System.Drawing.Point(72, 112);
- this.label18.Name = "label18";
- this.label18.Size = new System.Drawing.Size(64, 16);
- this.label18.TabIndex = 19;
- this.label18.Text = "奖励金额";
- //
- // sqlDataAdapter1
- //
- this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
- this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
- this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
- 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();
- }
- }
- }
- }