IncomeTax.cs
资源名称:VCSDB.rar [点击查看]
上传用户:hjieqiu
上传日期:2013-05-11
资源大小:16494k
文件大小:23k
源码类别:
企业管理
开发平台:
C#
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- namespace 人力资源管理系统
- {
- /// <summary>
- /// IncomeTax 的摘要说明。
- /// </summary>
- public class IncomeTax : System.Windows.Forms.Form
- {
- private System.Windows.Forms.DataGrid dataGrid1;
- private System.Windows.Forms.ToolBar toolBar1;
- private System.Windows.Forms.ToolBarButton tbarBtnSave;
- private System.Windows.Forms.ToolBarButton tbarBtnDelete;
- private System.Windows.Forms.ImageList imageList1;
- private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
- private System.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
- private System.Windows.Forms.DataGridTextBoxColumn 编号;
- private System.Windows.Forms.DataGridTextBoxColumn 级数;
- private System.Windows.Forms.DataGridTextBoxColumn 不计税工资;
- private System.Windows.Forms.DataGridTextBoxColumn 工资下限;
- private System.Windows.Forms.DataGridTextBoxColumn 工资上限;
- private System.Windows.Forms.DataGridTextBoxColumn 个人所得税率;
- private System.Windows.Forms.DataGridTextBoxColumn 速算扣除数;
- private System.Windows.Forms.DataGridTextBoxColumn 备注;
- 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 IncomeTax()
- {
- //
- // 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(IncomeTax));
- this.dataGrid1 = new System.Windows.Forms.DataGrid();
- this.dataSet11 = new 人力资源管理系统.DataSet1();
- this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle();
- this.编号 = new System.Windows.Forms.DataGridTextBoxColumn();
- this.级数 = new System.Windows.Forms.DataGridTextBoxColumn();
- this.不计税工资 = new System.Windows.Forms.DataGridTextBoxColumn();
- this.工资下限 = new System.Windows.Forms.DataGridTextBoxColumn();
- this.工资上限 = new System.Windows.Forms.DataGridTextBoxColumn();
- this.个人所得税率 = new System.Windows.Forms.DataGridTextBoxColumn();
- this.速算扣除数 = new System.Windows.Forms.DataGridTextBoxColumn();
- this.备注 = new System.Windows.Forms.DataGridTextBoxColumn();
- this.toolBar1 = new System.Windows.Forms.ToolBar();
- this.tbarBtnSave = new System.Windows.Forms.ToolBarButton();
- this.tbarBtnDelete = new System.Windows.Forms.ToolBarButton();
- this.toolBarQuit = new System.Windows.Forms.ToolBarButton();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- 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();
- ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
- this.SuspendLayout();
- //
- // dataGrid1
- //
- this.dataGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.dataGrid1.CaptionVisible = false;
- this.dataGrid1.DataMember = "个人所得税表";
- this.dataGrid1.DataSource = this.dataSet11;
- this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
- this.dataGrid1.Location = new System.Drawing.Point(0, 40);
- this.dataGrid1.Name = "dataGrid1";
- this.dataGrid1.Size = new System.Drawing.Size(592, 378);
- this.dataGrid1.TabIndex = 1;
- this.dataGrid1.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] {
- this.dataGridTableStyle1});
- //
- // dataSet11
- //
- this.dataSet11.DataSetName = "DataSet1";
- this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
- //
- // dataGridTableStyle1
- //
- this.dataGridTableStyle1.AllowSorting = false;
- this.dataGridTableStyle1.AlternatingBackColor = System.Drawing.Color.LightGray;
- this.dataGridTableStyle1.DataGrid = this.dataGrid1;
- this.dataGridTableStyle1.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] {
- this.编号,
- this.级数,
- this.不计税工资,
- this.工资下限,
- this.工资上限,
- this.个人所得税率,
- this.速算扣除数,
- this.备注});
- this.dataGridTableStyle1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
- this.dataGridTableStyle1.MappingName = "个人所得税表";
- //
- // 编号
- //
- this.编号.Format = "";
- this.编号.FormatInfo = null;
- this.编号.HeaderText = "编号";
- this.编号.MappingName = "编号";
- this.编号.NullText = "";
- this.编号.Width = 35;
- //
- // 级数
- //
- this.级数.Format = "";
- this.级数.FormatInfo = null;
- this.级数.HeaderText = "级数";
- this.级数.MappingName = "级数";
- this.级数.NullText = "";
- this.级数.Width = 35;
- //
- // 不计税工资
- //
- this.不计税工资.Format = "";
- this.不计税工资.FormatInfo = null;
- this.不计税工资.HeaderText = "不计税工资";
- this.不计税工资.MappingName = "不计税工资";
- this.不计税工资.NullText = "";
- this.不计税工资.Width = 75;
- //
- // 工资下限
- //
- this.工资下限.Format = "";
- this.工资下限.FormatInfo = null;
- this.工资下限.HeaderText = "工资下限";
- this.工资下限.MappingName = "工资下限";
- this.工资下限.NullText = "";
- this.工资下限.Width = 75;
- //
- // 工资上限
- //
- this.工资上限.Format = "";
- this.工资上限.FormatInfo = null;
- this.工资上限.HeaderText = "工资上限";
- this.工资上限.MappingName = "工资上限";
- this.工资上限.NullText = "";
- this.工资上限.Width = 75;
- //
- // 个人所得税率
- //
- this.个人所得税率.Format = "";
- this.个人所得税率.FormatInfo = null;
- this.个人所得税率.HeaderText = "个人所得税率";
- this.个人所得税率.MappingName = "个人所得税率";
- this.个人所得税率.NullText = "";
- this.个人所得税率.Width = 75;
- //
- // 速算扣除数
- //
- this.速算扣除数.Format = "";
- this.速算扣除数.FormatInfo = null;
- this.速算扣除数.HeaderText = "速算扣除数";
- this.速算扣除数.MappingName = "速算扣除数";
- this.速算扣除数.NullText = "";
- this.速算扣除数.Width = 75;
- //
- // 备注
- //
- this.备注.Format = "";
- this.备注.FormatInfo = null;
- this.备注.HeaderText = "备注";
- this.备注.MappingName = "备注";
- this.备注.NullText = "";
- this.备注.Width = 200;
- //
- // toolBar1
- //
- this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
- this.tbarBtnSave,
- this.tbarBtnDelete,
- this.toolBarQuit});
- this.toolBar1.DropDownArrows = true;
- this.toolBar1.ImageList = this.imageList1;
- this.toolBar1.Location = new System.Drawing.Point(0, 0);
- this.toolBar1.Name = "toolBar1";
- this.toolBar1.ShowToolTips = true;
- this.toolBar1.Size = new System.Drawing.Size(592, 41);
- this.toolBar1.TabIndex = 24;
- this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
- //
- // tbarBtnSave
- //
- this.tbarBtnSave.ImageIndex = 0;
- this.tbarBtnSave.Text = "保存修改";
- this.tbarBtnSave.ToolTipText = "保存修改";
- //
- // tbarBtnDelete
- //
- this.tbarBtnDelete.ImageIndex = 1;
- this.tbarBtnDelete.Text = "删除数据";
- this.tbarBtnDelete.ToolTipText = "删除数据";
- //
- // toolBarQuit
- //
- this.toolBarQuit.ImageIndex = 2;
- this.toolBarQuit.Text = "退出";
- this.toolBarQuit.ToolTipText = "退出";
- //
- // 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;
- //
- // 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_不计税工资) AND (个人所得税率 = @Original_个人所得税率) AND (备注 = @Original_备注 OR @Original_备注 IS NULL AND 备注 IS NULL) AND (工资上限 = @Original_工资上限) AND (工资下限 = @Original_工资下限) AND (级数 = @Original_级数) AND (速算扣除数 = @Original_速算扣除数)";
- 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.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "不计税工资", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_个人所得税率", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "个人所得税率", 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.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "工资上限", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_工资下限", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "工资下限", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_级数", System.Data.SqlDbType.VarChar, 2, 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.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "速算扣除数", 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 (编号 = @编号)";
- this.sqlInsertCommand1.Connection = this.sqlConnection1;
- 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, 2, "级数"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@不计税工资", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "不计税工资", System.Data.DataRowVersion.Current, null));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@工资下限", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "工资下限", System.Data.DataRowVersion.Current, null));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@工资上限", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "工资上限", System.Data.DataRowVersion.Current, null));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@个人所得税率", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "个人所得税率", System.Data.DataRowVersion.Current, null));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@速算扣除数", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "速算扣除数", System.Data.DataRowVersion.Current, null));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@备注", System.Data.SqlDbType.VarChar, 50, "备注"));
- //
- // sqlSelectCommand1
- //
- this.sqlSelectCommand1.CommandText = "SELECT 编号, 级数, 不计税工资, 工资下限, 工资上限, 个人所得税率, 速算扣除数, 备注 FROM 个人所得税表";
- this.sqlSelectCommand1.Connection = this.sqlConnection1;
- //
- // sqlUpdateCommand1
- //
- this.sqlUpdateCommand1.CommandText = @"UPDATE 个人所得税表 SET 编号 = @编号, 级数 = @级数, 不计税工资 = @不计税工资, 工资下限 = @工资下限, 工资上限 = @工资上限, 个人所得税率 = @个人所得税率, 速算扣除数 = @速算扣除数, 备注 = @备注 WHERE (编号 = @Original_编号) AND (不计税工资 = @Original_不计税工资) AND (个人所得税率 = @Original_个人所得税率) AND (备注 = @Original_备注 OR @Original_备注 IS NULL AND 备注 IS NULL) AND (工资上限 = @Original_工资上限) AND (工资下限 = @Original_工资下限) AND (级数 = @Original_级数) AND (速算扣除数 = @Original_速算扣除数); SELECT 编号, 级数, 不计税工资, 工资下限, 工资上限, 个人所得税率, 速算扣除数, 备注 FROM 个人所得税表 WHERE (编号 = @编号)";
- this.sqlUpdateCommand1.Connection = this.sqlConnection1;
- 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, 2, "级数"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@不计税工资", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "不计税工资", System.Data.DataRowVersion.Current, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@工资下限", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "工资下限", System.Data.DataRowVersion.Current, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@工资上限", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "工资上限", System.Data.DataRowVersion.Current, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@个人所得税率", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "个人所得税率", System.Data.DataRowVersion.Current, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@速算扣除数", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "速算扣除数", System.Data.DataRowVersion.Current, null));
- 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.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "不计税工资", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_个人所得税率", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "个人所得税率", 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.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "工资上限", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_工资下限", System.Data.SqlDbType.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "工资下限", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_级数", System.Data.SqlDbType.VarChar, 2, 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.Decimal, 13, System.Data.ParameterDirection.Input, false, ((System.Byte)(26)), ((System.Byte)(2)), "速算扣除数", System.Data.DataRowVersion.Original, null));
- //
- // IncomeTax
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.ClientSize = new System.Drawing.Size(592, 423);
- this.Controls.Add(this.dataGrid1);
- this.Controls.Add(this.toolBar1);
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.Name = "IncomeTax";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "【个人所得税率】";
- this.Load += new System.EventHandler(this.IncomeTax_Load);
- ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- //--------------------初始化窗体,读入数据------------------
- private void IncomeTax_Load(object sender, System.EventArgs e)
- {
- this.sqlDataAdapter1.Fill(this.dataSet11.个人所得税表);
- }
- //--------------保存修改过的数据或删除某条数据------------------
- private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
- {
- if(e.Button.ToolTipText == "保存修改")
- {
- try
- {
- /*int row = this.dataGrid1.CurrentCell.RowNumber;
- //将当前所在行往下移动一行,为便于实现同步保存
- //(否则会出现修改的最后一行无法保存,因为它还处于编辑状态)
- this.dataGrid1.CurrentCell = new DataGridCell(row+1,0);
- //使光标回到修改前的当前行来
- this.dataGrid1.CurrentCell = new DataGridCell(row,0);*/
- if (this.dataSet11.个人所得税表.GetChanges() != null)
- {
- this.sqlDataAdapter1.Update(this.dataSet11);
- MessageBox.Show("数据保存成功!","信息");
- return;
- }
- else
- {
- MessageBox.Show("没有修改任何数据!","信息");
- return;
- }
- }
- catch
- {
- MessageBox.Show("数据修改失败,请重试!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
- return;
- }
- }
- if(e.Button.ToolTipText == "删除数据")
- {
- if (MessageBox.Show(" 确实要删除这条记录吗?","询问",MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- int intRowNumber = this.dataGrid1.CurrentCell.RowNumber;
- try
- {
- this.dataSet11.个人所得税表.Rows[intRowNumber].Delete();
- this.sqlDataAdapter1.Update(this.dataSet11.个人所得税表);
- MessageBox.Show("数据删除成功!","信息");
- return;
- }
- catch
- {
- MessageBox.Show("数据删除失败,请重试!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
- return;
- }
- }
- }
- if (e.Button.ToolTipText == "退出")
- {
- this.Close();
- }
- }
- }
- }