using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Data.OleDb;
using Excel=Microsoft.Office.Interop.Excel;
namespace ENSS
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
#region 控件和变量声明
public ArrayList dataRow ;//局长表的变色数据行
public ArrayList rowNum ;//局长表的变色数据列数目
public ArrayList dataRow1 ;//普通表的变色数据行
public ArrayList rowNum1 ;//普通表的变色数据列数目
public DataSet ds;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem miFile;
private System.Windows.Forms.MenuItem miHelp;
private System.Windows.Forms.MenuItem miImport;
private System.Windows.Forms.MenuItem miQuit;
private System.Windows.Forms.MenuItem miAbout;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.DataGrid dataGrid3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button btnSubmit;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.GroupBox groupBox1;
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 label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label25;
private System.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn2;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn3;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn4;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.DataGrid dataGrid2;
private System.Windows.Forms.RadioButton radioButton3;
private System.Windows.Forms.RadioButton radioButton4;
private System.Windows.Forms.RadioButton radioButton5;
private System.Windows.Forms.RadioButton radioButton6;
private System.Windows.Forms.RadioButton radioButton7;
private System.Windows.Forms.RadioButton radioButton8;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button4;
private ENSS.NumberTextBox textBox1;
private ENSS.NumberTextBox textBox2;
private ENSS.NumberTextBox textBox3;
private ENSS.NumberTextBox textBox4;
private ENSS.NumberTextBox textBox5;
private ENSS.NumberTextBox textBox6;
private ENSS.NumberTextBox textBox7;
private ENSS.NumberTextBox textBox8;
private ENSS.NumberTextBox textBox9;
private ENSS.NumberTextBox textBox10;
private ENSS.NumberTextBox textBox11;
private ENSS.NumberTextBox textBox12;
private ENSS.NumberTextBox textBox13;
private ENSS.NumberTextBox textBox14;
private ENSS.NumberTextBox textBox15;
private ENSS.NumberTextBox textBox16;
private ENSS.NumberTextBox textBox17;
private ENSS.NumberTextBox textBox18;
private ENSS.NumberTextBox textBox19;
private ENSS.NumberTextBox textBox25;
private ENSS.NumberTextBox textBox20;
private ENSS.NumberTextBox textBox21;
private ENSS.NumberTextBox textBox22;
private ENSS.NumberTextBox textBox23;
private ENSS.NumberTextBox textBox24;
private ENSS.NumberTextBox textBox26;
private ENSS.NumberTextBox textBox27;
private ENSS.NumberTextBox textBox28;
private ENSS.NumberTextBox textBox29;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
#endregion
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.Button btnRead;
private System.Windows.Forms.Button btnDel;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// 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()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.miFile = new System.Windows.Forms.MenuItem();
this.miImport = new System.Windows.Forms.MenuItem();
this.miQuit = new System.Windows.Forms.MenuItem();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.miHelp = new System.Windows.Forms.MenuItem();
this.miAbout = new System.Windows.Forms.MenuItem();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.btnSubmit = new System.Windows.Forms.Button();
this.dataGrid3 = new System.Windows.Forms.DataGrid();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel6 = new System.Windows.Forms.Panel();
this.button3 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.panel5 = new System.Windows.Forms.Panel();
this.button2 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.dataGrid2 = new System.Windows.Forms.DataGrid();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn2 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn3 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn4 = new System.Windows.Forms.DataGridTextBoxColumn();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.textBox25 = new ENSS.NumberTextBox();
this.textBox19 = new ENSS.NumberTextBox();
this.textBox18 = new ENSS.NumberTextBox();
this.textBox17 = new ENSS.NumberTextBox();
this.textBox4 = new ENSS.NumberTextBox();
this.textBox3 = new ENSS.NumberTextBox();
this.textBox2 = new ENSS.NumberTextBox();
this.textBox1 = new ENSS.NumberTextBox();
this.panel3 = new System.Windows.Forms.Panel();
this.textBox28 = new ENSS.NumberTextBox();
this.radioButton5 = new System.Windows.Forms.RadioButton();
this.radioButton6 = new System.Windows.Forms.RadioButton();
this.panel2 = new System.Windows.Forms.Panel();
this.textBox27 = new ENSS.NumberTextBox();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.radioButton4 = new System.Windows.Forms.RadioButton();
this.panel1 = new System.Windows.Forms.Panel();
this.textBox26 = new ENSS.NumberTextBox();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.label25 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.textBox24 = new ENSS.NumberTextBox();
this.textBox23 = new ENSS.NumberTextBox();
this.textBox22 = new ENSS.NumberTextBox();
this.textBox21 = new ENSS.NumberTextBox();
this.textBox20 = new ENSS.NumberTextBox();
this.label24 = new System.Windows.Forms.Label();
this.label23 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.label18 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.textBox15 = new ENSS.NumberTextBox();
this.textBox14 = new ENSS.NumberTextBox();
this.textBox13 = new ENSS.NumberTextBox();
this.textBox12 = new ENSS.NumberTextBox();
this.textBox11 = new ENSS.NumberTextBox();
this.label15 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox10 = new ENSS.NumberTextBox();
this.textBox9 = new ENSS.NumberTextBox();
this.textBox8 = new ENSS.NumberTextBox();
this.textBox7 = new ENSS.NumberTextBox();
this.textBox6 = new ENSS.NumberTextBox();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.textBox5 = new ENSS.NumberTextBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.panel4 = new System.Windows.Forms.Panel();
this.textBox29 = new ENSS.NumberTextBox();
this.radioButton7 = new System.Windows.Forms.RadioButton();
this.radioButton8 = new System.Windows.Forms.RadioButton();
this.textBox16 = new ENSS.NumberTextBox();
this.btnRead = new System.Windows.Forms.Button();
this.btnDel = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid3)).BeginInit();
this.tabPage2.SuspendLayout();
this.panel6.SuspendLayout();
this.panel5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.tabPage3.SuspendLayout();
this.panel3.SuspendLayout();
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.panel4.SuspendLayout();
this.SuspendLayout();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.miFile,
this.menuItem1,
this.miHelp});
//
// miFile
//
this.miFile.Index = 0;
this.miFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.miImport,
this.miQuit});
this.miFile.Text = "文件";
//
// miImport
//
this.miImport.Index = 0;
this.miImport.Text = "导入Excel";
this.miImport.Click += new System.EventHandler(this.miImport_Click);
//
// miQuit
//
this.miQuit.Index = 1;
this.miQuit.Text = "退出";
this.miQuit.Click += new System.EventHandler(this.miQuit_Click);
//
// menuItem1
//
this.menuItem1.Index = 1;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2});
this.menuItem1.Text = "配置";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Text = "设定分数";
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
//
// miHelp
//
this.miHelp.Index = 2;
this.miHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.miAbout});
this.miHelp.Text = "帮助";
//
// miAbout
//
this.miAbout.Index = 0;
this.miAbout.Text = "关于";
this.miAbout.Click += new System.EventHandler(this.miAbout_Click);
//
// tabControl1
//
this.tabControl1.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.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Location = new System.Drawing.Point(16, 8);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(704, 648);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.btnDel);
this.tabPage1.Controls.Add(this.btnRead);
this.tabPage1.Controls.Add(this.button4);
this.tabPage1.Controls.Add(this.button5);
this.tabPage1.Controls.Add(this.btnSave);
this.tabPage1.Controls.Add(this.btnSubmit);
this.tabPage1.Controls.Add(this.dataGrid3);
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(696, 623);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "职工自然状况表";
//
// button4
//
this.button4.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.button4.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button4.Location = new System.Drawing.Point(464, 576);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(100, 28);
this.button4.TabIndex = 5;
this.button4.Text = "导出";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.button5.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button5.Location = new System.Drawing.Point(128, 576);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(100, 28);
this.button5.TabIndex = 4;
this.button5.Text = "修改";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// btnSave
//
this.btnSave.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnSave.Location = new System.Drawing.Point(240, 576);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(100, 28);
this.btnSave.TabIndex = 2;
this.btnSave.Text = "保存";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// btnSubmit
//
this.btnSubmit.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btnSubmit.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnSubmit.Location = new System.Drawing.Point(576, 576);
this.btnSubmit.Name = "btnSubmit";
this.btnSubmit.Size = new System.Drawing.Size(100, 28);
this.btnSubmit.TabIndex = 1;
this.btnSubmit.Text = "生成计分表";
this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
//
// dataGrid3
//
this.dataGrid3.AlternatingBackColor = System.Drawing.Color.White;
this.dataGrid3.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.dataGrid3.BackColor = System.Drawing.Color.White;
this.dataGrid3.BackgroundColor = System.Drawing.Color.Ivory;
this.dataGrid3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.dataGrid3.CaptionBackColor = System.Drawing.Color.DarkSlateBlue;
this.dataGrid3.CaptionForeColor = System.Drawing.Color.Lavender;
this.dataGrid3.CaptionText = "导入的职工表";
this.dataGrid3.DataMember = "";
this.dataGrid3.FlatMode = true;
this.dataGrid3.Font = new System.Drawing.Font("Tahoma", 8F);
this.dataGrid3.ForeColor = System.Drawing.Color.Black;
this.dataGrid3.GridLineColor = System.Drawing.Color.Wheat;
this.dataGrid3.HeaderBackColor = System.Drawing.Color.CadetBlue;
this.dataGrid3.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
this.dataGrid3.HeaderForeColor = System.Drawing.Color.Black;
this.dataGrid3.LinkColor = System.Drawing.Color.DarkSlateBlue;
this.dataGrid3.Location = new System.Drawing.Point(0, 0);
this.dataGrid3.Name = "dataGrid3";
this.dataGrid3.ParentRowsBackColor = System.Drawing.Color.Ivory;
this.dataGrid3.ParentRowsForeColor = System.Drawing.Color.Black;
this.dataGrid3.SelectionBackColor = System.Drawing.Color.Wheat;
this.dataGrid3.SelectionForeColor = System.Drawing.Color.DarkSlateBlue;
this.dataGrid3.Size = new System.Drawing.Size(696, 560);
this.dataGrid3.TabIndex = 0;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.panel6);
this.tabPage2.Controls.Add(this.panel5);
this.tabPage2.Controls.Add(this.dataGrid2);
this.tabPage2.Controls.Add(this.dataGrid1);
this.tabPage2.Location = new System.Drawing.Point(4, 21);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(696, 623);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "职工自然状况计分表";
//
// panel6
//
this.panel6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel6.Controls.Add(this.button3);
this.panel6.Controls.Add(this.button7);
this.panel6.Location = new System.Drawing.Point(8, 588);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(680, 24);
this.panel6.TabIndex = 8;
//
// button3
//
this.button3.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button3.Location = new System.Drawing.Point(-4, 0);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(160, 24);
this.button3.TabIndex = 3;
this.button3.Text = "导出普通表";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button7
//
this.button7.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.button7.Enabled = false;
this.button7.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button7.Location = new System.Drawing.Point(468, 0);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(216, 24);
this.button7.TabIndex = 6;
this.button7.Text = "普通表同分重排";
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// panel5
//
this.panel5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel5.Controls.Add(this.button2);
this.panel5.Controls.Add(this.button6);
this.panel5.Location = new System.Drawing.Point(0, 296);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(688, 32);
this.panel5.TabIndex = 7;
//
// button2
//
this.button2.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button2.Location = new System.Drawing.Point(0, 0);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(172, 24);
this.button2.TabIndex = 2;
this.button2.Text = "导出局长表";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button6
//
this.button6.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.button6.Enabled = false;
this.button6.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button6.Location = new System.Drawing.Point(480, 0);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(216, 24);
this.button6.TabIndex = 5;
this.button6.Text = "局长表同分重排";
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// dataGrid2
//
this.dataGrid2.AllowSorting = false;
this.dataGrid2.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.dataGrid2.CaptionText = "普通计分表";
this.dataGrid2.DataMember = "";
this.dataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid2.Location = new System.Drawing.Point(0, 328);
this.dataGrid2.Name = "dataGrid2";
this.dataGrid2.Size = new System.Drawing.Size(696, 256);
this.dataGrid2.TabIndex = 4;
//
// dataGrid1
//
this.dataGrid1.AllowSorting = false;
this.dataGrid1.AlternatingBackColor = System.Drawing.Color.White;
this.dataGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGrid1.BackColor = System.Drawing.Color.White;
this.dataGrid1.BackgroundColor = System.Drawing.Color.Ivory;
this.dataGrid1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.dataGrid1.CaptionBackColor = System.Drawing.Color.DarkSlateBlue;
this.dataGrid1.CaptionForeColor = System.Drawing.Color.Lavender;
this.dataGrid1.CaptionText = "局长计分表";
this.dataGrid1.DataMember = "";
this.dataGrid1.FlatMode = true;
this.dataGrid1.Font = new System.Drawing.Font("Tahoma", 8F);
this.dataGrid1.ForeColor = System.Drawing.Color.Black;
this.dataGrid1.GridLineColor = System.Drawing.Color.Wheat;
this.dataGrid1.HeaderBackColor = System.Drawing.Color.CadetBlue;
this.dataGrid1.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
this.dataGrid1.HeaderForeColor = System.Drawing.Color.Black;
this.dataGrid1.LinkColor = System.Drawing.Color.DarkSlateBlue;
this.dataGrid1.Location = new System.Drawing.Point(0, 0);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ParentRowsBackColor = System.Drawing.Color.Ivory;
this.dataGrid1.ParentRowsForeColor = System.Drawing.Color.Black;
this.dataGrid1.SelectionBackColor = System.Drawing.Color.Wheat;
this.dataGrid1.SelectionForeColor = System.Drawing.Color.DarkSlateBlue;
this.dataGrid1.Size = new System.Drawing.Size(696, 288);
this.dataGrid1.TabIndex = 0;
this.dataGrid1.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] {
this.dataGridTableStyle1});
//
// dataGridTableStyle1
//
this.dataGridTableStyle1.DataGrid = this.dataGrid1;
this.dataGridTableStyle1.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] {
this.dataGridTextBoxColumn1,
this.dataGridTextBoxColumn2,
this.dataGridTextBoxColumn3,
this.dataGridTextBoxColumn4});
this.dataGridTableStyle1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGridTableStyle1.MappingName = "";
//
// dataGridTextBoxColumn1
//
this.dataGridTextBoxColumn1.Format = "";
this.dataGridTextBoxColumn1.FormatInfo = null;
this.dataGridTextBoxColumn1.HeaderText = "排名";
this.dataGridTextBoxColumn1.MappingName = "";
this.dataGridTextBoxColumn1.Width = 75;
//
// dataGridTextBoxColumn2
//
this.dataGridTextBoxColumn2.Format = "";
this.dataGridTextBoxColumn2.FormatInfo = null;
this.dataGridTextBoxColumn2.HeaderText = "姓名";
this.dataGridTextBoxColumn2.MappingName = "";
this.dataGridTextBoxColumn2.Width = 75;
//
// dataGridTextBoxColumn3
//
this.dataGridTextBoxColumn3.Format = "";
this.dataGridTextBoxColumn3.FormatInfo = null;
this.dataGridTextBoxColumn3.HeaderText = "性别";
this.dataGridTextBoxColumn3.MappingName = "";
this.dataGridTextBoxColumn3.Width = 75;
//
// dataGridTextBoxColumn4
//
this.dataGridTextBoxColumn4.Format = "";
this.dataGridTextBoxColumn4.FormatInfo = null;
this.dataGridTextBoxColumn4.HeaderText = "文化程度";
this.dataGridTextBoxColumn4.MappingName = "";
this.dataGridTextBoxColumn4.Width = 75;
//
// tabPage3
//
this.tabPage3.AutoScroll = true;
this.tabPage3.Controls.Add(this.textBox25);
this.tabPage3.Controls.Add(this.textBox19);
this.tabPage3.Controls.Add(this.textBox18);
this.tabPage3.Controls.Add(this.textBox17);
this.tabPage3.Controls.Add(this.textBox4);
this.tabPage3.Controls.Add(this.textBox3);
this.tabPage3.Controls.Add(this.textBox2);
this.tabPage3.Controls.Add(this.textBox1);
this.tabPage3.Controls.Add(this.panel3);
this.tabPage3.Controls.Add(this.panel2);
this.tabPage3.Controls.Add(this.panel1);
this.tabPage3.Controls.Add(this.label25);
this.tabPage3.Controls.Add(this.groupBox3);
this.tabPage3.Controls.Add(this.label19);
this.tabPage3.Controls.Add(this.label18);
this.tabPage3.Controls.Add(this.label17);
this.tabPage3.Controls.Add(this.label16);
this.tabPage3.Controls.Add(this.groupBox2);
this.tabPage3.Controls.Add(this.groupBox1);
this.tabPage3.Controls.Add(this.label4);
this.tabPage3.Controls.Add(this.label3);
this.tabPage3.Controls.Add(this.label2);
this.tabPage3.Controls.Add(this.label1);
this.tabPage3.Controls.Add(this.button1);
this.tabPage3.Controls.Add(this.panel4);
this.tabPage3.Controls.Add(this.textBox16);
this.tabPage3.Enabled = false;
this.tabPage3.Location = new System.Drawing.Point(4, 21);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(696, 623);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "设定分数";
//
// textBox25
//
this.textBox25.Location = new System.Drawing.Point(560, 416);
this.textBox25.MaxValue = ((long)(999));
this.textBox25.MinValue = ((long)(0));
this.textBox25.Name = "textBox25";
this.textBox25.NumberType = ENSS.NumberTypes.正数;
this.textBox25.Precision = 3;
this.textBox25.TabIndex = 49;
this.textBox25.Text = "";
//
// textBox19
//
this.textBox19.Location = new System.Drawing.Point(344, 416);
this.textBox19.MaxValue = ((long)(999));
this.textBox19.MinValue = ((long)(0));
this.textBox19.Name = "textBox19";
this.textBox19.NumberType = ENSS.NumberTypes.正数;
this.textBox19.Precision = 3;
this.textBox19.TabIndex = 48;
this.textBox19.Text = "";
//
// textBox18
//
this.textBox18.Location = new System.Drawing.Point(120, 416);
this.textBox18.MaxValue = ((long)(999));
this.textBox18.MinValue = ((long)(0));
this.textBox18.Name = "textBox18";
this.textBox18.NumberType = ENSS.NumberTypes.正数;
this.textBox18.Precision = 3;
this.textBox18.TabIndex = 47;
this.textBox18.Text = "";
//
// textBox17
//
this.textBox17.Location = new System.Drawing.Point(344, 384);
this.textBox17.MaxValue = ((long)(999));
this.textBox17.MinValue = ((long)(0));
this.textBox17.Name = "textBox17";
this.textBox17.NumberType = ENSS.NumberTypes.正数;
this.textBox17.Precision = 3;
this.textBox17.TabIndex = 46;
this.textBox17.Text = "";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(160, 112);
this.textBox4.MaxValue = ((long)(999));
this.textBox4.MinValue = ((long)(0));
this.textBox4.Name = "textBox4";
this.textBox4.NumberType = ENSS.NumberTypes.正数;
this.textBox4.Precision = 3;
this.textBox4.TabIndex = 42;
this.textBox4.Text = "";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(160, 80);
this.textBox3.MaxValue = ((long)(999));
this.textBox3.MinValue = ((long)(0));
this.textBox3.Name = "textBox3";
this.textBox3.NumberType = ENSS.NumberTypes.正数;
this.textBox3.Precision = 3;
this.textBox3.TabIndex = 41;
this.textBox3.Text = "";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(160, 48);
this.textBox2.MaxValue = ((long)(999));
this.textBox2.MinValue = ((long)(0));
this.textBox2.Name = "textBox2";
this.textBox2.NumberType = ENSS.NumberTypes.正数;
this.textBox2.Precision = 3;
this.textBox2.TabIndex = 40;
this.textBox2.Text = "";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(160, 16);
this.textBox1.MaxValue = ((long)(999));
this.textBox1.MinValue = ((long)(0));
this.textBox1.Name = "textBox1";
this.textBox1.NumberType = ENSS.NumberTypes.正数;
this.textBox1.Precision = 3;
this.textBox1.TabIndex = 39;
this.textBox1.Text = "";
//
// panel3
//
this.panel3.Controls.Add(this.textBox28);
this.panel3.Controls.Add(this.radioButton5);
this.panel3.Controls.Add(this.radioButton6);
this.panel3.Location = new System.Drawing.Point(296, 80);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(360, 32);
this.panel3.TabIndex = 38;
//
// textBox28
//
this.textBox28.Location = new System.Drawing.Point(240, 0);
this.textBox28.MaxValue = ((long)(99));
this.textBox28.MinValue = ((long)(0));
this.textBox28.Name = "textBox28";
this.textBox28.NumberType = ENSS.NumberTypes.正数;
this.textBox28.Precision = 2;
this.textBox28.TabIndex = 40;
this.textBox28.Text = "";
//
// radioButton5
//
this.radioButton5.Location = new System.Drawing.Point(8, 0);
this.radioButton5.Name = "radioButton5";
this.radioButton5.Size = new System.Drawing.Size(112, 24);
this.radioButton5.TabIndex = 29;
this.radioButton5.Text = "以当前时间为准";
this.radioButton5.CheckedChanged += new System.EventHandler(this.radioButton5_CheckedChanged);
//
// radioButton6
//
this.radioButton6.Location = new System.Drawing.Point(136, 0);
this.radioButton6.Name = "radioButton6";
this.radioButton6.Size = new System.Drawing.Size(112, 24);
this.radioButton6.TabIndex = 30;
this.radioButton6.Text = "自定义截止时间";
this.radioButton6.CheckedChanged += new System.EventHandler(this.radioButton6_CheckedChanged);
//
// panel2
//
this.panel2.Controls.Add(this.textBox27);
this.panel2.Controls.Add(this.radioButton3);
this.panel2.Controls.Add(this.radioButton4);
this.panel2.Location = new System.Drawing.Point(296, 40);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(360, 40);
this.panel2.TabIndex = 37;
//
// textBox27
//
this.textBox27.Location = new System.Drawing.Point(240, 10);
this.textBox27.MaxValue = ((long)(99));
this.textBox27.MinValue = ((long)(0));
this.textBox27.Name = "textBox27";
this.textBox27.NumberType = ENSS.NumberTypes.正数;
this.textBox27.Precision = 2;
this.textBox27.TabIndex = 40;
this.textBox27.Text = "";
//
// radioButton3
//
this.radioButton3.Location = new System.Drawing.Point(8, 8);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(112, 24);
this.radioButton3.TabIndex = 27;
this.radioButton3.Text = "以当前时间为准";
this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged);
//
// radioButton4
//
this.radioButton4.Location = new System.Drawing.Point(136, 8);
this.radioButton4.Name = "radioButton4";
this.radioButton4.Size = new System.Drawing.Size(112, 24);
this.radioButton4.TabIndex = 28;
this.radioButton4.Text = "自定义截止时间";
this.radioButton4.CheckedChanged += new System.EventHandler(this.radioButton4_CheckedChanged);
//
// panel1
//
this.panel1.Controls.Add(this.textBox26);
this.panel1.Controls.Add(this.radioButton1);
this.panel1.Controls.Add(this.radioButton2);
this.panel1.Location = new System.Drawing.Point(296, 8);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(360, 32);
this.panel1.TabIndex = 36;
//
// textBox26
//
this.textBox26.Location = new System.Drawing.Point(240, 8);
this.textBox26.MaxValue = ((long)(99));
this.textBox26.MinValue = ((long)(0));
this.textBox26.Name = "textBox26";
this.textBox26.NumberType = ENSS.NumberTypes.正数;
this.textBox26.Precision = 2;
this.textBox26.TabIndex = 40;
this.textBox26.Text = "";
//
// radioButton1
//
this.radioButton1.Location = new System.Drawing.Point(8, 8);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(112, 24);
this.radioButton1.TabIndex = 24;
this.radioButton1.Text = "以当前时间为准";
this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
//
// radioButton2
//
this.radioButton2.Location = new System.Drawing.Point(136, 8);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(112, 24);
this.radioButton2.TabIndex = 25;
this.radioButton2.Text = "自定义截止时间";
this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
//
// label25
//
this.label25.Location = new System.Drawing.Point(464, 416);
this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(80, 23);
this.label25.TabIndex = 22;
this.label25.Text = "独生子女分:";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.textBox24);
this.groupBox3.Controls.Add(this.textBox23);
this.groupBox3.Controls.Add(this.textBox22);
this.groupBox3.Controls.Add(this.textBox21);
this.groupBox3.Controls.Add(this.textBox20);
this.groupBox3.Controls.Add(this.label24);
this.groupBox3.Controls.Add(this.label23);
this.groupBox3.Controls.Add(this.label22);
this.groupBox3.Controls.Add(this.label21);
this.groupBox3.Controls.Add(this.label20);
this.groupBox3.Location = new System.Drawing.Point(32, 448);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(640, 128);
this.groupBox3.TabIndex = 20;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "劳模“三八”红旗手";
//
// textBox24
//
this.textBox24.Location = new System.Drawing.Point(128, 96);
this.textBox24.MaxValue = ((long)(999));
this.textBox24.MinValue = ((long)(0));
this.textBox24.Name = "textBox24";
this.textBox24.NumberType = ENSS.NumberTypes.正数;
this.textBox24.Precision = 3;
this.textBox24.TabIndex = 44;
this.textBox24.Text = "";
//
// textBox23
//
this.textBox23.Location = new System.Drawing.Point(400, 72);
this.textBox23.MaxValue = ((long)(999));
this.textBox23.MinValue = ((long)(0));
this.textBox23.Name = "textBox23";
this.textBox23.NumberType = ENSS.NumberTypes.正数;
this.textBox23.Precision = 3;
this.textBox23.TabIndex = 43;
this.textBox23.Text = "";
//
// textBox22
//
this.textBox22.Location = new System.Drawing.Point(128, 64);
this.textBox22.MaxValue = ((long)(999));
this.textBox22.MinValue = ((long)(0));
this.textBox22.Name = "textBox22";
this.textBox22.NumberType = ENSS.NumberTypes.正数;
this.textBox22.Precision = 3;
this.textBox22.TabIndex = 42;
this.textBox22.Text = "";
//
// textBox21
//
this.textBox21.Location = new System.Drawing.Point(400, 32);
this.textBox21.MaxValue = ((long)(999));
this.textBox21.MinValue = ((long)(0));
this.textBox21.Name = "textBox21";
this.textBox21.NumberType = ENSS.NumberTypes.正数;
this.textBox21.Precision = 3;
this.textBox21.TabIndex = 41;
this.textBox21.Text = "";
//
// textBox20
//
this.textBox20.Location = new System.Drawing.Point(128, 32);
this.textBox20.MaxValue = ((long)(999));
this.textBox20.MinValue = ((long)(0));
this.textBox20.Name = "textBox20";
this.textBox20.NumberType = ENSS.NumberTypes.正数;
this.textBox20.Precision = 3;
this.textBox20.TabIndex = 40;
this.textBox20.Text = "";
//
// label24
//
this.label24.Location = new System.Drawing.Point(16, 96);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(104, 16);
this.label24.TabIndex = 26;
this.label24.Text = "“三八”红旗手:";
//
// label23
//
this.label23.Location = new System.Drawing.Point(264, 64);
this.label23.Name = "label23";
this.label23.TabIndex = 24;
this.label23.Text = "公司:";
//
// label22
//
this.label22.Location = new System.Drawing.Point(16, 64);
this.label22.Name = "label22";
this.label22.TabIndex = 22;
this.label22.Text = "部级:";
//
// label21
//
this.label21.Location = new System.Drawing.Point(264, 32);
this.label21.Name = "label21";
this.label21.TabIndex = 20;
this.label21.Text = "省级:";
//
// label20
//
this.label20.Location = new System.Drawing.Point(16, 32);
this.label20.Name = "label20";
this.label20.TabIndex = 18;
this.label20.Text = "全国:";
//
// label19
//
this.label19.Location = new System.Drawing.Point(248, 416);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(80, 23);
this.label19.TabIndex = 16;
this.label19.Text = "工艺倒班分:";
//
// label18
//
this.label18.Location = new System.Drawing.Point(48, 416);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(64, 23);
this.label18.TabIndex = 14;
this.label18.Text = "主控分:";
//
// label17
//
this.label17.Location = new System.Drawing.Point(248, 384);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(80, 23);
this.label17.TabIndex = 12;
this.label17.Text = "残疾军人分:";
//
// label16
//
this.label16.Location = new System.Drawing.Point(48, 384);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(56, 23);
this.label16.TabIndex = 10;
this.label16.Text = "班长:";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.textBox15);
this.groupBox2.Controls.Add(this.textBox14);
this.groupBox2.Controls.Add(this.textBox13);
this.groupBox2.Controls.Add(this.textBox12);
this.groupBox2.Controls.Add(this.textBox11);
this.groupBox2.Controls.Add(this.label15);
this.groupBox2.Controls.Add(this.label14);
this.groupBox2.Controls.Add(this.label13);
this.groupBox2.Controls.Add(this.label12);
this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Location = new System.Drawing.Point(32, 256);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(640, 120);
this.groupBox2.TabIndex = 9;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "技术职务分";
//
// textBox15
//
this.textBox15.Location = new System.Drawing.Point(128, 88);
this.textBox15.MaxValue = ((long)(999));
this.textBox15.MinValue = ((long)(0));
this.textBox15.Name = "textBox15";
this.textBox15.NumberType = ENSS.NumberTypes.正数;
this.textBox15.Precision = 3;
this.textBox15.TabIndex = 44;
this.textBox15.Text = "";
//
// textBox14
//
this.textBox14.Location = new System.Drawing.Point(400, 56);
this.textBox14.MaxValue = ((long)(999));
this.textBox14.MinValue = ((long)(0));
this.textBox14.Name = "textBox14";
this.textBox14.NumberType = ENSS.NumberTypes.正数;
this.textBox14.Precision = 3;
this.textBox14.TabIndex = 43;
this.textBox14.Text = "";
//
// textBox13
//
this.textBox13.Location = new System.Drawing.Point(128, 56);
this.textBox13.MaxValue = ((long)(999));
this.textBox13.MinValue = ((long)(0));
this.textBox13.Name = "textBox13";
this.textBox13.NumberType = ENSS.NumberTypes.正数;
this.textBox13.Precision = 3;
this.textBox13.TabIndex = 42;
this.textBox13.Text = "";
//
// textBox12
//
this.textBox12.Location = new System.Drawing.Point(400, 24);
this.textBox12.MaxValue = ((long)(999));
this.textBox12.MinValue = ((long)(0));
this.textBox12.Name = "textBox12";
this.textBox12.NumberType = ENSS.NumberTypes.正数;
this.textBox12.Precision = 3;
this.textBox12.TabIndex = 41;
this.textBox12.Text = "";
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(128, 24);
this.textBox11.MaxValue = ((long)(999));
this.textBox11.MinValue = ((long)(0));
this.textBox11.Name = "textBox11";
this.textBox11.NumberType = ENSS.NumberTypes.正数;
this.textBox11.Precision = 3;
this.textBox11.TabIndex = 40;
this.textBox11.Text = "";
//
// label15
//
this.label15.Location = new System.Drawing.Point(16, 88);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(100, 16);
this.label15.TabIndex = 4;
this.label15.Text = "助工:";
//
// label14
//
this.label14.Location = new System.Drawing.Point(264, 64);
this.label14.Name = "label14";
this.label14.TabIndex = 3;
this.label14.Text = "技师:";
//
// label13
//
this.label13.Location = new System.Drawing.Point(16, 56);
this.label13.Name = "label13";
this.label13.TabIndex = 2;
this.label13.Text = "中级:";
//
// label12
//
this.label12.Location = new System.Drawing.Point(264, 24);
this.label12.Name = "label12";
this.label12.TabIndex = 1;
this.label12.Text = "副高:";
//
// label11
//
this.label11.Location = new System.Drawing.Point(16, 24);
this.label11.Name = "label11";
this.label11.TabIndex = 0;
this.label11.Text = "研高:";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.textBox10);
this.groupBox1.Controls.Add(this.textBox9);
this.groupBox1.Controls.Add(this.textBox8);
this.groupBox1.Controls.Add(this.textBox7);
this.groupBox1.Controls.Add(this.textBox6);
this.groupBox1.Controls.Add(this.label10);
this.groupBox1.Controls.Add(this.label9);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.textBox5);
this.groupBox1.Location = new System.Drawing.Point(32, 136);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(640, 120);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "行政职务分";
//
// textBox10
//
this.textBox10.Location = new System.Drawing.Point(400, 88);
this.textBox10.MaxValue = ((long)(999));
this.textBox10.MinValue = ((long)(0));
this.textBox10.Name = "textBox10";
this.textBox10.NumberType = ENSS.NumberTypes.正数;
this.textBox10.Precision = 3;
this.textBox10.TabIndex = 48;
this.textBox10.Text = "";
//
// textBox9
//
this.textBox9.Location = new System.Drawing.Point(128, 88);
this.textBox9.MaxValue = ((long)(999));
this.textBox9.MinValue = ((long)(0));
this.textBox9.Name = "textBox9";
this.textBox9.NumberType = ENSS.NumberTypes.正数;
this.textBox9.Precision = 3;
this.textBox9.TabIndex = 47;
this.textBox9.Text = "";
//
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(400, 56);
this.textBox8.MaxValue = ((long)(999));
this.textBox8.MinValue = ((long)(0));
this.textBox8.Name = "textBox8";
this.textBox8.NumberType = ENSS.NumberTypes.正数;
this.textBox8.Precision = 3;
this.textBox8.TabIndex = 46;
this.textBox8.Text = "";
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(128, 56);
this.textBox7.MaxValue = ((long)(999));
this.textBox7.MinValue = ((long)(0));
this.textBox7.Name = "textBox7";
this.textBox7.NumberType = ENSS.NumberTypes.正数;
this.textBox7.Precision = 3;
this.textBox7.TabIndex = 45;
this.textBox7.Text = "";
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(400, 24);
this.textBox6.MaxValue = ((long)(999));
this.textBox6.MinValue = ((long)(0));
this.textBox6.Name = "textBox6";
this.textBox6.NumberType = ENSS.NumberTypes.正数;
this.textBox6.Precision = 3;
this.textBox6.TabIndex = 44;
this.textBox6.Text = "";
//
// label10
//
this.label10.Location = new System.Drawing.Point(272, 88);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(100, 16);
this.label10.TabIndex = 5;
this.label10.Text = "副科:";
//
// label9
//
this.label9.Location = new System.Drawing.Point(16, 88);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(100, 16);
this.label9.TabIndex = 4;
this.label9.Text = "正科:";
//
// label8
//
this.label8.Location = new System.Drawing.Point(272, 56);
this.label8.Name = "label8";
this.label8.TabIndex = 3;
this.label8.Text = "副处:";
//
// label7
//
this.label7.Location = new System.Drawing.Point(16, 56);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(100, 16);
this.label7.TabIndex = 2;
this.label7.Text = "正处:";
//
// label6
//
this.label6.Location = new System.Drawing.Point(272, 24);
this.label6.Name = "label6";
this.label6.TabIndex = 1;
this.label6.Text = "副局:";
//
// label5
//
this.label5.Location = new System.Drawing.Point(16, 24);
this.label5.Name = "label5";
this.label5.TabIndex = 0;
this.label5.Text = "正局:";
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(128, 24);
this.textBox5.MaxValue = ((long)(999));
this.textBox5.MinValue = ((long)(0));
this.textBox5.Name = "textBox5";
this.textBox5.NumberType = ENSS.NumberTypes.正数;
this.textBox5.Precision = 3;
this.textBox5.TabIndex = 43;
this.textBox5.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(40, 112);
this.label4.Name = "label4";
this.label4.TabIndex = 6;
this.label4.Text = "进本公司分:";
//
// label3
//
this.label3.Location = new System.Drawing.Point(40, 80);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 23);
this.label3.TabIndex = 4;
this.label3.Text = "进核电厂分:";
//
// label2
//
this.label2.Location = new System.Drawing.Point(40, 48);
this.label2.Name = "label2";
this.label2.TabIndex = 2;
this.label2.Text = "参加工作分:";
//
// label1
//
this.label1.Location = new System.Drawing.Point(40, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(88, 24);
this.label1.TabIndex = 0;
this.label1.Text = "入学年月分:";
//
// button1
//
this.button1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button1.Location = new System.Drawing.Point(228, 588);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(208, 24);
this.button1.TabIndex = 1;
this.button1.Text = "保存";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// panel4
//
this.panel4.Controls.Add(this.textBox29);
this.panel4.Controls.Add(this.radioButton7);
this.panel4.Controls.Add(this.radioButton8);
this.panel4.Location = new System.Drawing.Point(296, 112);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(360, 32);
this.panel4.TabIndex = 1;
//
// textBox29
//
this.textBox29.Location = new System.Drawing.Point(240, 0);
this.textBox29.MaxValue = ((long)(99));
this.textBox29.MinValue = ((long)(0));
this.textBox29.Name = "textBox29";
this.textBox29.NumberType = ENSS.NumberTypes.正数;
this.textBox29.Precision = 2;
this.textBox29.TabIndex = 40;
this.textBox29.Text = "";
//
// radioButton7
//
this.radioButton7.Location = new System.Drawing.Point(8, 0);
this.radioButton7.Name = "radioButton7";
this.radioButton7.Size = new System.Drawing.Size(112, 24);
this.radioButton7.TabIndex = 31;
this.radioButton7.Text = "以当前时间为准";
this.radioButton7.CheckedChanged += new System.EventHandler(this.radioButton7_CheckedChanged);
//
// radioButton8
//
this.radioButton8.Location = new System.Drawing.Point(136, 0);
this.radioButton8.Name = "radioButton8";
this.radioButton8.Size = new System.Drawing.Size(112, 24);
this.radioButton8.TabIndex = 32;
this.radioButton8.Text = "自定义截止时间";
this.radioButton8.CheckedChanged += new System.EventHandler(this.radioButton8_CheckedChanged);
//
// textBox16
//
this.textBox16.Location = new System.Drawing.Point(120, 384);
this.textBox16.MaxValue = ((long)(999));
this.textBox16.MinValue = ((long)(0));
this.textBox16.Name = "textBox16";
this.textBox16.NumberType = ENSS.NumberTypes.正数;
this.textBox16.Precision = 3;
this.textBox16.TabIndex = 45;
this.textBox16.Text = "";
//
// btnRead
//
this.btnRead.Location = new System.Drawing.Point(16, 576);
this.btnRead.Name = "btnRead";
this.btnRead.Size = new System.Drawing.Size(100, 28);
this.btnRead.TabIndex = 6;
this.btnRead.Text = "读取";
this.btnRead.Click += new System.EventHandler(this.btnRead_Click);
//
// btnDel
//
this.btnDel.Location = new System.Drawing.Point(352, 576);
this.btnDel.Name = "btnDel";
this.btnDel.Size = new System.Drawing.Size(100, 28);
this.btnDel.TabIndex = 7;
this.btnDel.Text = "删除";
this.btnDel.Click += new System.EventHandler(this.btnDel_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(736, 667);
this.Controls.Add(this.tabControl1);
this.HelpButton = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "职工计分程序";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGrid3)).EndInit();
this.tabPage2.ResumeLayout(false);
this.panel6.ResumeLayout(false);
this.panel5.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.tabPage3.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
//菜单导入按钮
private void miImport_Click(object sender, System.EventArgs e)
{
this.dataGrid3.TableStyles.Clear();
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = "c://";
ofd.Filter = "Excel files (*.xls)|*.xls|All files (*.*)|*.*";
ofd.FilterIndex = 1 ;
ofd.RestoreDirectory = true;
ofd.Title = "导入文件对话框";
if (ofd.ShowDialog()==DialogResult.OK)
{
if (ofd.FileName.IndexOf("xls") < 0)
MessageBox.Show("文件格式不符合,请重新导入文件!");
if (ofd.OpenFile()!=null)
{
ds = DataConnection.ExcelConnection(ofd.FileName);
this.dataGrid3.DataSource = ds.Tables["Employees"];
this.AddGridStyle();
ds.Tables[0].DefaultView.AllowNew = false;
ds.Tables[0].DefaultView.AllowDelete = false;
ds.Tables[0].DefaultView.AllowEdit = false;
ds.Tables["Employees"].ColumnChanging += new DataColumnChangeEventHandler(this.ds_ColumnChanging);
}
}
}
//添加样式
private void AddGridStyle()
{
DataGridTableStyle dgts = new DataGridTableStyle();
dgts.MappingName = "Employees";
DataGridTextBoxColumn dgtbcId = new DataGridTextBoxColumn();
dgtbcId.MappingName = "序号";
dgtbcId.HeaderText = "序号";
dgts.GridColumnStyles.Add(dgtbcId);
DataGridTextBoxColumn dgtbcNm = new DataGridTextBoxColumn();
dgtbcNm.MappingName = "姓名";
dgtbcNm.HeaderText = "姓名";
dgts.GridColumnStyles.Add(dgtbcNm);
ENSS.DataGridComboBoxColumn dgcbcSex = new DataGridComboBoxColumn(this.GetComboBoxValue("sex",2).DefaultView,"sex","sex");
dgcbcSex.MappingName = "性别";
dgcbcSex.HeaderText = "性别";
dgts.GridColumnStyles.Add(dgcbcSex);
ENSS.DataGridComboBoxColumn dgcbcEdu = new DataGridComboBoxColumn(this.GetComboBoxValue("education",7).DefaultView,"education","education");
dgcbcEdu.MappingName = "文化程度";
dgcbcEdu.HeaderText = "文化程度";
dgts.GridColumnStyles.Add(dgcbcEdu);
DataGridTextBoxColumn dgtbcStu = new DataGridTextBoxColumn();
dgtbcStu.MappingName = "入学年月";
dgtbcStu.HeaderText = "入学年月";
dgts.GridColumnStyles.Add(dgtbcStu);
DataGridTextBoxColumn dgtbcWork = new DataGridTextBoxColumn();
dgtbcWork.MappingName = "参加工作时间";
dgtbcWork.HeaderText = "参加工作时间";
dgtbcWork.Width = 80;
dgts.GridColumnStyles.Add(dgtbcWork);
DataGridTextBoxColumn dgtbcFac = new DataGridTextBoxColumn();
dgtbcFac.MappingName = "进核电厂时间";
dgtbcFac.HeaderText = "进核电厂时间";
dgtbcFac.Width = 80;
dgts.GridColumnStyles.Add(dgtbcFac);
DataGridTextBoxColumn dgtbcComp = new DataGridTextBoxColumn();
dgtbcComp.MappingName = "进本公司时间";
dgtbcComp.HeaderText = "进本公司时间";
dgtbcComp.Width = 80;
dgts.GridColumnStyles.Add(dgtbcComp);
ENSS.DataGridComboBoxColumn dgcbcAP = new DataGridComboBoxColumn(this.GetComboBoxValue("adminPos",7).DefaultView,"adminPos","adminPos");
dgcbcAP.MappingName = "行政职务";
dgcbcAP.HeaderText = "行政职务";
dgts.GridColumnStyles.Add(dgcbcAP);
ENSS.DataGridComboBoxColumn dgcbcCP = new DataGridComboBoxColumn(this.GetComboBoxValue("techPos",6).DefaultView,"techPos","techPos");
dgcbcCP.MappingName = "技术职务";
dgcbcCP.HeaderText = "技术职务";
dgts.GridColumnStyles.Add(dgcbcCP);
DataGridTextBoxColumn dgtbcHead = new DataGridTextBoxColumn();
dgtbcHead .MappingName = "班长";
dgtbcHead .HeaderText = "班长";
dgtbcHead .NullText = "";
dgts.GridColumnStyles.Add(dgtbcHead);
ENSS.DataGridComboBoxColumn dgcbcflag = new DataGridComboBoxColumn(this.GetComboBoxValue("flagman",6).DefaultView,"flagman","flagman");
dgcbcflag.MappingName = "劳模"+"“"+"三八"+"”"+"红旗手";
dgcbcflag.HeaderText = "劳模/"三八/"红旗手";
dgcbcflag.Width = 100;
dgcbcflag.NullText = "";
dgts.GridColumnStyles.Add(dgcbcflag);
DataGridTextBoxColumn dgtbcChild = new DataGridTextBoxColumn();
dgtbcChild .MappingName = "独生子女";
dgtbcChild .HeaderText = "独生子女";
dgtbcChild .NullText = "";
dgts.GridColumnStyles.Add(dgtbcChild);
DataGridTextBoxColumn dgtbcArmy = new DataGridTextBoxColumn();
dgtbcArmy .MappingName = "残疾军人";
dgtbcArmy .HeaderText = "残疾军人";
dgtbcArmy .NullText = "";
dgts.GridColumnStyles.Add(dgtbcArmy);
DataGridTextBoxColumn dgtbcCtrl = new DataGridTextBoxColumn();
dgtbcCtrl .MappingName = "主控";
dgtbcCtrl .HeaderText = "主控";
dgtbcCtrl .NullText = "";
dgts.GridColumnStyles.Add(dgtbcCtrl);
DataGridTextBoxColumn dgtbcShift = new DataGridTextBoxColumn();
dgtbcShift .MappingName = "工艺倒班";
dgtbcShift .HeaderText = "工艺倒班";
dgtbcShift .NullText = "";
dgts.GridColumnStyles.Add(dgtbcShift);
DataGridTextBoxColumn dgtbcAdd = new DataGridTextBoxColumn();
dgtbcAdd .MappingName = "住址";
dgtbcAdd .HeaderText = "住址";
dgtbcShift .NullText = "";
dgts.GridColumnStyles.Add(dgtbcAdd);
DataGridTextBoxColumn dgtbcRem = new DataGridTextBoxColumn();
dgtbcRem .MappingName = "备注";
dgtbcRem .HeaderText = "备注";
dgtbcRem .NullText = "";
dgts.GridColumnStyles.Add(dgtbcRem);
// DataGridTimePickerColumn dgtpcFac = new DataGridTimePickerColumn();
// dgtpcFac.MappingName = "进厂日期";
// dgtpcFac.HeaderText = "进厂日期";
// dgtpcFac.Width = 120;
// dgts.GridColumnStyles.Add(dgtpcFac);
// DataGridTimePickerColumn dgtpcBirth = new DataGridTimePickerColumn();
// dgtpcBirth.MappingName = "出生年月";
// dgtpcBirth.HeaderText = "出生年月";
// dgtpcBirth.Width = 120;
// dgts.GridColumnStyles.Add(dgtpcBirth);
this.dataGrid3.TableStyles.Add(dgts);
}
/// <summary>
/// 获取DataGrid的5个ComboBox的下拉列表的内容,并且绑定上去
/// </summary>
/// <param name="field"></param>
/// <param name="number"></param>
/// <param name="content"></param>
/// <returns></returns>
private DataTable GetComboBoxValue(string field,int number)
{
string content = System.Configuration.ConfigurationSettings.AppSettings[field];
string[] contents = content.Split(',');
DataTable dt = new DataTable(field);
dt.Columns.Add(field,System.Type.GetType("System.String"));
for (int i=0;i<number;i++)
{
DataRow dr = dt.NewRow();
dr[field] = contents[i];
dt.Rows.Add(dr);
}
return dt;
}
//保存职工表
private void btnSave_Click(object sender, System.EventArgs e)
{
if (this.dataGrid3.VisibleRowCount == 0)
{
MessageBox.Show("您还没有导入表格!");
return;
}
OleDbConnection con = DataConnection.AccessConnection();
OleDbCommand cmd;
string sql,sqlSelect;
con.Open();
string name ; //姓名
string sex ; //性别
string education ; //文化程度
string admissionTime ;//入学年月
string startWorkTime ;//参加工作时间
string toFactoryTime ;//进核电厂时间
string toCompanyTime ;//进本公司时间
string adminPos ; //行政职务
string techPos ; //技术职务
string headMaster ; //班长
string flagmanLev ; //劳模“三八”红旗手
string singleChild ; //独生子女
string army ; //残疾军人
string ctrl ; //主控
string shift ; //工艺倒班
string address ; //住址
string remarks; //备注
// string birthDate ; //出生年月
try
{
for (int i=0;i<((DataTable)this.dataGrid3.DataSource).Rows.Count;i++)
{
name = this.dataGrid3[i,1].ToString();
sex = this.dataGrid3[i,2].ToString();
education = this.dataGrid3[i,3].ToString();
admissionTime = this.dataGrid3[i,4].ToString();
startWorkTime = this.dataGrid3[i,5].ToString();
toFactoryTime = this.dataGrid3[i,6].ToString();
toCompanyTime = this.dataGrid3[i,7].ToString();
adminPos = this.dataGrid3[i,8].ToString();
techPos = this.dataGrid3[i,9].ToString();
headMaster = this.dataGrid3[i,10].ToString();
flagmanLev = this.dataGrid3[i,11].ToString();
singleChild = this.dataGrid3[i,12].ToString();
army = this.dataGrid3[i,13].ToString();
ctrl = this.dataGrid3[i,14].ToString();
shift = this.dataGrid3[i,15].ToString();
address = this.dataGrid3[i,16].ToString();
remarks = this.dataGrid3[i,17].ToString();
// birthDate = this.dataGrid3[i,18].ToString();
sqlSelect = "SELECT COUNT(*) FROM Employees WHERE Name='"+name+"'";
cmd = new OleDbCommand(sqlSelect,con);
int num = Convert.ToInt16(cmd.ExecuteScalar());
if (num == 0)
sql = "INSERT INTO Employees (Name,Sex,Education,AdmissionTime,StartWorkTime,ToFactoryTime,ToCompanyTime,AdminPos,TechPos,IsHeadMaster,"+
"FlagmanLev,HasSingleChild,IsDisabilityArmy,IsChiefCtrl,IsTechShift,Address,Remarks) VALUES ('"+
name+"','"+sex+"','"+education+"','"+admissionTime+"','"+startWorkTime+"','"+toFactoryTime+"','"+toCompanyTime+"','"+adminPos+"','"+
techPos+"','"+headMaster+"','"+flagmanLev+"','"+singleChild+"','"+army+"','"+ctrl+"','"+shift+"','"+address+"','"+remarks+"')";
else
sql = "UPDATE Employees SET Sex='"+sex+"',Education='"+education+"',AdmissionTime='"+education+"',StartWorkTime='"+startWorkTime+
"',ToFactoryTime='"+toFactoryTime+"',ToCompanyTime='"+toCompanyTime+"',AdminPos='"+adminPos+"',TechPos='"+techPos+"',IsHeadMaster='"+headMaster+
"',FlagmanLev='"+flagmanLev+"',HasSingleChild='"+singleChild+"',IsDisabilityArmy='"+army+"',IsChiefCtrl='"+ctrl+"',IsTechShift='"+shift+"',Address='"+
address+"',Remarks='"+remarks+"'WHERE Name='"+name+"'";
cmd = new OleDbCommand(sql,con);
cmd.ExecuteNonQuery();
}
MessageBox.Show("保存进数据库完毕!");
}
catch (OleDbException ex)
{
throw new Exception(ex.Message);
}
finally
{
con.Close();
this.button5.Enabled = true;
}
}
//进入配置页面
private void menuItem2_Click(object sender, System.EventArgs e)
{
this.tabControl1.SelectedTab = this.tabPage3;
this.tabPage3.Enabled = true;
BindConfigTab();
}
/// <summary>
/// 绑定配置页
/// </summary>
private void BindConfigTab()
{
string cprAdm ;
string cprStartWork;
string cprToFac;
string cprToCompany;
OleDbConnection con = DataConnection.AccessConnection();
try
{
con.Open();
string sql = "SELECT * FROM Scores";
OleDbCommand cmd = new OleDbCommand(sql,con);
OleDbDataReader oda = cmd.ExecuteReader();
while(oda.Read())
{
textBox1.Text = oda.GetFloat(0).ToString();
textBox2.Text = oda.GetFloat(1).ToString();
textBox3.Text = oda.GetFloat(2).ToString();
textBox4.Text = oda.GetFloat(3).ToString();
textBox5.Text = oda.GetFloat(4).ToString();
textBox6.Text = oda.GetFloat(5).ToString();
textBox7.Text = oda.GetFloat(6).ToString();
textBox8.Text = oda.GetFloat(7).ToString();
textBox9.Text = oda.GetFloat(8).ToString();
textBox10.Text = oda.GetFloat(9).ToString();
textBox11.Text = oda.GetFloat(10).ToString();
textBox12.Text = oda.GetFloat(11).ToString();
textBox13.Text = oda.GetFloat(12).ToString();
textBox14.Text = oda.GetFloat(13).ToString();
textBox15.Text = oda.GetFloat(14).ToString();
textBox16.Text = oda.GetFloat(15).ToString();
textBox20.Text = oda.GetFloat(16).ToString();
textBox21.Text = oda.GetFloat(17).ToString();
textBox22.Text = oda.GetFloat(18).ToString();
textBox23.Text = oda.GetFloat(19).ToString();
textBox24.Text = oda.GetFloat(20).ToString();
textBox25.Text = oda.GetFloat(21).ToString();
textBox17.Text = oda.GetFloat(22).ToString();
textBox18.Text = oda.GetFloat(23).ToString();
textBox19.Text = oda.GetFloat(24).ToString();
cprAdm = oda.GetString(25);
cprStartWork = oda.GetString(26);
cprToFac = oda.GetString(27);
cprToCompany = oda.GetString (28);
if (cprAdm == "0")
{
radioButton1.Select();
}
else
{
radioButton2.Select();
textBox26.Text = cprAdm ;
}
if (cprStartWork == "0")
{
radioButton3.Select();
}
else
{
radioButton4.Select();
textBox27.Text = cprStartWork ;
}
if (cprToFac == "0")
{
radioButton5.Select();
}
else
{
radioButton6.Select();
textBox28.Text = cprToFac ;
}
if (cprToCompany == "0")
{
radioButton7.Select();
}
else
{
radioButton8.Select();
textBox29.Text = cprToCompany ;
}
}
oda.Close();
}
catch (OleDbException ex)
{
throw new Exception(ex.Message);
}
finally
{
con.Close();
}
}
/// <summary>
/// tab3的保存按钮事件函数
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, System.EventArgs e)
{
if (ValidateTextBox(textBox26.Text)&&ValidateTextBox(textBox27.Text)&&ValidateTextBox(textBox28.Text)&&ValidateTextBox(textBox29.Text))
{
string admission = textBox1.Text;
string startWork = textBox2.Text;
string toFactory = textBox3.Text;
string toCompany = textBox4.Text;
string bureauA = textBox5.Text;
string bureauB = textBox6.Text;
string departA = textBox7.Text;
string departB = textBox8.Text;
string secA = textBox9.Text;
string secB = textBox10.Text;
string yg = textBox11.Text;
string fg = textBox12.Text;
string zj = textBox13.Text;
string js = textBox14.Text;
string zg = textBox15.Text;
string headMaster = textBox16.Text;
string nation = textBox20.Text;
string province = textBox21.Text;
string ministry = textBox22.Text;
string company = textBox23.Text;
string flag = textBox24.Text;
string singleChild = textBox25.Text;
string disArmy = textBox17.Text;
string chiefCtrl = textBox18.Text;
string techShift = textBox19.Text;
string cprAdm = textBox26.Text;
string cprStartWork = textBox27.Text;
string cprToFac = textBox28.Text;
string cprToCompany = textBox29.Text;
OleDbConnection con = DataConnection.AccessConnection();
string sql;
con.Open();
try
{
sql = "UPDATE Scores SET Admission = "+admission+",StartWork = "+startWork+",ToFactory = "+toFactory+",ToCompany = "+toCompany+",BureauA="+
bureauA+",BureauB="+bureauB+",DepartmentA="+departA+",DepartmentB="+departB+",SectionA="+secA+",SectionB="+secB+",YG="+yg+
",FG="+fg+",ZJ="+zj+",JS="+js+",ZG="+zg+",HeadMaster="+headMaster+",Nation="+nation+",Province="+province+",Ministry="+ministry+
",Company="+company+",Flag="+flag+",SingleChild="+singleChild+",DisArmy="+disArmy+",ChiefCtrl="+chiefCtrl+",TechShift="+techShift+",CprAdmissionTime='"+cprAdm+
"',CprStartWorkTime='"+cprStartWork+"',CprToFactoryTime='"+cprToFac+"',CprToCompanyTime='"+cprToCompany+"'";
OleDbCommand cmd = new OleDbCommand(sql,con);
cmd.ExecuteNonQuery();
MessageBox.Show("更新完毕!");
}
catch (OleDbException ex)
{
throw new Exception(ex.Message);
}
finally
{
con.Close();
}
}
else
MessageBox.Show("输入的月份超过12或者月份没有输入!请修改!");
}
private bool ValidateTextBox(string txt)
{
string content = txt;
if (txt=="0") {return true;}
if (content.IndexOf('.')>0)
{
string[] a = content.Split('.');
if (Convert.ToInt16(a[1])>12)
return false;
else
return true;
}
else
{
return false;
}
}
/// <summary>
/// 生成计分表按钮事件函数
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSubmit_Click(object sender, System.EventArgs e)
{
//初始化
dataRow = new ArrayList();
dataRow1 = new ArrayList();
rowNum = new ArrayList();
rowNum1 = new ArrayList();
this.button2.Enabled = true;
this.button3.Enabled = true;
this.button6.Enabled = false;
this.button7.Enabled = false;
#region 获取配置
float admission =0;
float startWork =0;
float toFactory =0;
float toCompany =0;
float bureauA =0;
float bureauB =0;
float departA =0;
float departB =0;
float secA=0;
float secB =0;
float yg =0;
float fg =0;
float zj =0;
float js =0;
float zg =0;
float headMaster =0;
float nation =0;
float province =0;
float ministry=0;
float company =0;
float flag =0;
float singleChild =0;
float disArmy =0;
float chiefCtrl =0;
float techShift =0;
string cprAdm ="";
string cprStartWork="";
string cprToFac = "";
string cprToCompany = "";
OleDbConnection con = DataConnection.AccessConnection();
try
{
con.Open();
string sql = "SELECT * FROM Scores";
OleDbCommand cmd = new OleDbCommand(sql,con);
OleDbDataReader oda = cmd.ExecuteReader();
while(oda.Read())
{
admission = oda.GetFloat(0);
startWork = oda.GetFloat(1);
toFactory = oda.GetFloat(2);
toCompany = oda.GetFloat(3);
bureauA = oda.GetFloat(4);
bureauB = oda.GetFloat(5);
departA = oda.GetFloat(6);
departB = oda.GetFloat(7);
secA = oda.GetFloat(8);
secB = oda.GetFloat(9);
yg = oda.GetFloat(10);
fg = oda.GetFloat(11);
zj = oda.GetFloat(12);
js = oda.GetFloat(13);
zg = oda.GetFloat(14);
headMaster = oda.GetFloat(15);
nation = oda.GetFloat(16);
province = oda.GetFloat(17);
ministry = oda.GetFloat(18);
company = oda.GetFloat(19);
flag = oda.GetFloat(20);
singleChild = oda.GetFloat(21);
disArmy = oda.GetFloat(22);
chiefCtrl = oda.GetFloat(23);
techShift = oda.GetFloat(24);
cprAdm = oda.GetString(25);
cprStartWork = oda.GetString(26);
cprToFac = oda.GetString(27);
cprToCompany = oda.GetString(28);
}
oda.Close();
}
catch (OleDbException ex)
{
throw new Exception(ex.Message);
}
finally
{
con.Close();
}
#endregion
# region 获取计分表的数据源,把局长级别的人单独放入一个表中统计
//局长表
DataTable dt = new DataTable("savedEmps");
dt.Columns.Add("排名",System.Type.GetType("System.String"));
dt.Columns.Add("姓名",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("性别",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("文化程度",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("总分",System.Type.GetType("System.Single")).ReadOnly=true;
dt.Columns.Add("入学年月",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("参加工作",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("进核电厂",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("进本公司",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("行政职务",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("技术职务",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("班长",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("劳模/"三八/"红旗手",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("独生子女",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("残疾军人",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("主控",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("工艺倒班",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("备注",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("进厂日期",System.Type.GetType("System.String")).ReadOnly=true;
dt.Columns.Add("出生年月",System.Type.GetType("System.String"));
//普通表
DataTable dtComm = new DataTable("savedEmpsComm");
dtComm.Columns.Add("排名",System.Type.GetType("System.String"));
dtComm.Columns.Add("姓名",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("性别",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("文化程度",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("总分",System.Type.GetType("System.Single")).ReadOnly=true;
dtComm.Columns.Add("入学年月",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("参加工作",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("进核电厂",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("进本公司",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("行政职务",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("技术职务",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("班长",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("劳模/"三八/"红旗手",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("独生子女",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("残疾军人",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("主控",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("工艺倒班",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("备注",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("进厂日期",System.Type.GetType("System.String")).ReadOnly=true;
dtComm.Columns.Add("出生年月",System.Type.GetType("System.String"));
for (int i=0;i<((DataTable)this.dataGrid3.DataSource).Rows.Count;i++)
{
if (dataGrid3[i,8].ToString()=="正局"||dataGrid3[i,8].ToString()=="副局")
{
DataRow dr = dt.NewRow();
dr["姓名"] = dataGrid3[i,1].ToString();
dr["性别"] = dataGrid3[i,2].ToString();
dr["文化程度"] = dataGrid3[i,3].ToString();
dr["入学年月"] = GetScoreForTime(dataGrid3[i,4].ToString(),cprAdm,admission);
dr["参加工作"] = GetScoreForTime(dataGrid3[i,5].ToString(),cprStartWork,startWork);
dr["进核电厂"] = GetScoreForTime(dataGrid3[i,6].ToString(),cprToFac,toFactory);
dr["进本公司"] = GetScoreForTime(dataGrid3[i,7].ToString(),cprToCompany,toCompany);
switch (dataGrid3[i,8].ToString())
{
case "正局":
dr["行政职务"] = bureauA.ToString();
break;
case "副局":
dr["行政职务"] = bureauB.ToString();
break;
case "正处":
dr["行政职务"] = departA.ToString();
break;
case "副处":
dr["行政职务"] = departB.ToString();
break;
case "正科":
dr["行政职务"] = secA.ToString();
break;
case "副科":
dr["行政职务"] = secB.ToString();
break;
default :
dr["行政职务"] = "0.000";
break;
}
switch (dataGrid3[i,9].ToString())
{
case "研高":
dr["技术职务"] = yg.ToString();
break;
case "副高":
dr["技术职务"] = fg.ToString();
break;
case "中级":
dr["技术职务"] = zj.ToString();
break;
case "技师":
dr["技术职务"] = js.ToString();
break;
case "助工":
dr["技术职务"] = zg.ToString();
break;
default :
dr["技术职务"] = "0.000";
break;
}
if (dataGrid3[i,10].ToString() =="是"||dataGrid3[i,10].ToString() =="有")
{
dr["班长"] = headMaster.ToString();
}
else
dr["班长"] = "0.000";
switch (dataGrid3[i,11].ToString())
{
case "全国":
dr["劳模/"三八/"红旗手"] = yg.ToString();
break;
case "省级":
dr["劳模/"三八/"红旗手"] = fg.ToString();
break;
case "部级":
dr["劳模/"三八/"红旗手"] = zj.ToString();
break;
case "公司":
dr["劳模/"三八/"红旗手"] = js.ToString();
break;
case "“三八”红旗手":
dr["劳模/"三八/"红旗手"] = zg.ToString();
break;
default :
dr["劳模/"三八/"红旗手"] = "0.000";
break;
}
if (dataGrid3[i,12].ToString() =="是"||dataGrid3[i,12].ToString() =="有")
{
dr["独生子女"] = singleChild.ToString();
}
else
dr["独生子女"] = "0.000";
if (dataGrid3[i,13].ToString() =="是"||dataGrid3[i,13].ToString() =="有")
{
dr["残疾军人"] = disArmy.ToString();
}
else
dr["残疾军人"] = "0.000";
if (dataGrid3[i,14].ToString() =="是"||dataGrid3[i,14].ToString() =="有")
{
dr["主控"] = chiefCtrl.ToString();
}
else
dr["主控"] = "0.000";
if (dataGrid3[i,15].ToString() =="是"||dataGrid3[i,15].ToString() =="有")
{
dr["工艺倒班"] = techShift.ToString();
}
else
dr["工艺倒班"] = "0.000";
//计算总分
dr["备注"] = dataGrid3[i,17].ToString();
dr["进厂日期"] = dataGrid3[i,7].ToString();
// dr["出生年月"] = GetProperDate (dataGrid3[i,18].ToString());
float max1 = (Convert.ToSingle(dr["入学年月"])>Convert.ToSingle(dr["参加工作"]))?Convert.ToSingle(dr["入学年月"]):Convert.ToSingle(dr["参加工作"]);
float max = (Convert.ToSingle(dr["行政职务"])>Convert.ToSingle(dr["技术职务"]))?Convert.ToSingle(dr["行政职务"]):Convert.ToSingle(dr["技术职务"]);
float max2 = (max>Convert.ToSingle(dr["班长"]))?max:Convert.ToSingle(dr["班长"]);
float total = max1+max2+Convert.ToSingle(dr["进核电厂"])+Convert.ToSingle(dr["进本公司"])+Convert.ToSingle(dr["劳模/"三八/"红旗手"])+
Convert.ToSingle(dr["独生子女"])+Convert.ToSingle(dr["残疾军人"])+Convert.ToSingle(dr["主控"])+Convert.ToSingle(dr["工艺倒班"]);
dr["总分"]= Math.Round(total,3);
dt.Rows.Add(dr);
}
else
{
DataRow dr = dtComm.NewRow();
dr["姓名"] = dataGrid3[i,1].ToString();
dr["性别"] = dataGrid3[i,2].ToString();
dr["文化程度"] = dataGrid3[i,3].ToString();
dr["入学年月"] = GetScoreForTime(dataGrid3[i,4].ToString(),cprAdm,admission);
dr["参加工作"] = GetScoreForTime(dataGrid3[i,5].ToString(),cprStartWork,startWork);
dr["进核电厂"] = GetScoreForTime(dataGrid3[i,6].ToString(),cprToFac,toFactory);
dr["进本公司"] = GetScoreForTime(dataGrid3[i,7].ToString(),cprToCompany,toCompany);
switch (dataGrid3[i,8].ToString())
{
case "正局":
dr["行政职务"] = bureauA.ToString();
break;
case "副局":
dr["行政职务"] = bureauB.ToString();
break;
case "正处":
dr["行政职务"] = departA.ToString();
break;
case "副处":
dr["行政职务"] = departB.ToString();
break;
case "正科":
dr["行政职务"] = secA.ToString();
break;
case "副科":
dr["行政职务"] = secB.ToString();
break;
default :
dr["行政职务"] = "0.000";
break;
}
switch (dataGrid3[i,9].ToString())
{
case "研高":
dr["技术职务"] = yg.ToString();
break;
case "副高":
dr["技术职务"] = fg.ToString();
break;
case "中级":
dr["技术职务"] = zj.ToString();
break;
case "技师":
dr["技术职务"] = js.ToString();
break;
case "助工":
dr["技术职务"] = zg.ToString();
break;
default :
dr["技术职务"] = "0.000";
break;
}
if (dataGrid3[i,10].ToString() =="是"||dataGrid3[i,10].ToString() =="有")
{
dr["班长"] = headMaster.ToString();
}
else
dr["班长"] = "0.000";
switch (dataGrid3[i,11].ToString())
{
case "全国":
dr["劳模/"三八/"红旗手"] = yg.ToString();
break;
case "省级":
dr["劳模/"三八/"红旗手"] = fg.ToString();
break;
case "部级":
dr["劳模/"三八/"红旗手"] = zj.ToString();
break;
case "公司":
dr["劳模/"三八/"红旗手"] = js.ToString();
break;
case "“三八”红旗手":
dr["劳模/"三八/"红旗手"] = zg.ToString();
break;
default :
dr["劳模/"三八/"红旗手"] = "0.000";
break;
}
if (dataGrid3[i,12].ToString() =="是"||dataGrid3[i,12].ToString() =="有")
{
dr["独生子女"] = singleChild.ToString();
}
else
dr["独生子女"] = "0.000";
if (dataGrid3[i,13].ToString() =="是"||dataGrid3[i,13].ToString() =="有")
{
dr["残疾军人"] = disArmy.ToString();
}
else
dr["残疾军人"] = "0.000";
if (dataGrid3[i,14].ToString() =="是"||dataGrid3[i,14].ToString() =="有")
{
dr["主控"] = chiefCtrl.ToString();
}
else
dr["主控"] = "0.000";
if (dataGrid3[i,15].ToString() =="是"||dataGrid3[i,15].ToString() =="有")
{
dr["工艺倒班"] = techShift.ToString();
}
else
dr["工艺倒班"] = "0.000";
//计算总分
dr["备注"] = dataGrid3[i,17].ToString();
dr["进厂日期"] = dataGrid3[i,7].ToString();
// dr["出生年月"] = GetProperDate(dataGrid3[i,18].ToString());
float max1 = (Convert.ToSingle(dr["入学年月"])>Convert.ToSingle(dr["参加工作"]))?Convert.ToSingle(dr["入学年月"]):Convert.ToSingle(dr["参加工作"]);
float max = (Convert.ToSingle(dr["行政职务"])>Convert.ToSingle(dr["技术职务"]))?Convert.ToSingle(dr["行政职务"]):Convert.ToSingle(dr["技术职务"]);
float max2 = (max>Convert.ToSingle(dr["班长"]))?max:Convert.ToSingle(dr["班长"]);
float total = max1+max2+Convert.ToSingle(dr["进核电厂"])+Convert.ToSingle(dr["进本公司"])+Convert.ToSingle(dr["劳模/"三八/"红旗手"])+
Convert.ToSingle(dr["独生子女"])+Convert.ToSingle(dr["残疾军人"])+Convert.ToSingle(dr["主控"])+Convert.ToSingle(dr["工艺倒班"]);
dr["总分"]= Math.Round(total,3);
dtComm.Rows.Add(dr);
}
}
#endregion
if (dt.Rows.Count == 0)
{
MessageBox.Show("没有局长级别的职工!");
this.dataGrid1.Visible = false;
this.button2.Enabled = false;
}
else
{
DataView dvPri = GetSortedData(dt);
DataRow[] dr = this.GetColoredRow(dvPri,dataRow,rowNum);
if (dr!=null)
{
this.ColorDataGrid(dataGrid1,dt,dvPri,dr);
this.button6.Enabled = true;
this.button2.Enabled = false;
}
this.dataGrid1.DataSource = dvPri;
}
if (dtComm.Rows.Count == 0)
{
MessageBox.Show("没有普通员工!");
this.dataGrid2.Visible = false;
this.button3.Enabled = false;
}
else
{
DataView dvCom = GetSortedData(dtComm);
DataRow[] dr1 = this.GetColoredRow(dvCom,dataRow1,rowNum1);
if (dr1!=null)
{
this.ColorDataGrid(dataGrid2,dtComm,dvCom,dr1);
this.button3.Enabled = false;
this.button7.Enabled = true;
}
this.dataGrid2.DataSource = GetSortedData(dtComm);
}
this.tabControl1.SelectedTab = this.tabPage2 ;
}
/// <summary>
/// 去掉日期的时分秒部分
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
private string GetProperDate(string date)
{
int start = date.IndexOf(" ");
return date.Substring(0,start);
}
/// <summary>
/// 给时间项计算得分
/// </summary>
/// <param name="time">输入的时间</param>
/// <param name="compareTime">对比的时间</param>
/// <param name="para">设置的每月得分数</param>
/// <returns></returns>
private float GetScoreForTime(string time,string compareTime,float para)
{
int cpTotalMonth ;
int timeTotalMonth;
float result;
string[] times = time.Split('.');
if (Convert.ToInt16(times[0]) < 100 && Convert.ToInt16(times[0])>20)
{
times[0] = "19"+times[0];
}
else
{
times[0] = "20"+times[0];
}
timeTotalMonth = Convert.ToInt16(times[0])*12+Convert.ToInt16(times[1]);
if (compareTime == "0")
{
System.DateTime dt = System.DateTime.Now;
cpTotalMonth = dt.Year * 12 + dt.Month;
}
else
{
string[] cpTimes = compareTime.Split('.');
if ( Convert.ToInt16(cpTimes[0]) < 100&&Convert.ToInt16(cpTimes[0])>20)
{
cpTimes[0] = "19"+cpTimes[0];
}
else
{
cpTimes[0] = "20"+cpTimes[0];
}
cpTotalMonth = Convert.ToInt16(cpTimes[0])*12+Convert.ToInt16(cpTimes[1]);
}
result = (cpTotalMonth - timeTotalMonth)*para;
return result;
}
//菜单上的“关于”按钮
private void miQuit_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
#region radioButton_CheckedChanged事件集合
private void radioButton2_CheckedChanged(object sender, System.EventArgs e)
{
this.textBox26.Text = "";
this.textBox26.Visible = true;
}
private void radioButton1_CheckedChanged(object sender, System.EventArgs e)
{
this.textBox26.Text = "0";
this.textBox26.Visible = false;
}
private void radioButton3_CheckedChanged(object sender, System.EventArgs e)
{
this.textBox27.Text = "0";
this.textBox27.Visible = false;
}
private void radioButton4_CheckedChanged(object sender, System.EventArgs e)
{
this.textBox27.Text = "";
this.textBox27.Visible = true;
}
private void radioButton5_CheckedChanged(object sender, System.EventArgs e)
{
this.textBox28.Text = "0";
this.textBox28.Visible = false;
}
private void radioButton6_CheckedChanged(object sender, System.EventArgs e)
{
this.textBox28.Text = "";
this.textBox28.Visible = true;
}
private void radioButton7_CheckedChanged(object sender, System.EventArgs e)
{
this.textBox29.Text = "0";
this.textBox29.Visible = false;
}
private void radioButton8_CheckedChanged(object sender, System.EventArgs e)
{
this.textBox29.Text = "";
this.textBox29.Visible = true;
}
#endregion
//获取排名以后的数据源
private DataView GetSortedData (DataTable dt)
{
DataView dv = new DataView(dt,"","总分 DESC,进厂日期 ASC,出生年月 ASC",DataViewRowState.CurrentRows);
for (int i=0;i<dv.Count;i++)
{
dv[i]["排名"]=i+1;
}
// dv.Table.Columns["排名"].ReadOnly = true;
dv.AllowDelete = false;
dv.AllowNew = false;
return dv;
}
/// <summary>
/// 导出普通表
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button3_Click(object sender, System.EventArgs e)
{
ExportExcel(dataGrid2,"职工自然状况计分表");
}
/// <summary>
/// 导出局长表
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, System.EventArgs e)
{
ExportExcel(dataGrid1,"职工自然状况计分表(局长)");
}
/// <summary>
/// 导出为excel
/// </summary>
/// <param name="dg">哪个表控件?</param>
/// <param name="reportName">Excel报表名(不是文件名)</param>
/// <returns></returns>
private bool ExportExcel (DataGrid dg,string reportName)
{
string saveFileName="";
bool fileSaved=false;
SaveFileDialog saveDialog=new SaveFileDialog();
saveDialog.DefaultExt ="xls";
saveDialog.Filter="Excel文件|*.xls";
saveDialog.FileName ="Sheet1";
saveDialog.ShowDialog();
saveFileName=saveDialog.FileName;
if(saveFileName.IndexOf(":")<0) return fileSaved; //被点了取消
//创建Excel对象
Excel.Application xlApp = new Excel.ApplicationClass();
if (xlApp == null)
{
MessageBox.Show("Excel无法启动");
return fileSaved;
}
//创建Excel工作簿
Excel.Workbook xlBook = xlApp.Workbooks.Add(true);
Excel.Worksheet xlSheet = (Excel.Worksheet)xlBook.Worksheets[1];
//列索引,行索引,总列数,总行数
DataView dv = (DataView)dg.DataSource;
int colIndex = 0;
int rowIndex = 0;
int colCount = dv.Table.Columns.Count;
int rowCount = dv.Table.Rows.Count;
//设置标题
Excel.Range range = xlSheet.get_Range(xlApp.Cells[1,1],xlApp.Cells[1,colCount]);
range.MergeCells = true;
xlApp.ActiveCell.FormulaR1C1 = reportName ;
xlApp.ActiveCell.Font.Size = 20;
xlApp.ActiveCell.Font.Bold = true;
xlApp.ActiveCell.HorizontalAlignment = Excel.Constants.xlCenter;
//创建缓存数据
object[,] objData = new object[rowCount+1,colCount];
//获取标题
foreach (DataColumn dc in dv.Table.Columns)
{
objData[rowIndex,colIndex] = dc.ColumnName;
colIndex++;
}
//获取数据
for(rowIndex=1;rowIndex<=rowCount;rowIndex++)
{
for(colIndex=0;colIndex<colCount;colIndex++)
{
objData[rowIndex,colIndex] = dg[rowIndex-1,colIndex];
}
Application.DoEvents();
}
//写入Excel
range = xlSheet.get_Range(xlApp.Cells[2,1],xlApp.Cells[rowCount+2,colCount]);
range.NumberFormat = "@";
range.Value2 = objData;
//保存
try
{
xlBook.Saved = true;
xlBook.SaveCopyAs(saveFileName);
}
catch
{
MessageBox.Show("保存出错,请检查!");
}
finally
{
xlApp.Quit();
GC.Collect();
fileSaved = true;
MessageBox.Show("导出完毕!");
}
return fileSaved;
}
//修改按钮
private void button5_Click(object sender, System.EventArgs e)
{
DataTable dt =(DataTable)this.dataGrid3.DataSource;
dt.DefaultView.AllowDelete = true;
dt.DefaultView.AllowEdit = true;
button5.Enabled = false;
MessageBox.Show("您可以编辑表格了!");
}
//职工表导出按钮
private void button4_Click(object sender, System.EventArgs e)
{
string saveFileName="";
SaveFileDialog saveDialog=new SaveFileDialog();
saveDialog.DefaultExt ="xls";
saveDialog.Filter="Excel文件|*.xls";
saveDialog.FileName ="Sheet1";
saveDialog.ShowDialog();
saveFileName=saveDialog.FileName;
if(saveFileName.IndexOf(":")<0) return ; //被点了取消
//创建Excel对象
Excel.Application xlApp = new Excel.ApplicationClass();
if (xlApp == null)
{
MessageBox.Show("Excel无法启动");
}
//创建Excel工作簿
Excel.Workbook xlBook = xlApp.Workbooks.Add(true);
Excel.Worksheet xlSheet = (Excel.Worksheet)xlBook.Worksheets[1];
//列索引,行索引,总列数,总行数
DataTable dt = (DataTable)dataGrid3.DataSource;
int colIndex = 0;
int rowIndex = 0;
int colCount = dt.Columns.Count;
int rowCount = dt.Rows.Count;
//设置标题
Excel.Range range = xlSheet.get_Range(xlApp.Cells[1,1],xlApp.Cells[1,colCount]);
range.MergeCells = true;
xlApp.ActiveCell.FormulaR1C1 = "职工自然状况表" ;
xlApp.ActiveCell.Font.Size = 20;
xlApp.ActiveCell.Font.Bold = true;
xlApp.ActiveCell.HorizontalAlignment = Excel.Constants.xlCenter;
//创建缓存数据
object[,] objData = new object[rowCount+1,colCount];
//获取标题
foreach (DataColumn dc in dt.Columns)
{
objData[rowIndex,colIndex] = dc.ColumnName;
colIndex++;
}
//获取数据
for(rowIndex=1;rowIndex<=rowCount;rowIndex++)
{
for(colIndex=0;colIndex<colCount;colIndex++)
{
objData[rowIndex,colIndex] = CheckBirthDate(dataGrid3[rowIndex-1,colIndex].ToString());
}
Application.DoEvents();
}
//写入Excel
range = xlSheet.get_Range(xlApp.Cells[2,1],xlApp.Cells[rowCount+2,colCount]);
range.NumberFormat = "@";
range.Value2 = objData;
//保存
try
{
xlBook.Saved = true;
xlBook.SaveCopyAs(saveFileName);
}
catch
{
MessageBox.Show("保存出错,请检查!");
}
finally
{
xlApp.Quit();
GC.Collect();
MessageBox.Show("导出完毕!");
}
}
private string CheckBirthDate(string field)
{
if(field.IndexOf(':')>-1)
{
return GetProperDate(field);
}
else
return field;
}
private void ds_ColumnChanging(object sender,System.Data.DataColumnChangeEventArgs e)
{
string content = e.ProposedValue.ToString();
switch (e.Column.ColumnName)
{
case "姓名":
if (e.ProposedValue.Equals(""))
{
// int rowNo = dataGrid3.CurrentCell.RowNumber;
// int colNo = dataGrid3.CurrentCell.ColumnNumber;
//object badValue = e.ProposedValue;
//e.ProposedValue = "非法数据!";
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "姓名不能为空!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
// this.dataGrid3.Focus();
//
// DataGridCell dgc = new DataGridCell(rowNo,colNo);
// this.dataGrid3.CurrentCell = dgc;
// DataGridTextBoxColumn dgtb = (DataGridTextBoxColumn)dataGrid3.TableStyles[0].GridColumnStyles[colNo];
//
// //设置焦点
// dgtb.TextBox.Focus();
}
else
{
e.Row.ClearErrors();
if (!ds.Tables[0].HasErrors)
{
this.button4.Enabled = true;
this.btnSave.Enabled = true;
this.btnSubmit.Enabled = true;
}
}
break;
case "入学年月":
if (content.IndexOf('.')<0||content=="")
{
// e.ProposedValue = "非法数据!";
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "不能为空或者没有输入月份!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
else
{
string[] a = content.Split('.');
if (Convert.ToInt16(a[1])>12)
{
// e.ProposedValue = "非法数据!";
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "月份超出范围!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
else
{
e.Row.ClearErrors();
if (!ds.Tables[0].HasErrors)
{
this.button4.Enabled = true;
this.btnSave.Enabled = true;
this.btnSubmit.Enabled = true;
}
}
}
break;
case "参加工作时间":
if (content.IndexOf('.')<0||content=="")
{
// e.ProposedValue = "非法数据!";
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "不能为空或者没有输入月份!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
else
{
string[] a = content.Split('.');
if (Convert.ToInt16(a[1])>12)
{
// e.ProposedValue = "非法数据!";
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "月份超出范围!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
else
{
e.Row.ClearErrors();
if (!ds.Tables[0].HasErrors)
{
this.button4.Enabled = true;
this.btnSave.Enabled = true;
this.btnSubmit.Enabled = true;
}
}
}
break;
case "进核电厂时间":
if (content.IndexOf('.')<0||content=="")
{
// e.ProposedValue = "非法数据!";
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "不能为空或者没有输入月份!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
else
{
string[] a = content.Split('.');
if (Convert.ToInt16(a[1])>12)
{
// e.ProposedValue = "非法数据!";
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "月份超出范围!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
else
{
e.Row.ClearErrors();
if (!ds.Tables[0].HasErrors)
{
this.button4.Enabled = true;
this.btnSave.Enabled = true;
this.btnSubmit.Enabled = true;
}
}
}
break;
case "进本公司时间":
if (content.IndexOf('.')<0||content=="")
{
// e.ProposedValue = "非法数据!";
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "不能为空或者没有输入月份!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
else
{
string[] a = content.Split('.');
if (Convert.ToInt16(a[1])>12)
{
// e.ProposedValue = "非法数据!";
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "月份超出范围!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
else
{
e.Row.ClearErrors();
if (!ds.Tables[0].HasErrors)
{
this.button4.Enabled = true;
this.btnSave.Enabled = true;
this.btnSubmit.Enabled = true;
}
}
}
break;
case "班长":
if (content == ""||content == "是"||content=="有")
{
e.Row.ClearErrors();
if (!ds.Tables[0].HasErrors)
{
this.button4.Enabled = true;
this.btnSave.Enabled = true;
this.btnSubmit.Enabled = true;
}
}
else
{
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "请输入‘是’‘有’或者留空!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
break;
case "独生子女":
if (content == ""||content == "是"||content=="有")
{
e.Row.ClearErrors();
if (!ds.Tables[0].HasErrors)
{
this.button4.Enabled = true;
this.btnSave.Enabled = true;
this.btnSubmit.Enabled = true;
}
}
else
{
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "请输入‘是’‘有’或者留空!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
break;
case "残疾军人":
if (content == ""||content == "是"||content=="有")
{
e.Row.ClearErrors();
if (!ds.Tables[0].HasErrors)
{
this.button4.Enabled = true;
this.btnSave.Enabled = true;
this.btnSubmit.Enabled = true;
}
}
else
{
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "请输入‘是’‘有’或者留空!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
break;
case "主控":
if (content == ""||content == "是"||content=="有")
{
e.Row.ClearErrors();
if (!ds.Tables[0].HasErrors)
{
this.button4.Enabled = true;
this.btnSave.Enabled = true;
this.btnSubmit.Enabled = true;
}
}
else
{
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "请输入‘是’‘有’或者留空!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
break;
case "工艺倒班":
if (content == ""||content == "是"||content=="有")
{
e.Row.ClearErrors();
if (!ds.Tables[0].HasErrors)
{
this.button4.Enabled = true;
this.btnSave.Enabled = true;
this.btnSubmit.Enabled = true;
}
}
else
{
e.Row.RowError = "此行有错误!";
e.Row.SetColumnError(e.Column, "请输入‘是’‘有’或者留空!");
this.button4.Enabled = false;
this.btnSave.Enabled = false;
this.btnSubmit.Enabled = false;
}
break;
default:
break;
}
}
//关于按钮
private void miAbout_Click(object sender, System.EventArgs e)
{
MessageBox.Show("Version 1.0");
}
/// <summary>
/// 获取需要变色的DataView中的行
/// </summary>
/// <param name="dg"></param>
/// <returns></returns>
private DataRow[] GetColoredRow(DataView dv,ArrayList dataRow, ArrayList rowNum)
{
for (int row=0;row<dv.Table.Rows.Count-1;row++)
{
if (Convert.ToSingle(dv[row].Row[4]) == Convert.ToSingle(dv[row+1].Row[4]) && dv[row].Row[18].ToString()== dv[row+1].Row[18].ToString() && dv[row].Row[19].ToString()==dv[row+1].Row[19].ToString())
{
if (!dataRow.Contains(dv[row].Row))
{
dataRow.Add(dv[row].Row);
rowNum.Add(row);
}
if (!dataRow.Contains(dv[row+1].Row))
{
dataRow.Add(dv[row+1].Row);
rowNum.Add(row+1);
}
}
}
if (dataRow.Count!=0)
{
return (DataRow[])dataRow.ToArray(typeof(DataRow));
}
else
return null;
}
//给DataGrid控件的同分同进厂的列加颜色
private void ColorDataGrid (DataGrid dg,DataTable dataSource,DataView sortedDT,DataRow[] dr)
{
//设置列以及每列的行样式
DataGridTableStyle dgTableStyle = new DataGridTableStyle();
dgTableStyle.MappingName = dataSource.TableName;
foreach (DataColumn eachCol in dataSource.Columns)
{
DataGridColoredTextBoxColumn dbColumnStyle = new DataGridColoredTextBoxColumn();
dbColumnStyle.MappingName = eachCol.ColumnName;
dbColumnStyle.HeaderText = eachCol.ColumnName;
dbColumnStyle.NullText = "";
if (dbColumnStyle.MappingName!="出生年月")
{
dbColumnStyle.ReadOnly = true;
}
//设置变色行的条件以及前景和背景色
dbColumnStyle.SetRowsColor(dr, new SolidBrush(Color.White), new SolidBrush(Color.Red));
dgTableStyle.GridColumnStyles.Add(dbColumnStyle);
}
//添加样式到dataGrid
dg.TableStyles.Clear();
dg.TableStyles.Add(dgTableStyle);
}
/// <summary>
/// 局长表同分重排按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button6_Click(object sender, System.EventArgs e)
{
if (isEmpty(dataGrid1,rowNum))
{
MessageBox.Show("请您输入局长表突出显示行的出生年月!");
return;
}
SortAgain(dataGrid1,dataRow,rowNum);
}
//普通表同分重排按钮
private void button7_Click(object sender, System.EventArgs e)
{
if (isEmpty(dataGrid2,rowNum1))
{
MessageBox.Show("请您输入普通表突出显示行的出生年月!");
return;
}
SortAgain(dataGrid2,dataRow1,rowNum1);
}
/// <summary>
/// 重排
/// </summary>
/// <param name="dg">DataGrid</param>
/// <param name="dataRow">和DataGrid相关的ArrayList</param>
/// <param name="rowNum">和DataGrid相关的ArrayList</param>
private void SortAgain(DataGrid dg, ArrayList dataRow, ArrayList rowNum)
{
DataView dv = (DataView)dg.DataSource;
DataTable dt = dv.Table;
string birth;
for (int i=0;i<rowNum.Count;i++)
{
birth = dg[(int)rowNum[i],19].ToString();
dv[(int)rowNum[i]].Row[19] = birth;
}
//初始化
dataRow = new ArrayList();
rowNum = new ArrayList();
DataRow[] dr = this.GetColoredRow(dv,dataRow,rowNum);
if (dr!=null)
{
this.ColorDataGrid(dg,dt,dv,dr);
MessageBox.Show("请您检查突出显示行,确保添加了的出生年月不能相同!");
return;
}
else
{
for (int i=0;i<dv.Count;i++)
{
dv[i]["排名"]=i+1;
}
dg.DataSource = dv;
if (dg==dataGrid1)
{
this.button2.Enabled = true;
this.button6.Enabled = false;
}
if (dg==dataGrid2)
{
this.button3.Enabled = true;
this.button7.Enabled = false;
}
dg.TableStyles.Clear();
}
}
//检查是否确实填写了出生年月
private bool isEmpty(DataGrid dg,ArrayList rowNum)
{
bool ret = false;
for (int i=0;i<rowNum.Count;i++)
{
if (dg[(int)rowNum[i],19].ToString()=="")
{
ret = true;
return ret;
}
}
return ret;
}
//tab1中的读取按钮
private void btnRead_Click(object sender, System.EventArgs e)
{
}
//tab1中的删除行按钮
private void btnDel_Click(object sender, System.EventArgs e)
{
}
}
}