📄 transferform.cs
字号:
// comboBox3
//
this.comboBox3.Location = new System.Drawing.Point(296, 48);
this.comboBox3.Name = "comboBox3";
this.comboBox3.Size = new System.Drawing.Size(121, 20);
this.comboBox3.TabIndex = 12;
this.comboBox3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox3_KeyPress);
//
// label7
//
this.label7.Location = new System.Drawing.Point(440, 56);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(72, 16);
this.label7.TabIndex = 11;
this.label7.Text = "调动后职务";
//
// label6
//
this.label6.Location = new System.Drawing.Point(224, 56);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(72, 16);
this.label6.TabIndex = 10;
this.label6.Text = "调动前职务";
//
// comboBox2
//
this.comboBox2.Location = new System.Drawing.Point(88, 48);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(121, 20);
this.comboBox2.TabIndex = 9;
this.comboBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox2_KeyPress);
//
// label5
//
this.label5.Location = new System.Drawing.Point(16, 56);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(72, 16);
this.label5.TabIndex = 8;
this.label5.Text = "调动后部门";
//
// comboBox1
//
this.comboBox1.Location = new System.Drawing.Point(720, 16);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 20);
this.comboBox1.TabIndex = 7;
this.comboBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox1_KeyPress);
//
// label4
//
this.label4.Location = new System.Drawing.Point(648, 24);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(64, 16);
this.label4.TabIndex = 6;
this.label4.Text = "调动前部门";
//
// label3
//
this.label3.Location = new System.Drawing.Point(440, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 16);
this.label3.TabIndex = 4;
this.label3.Text = "调动时间";
//
// name_txt
//
this.name_txt.Location = new System.Drawing.Point(296, 16);
this.name_txt.Name = "name_txt";
this.name_txt.TabIndex = 3;
this.name_txt.Text = "";
this.name_txt.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.name_txt_KeyPress);
//
// label2
//
this.label2.Location = new System.Drawing.Point(224, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 16);
this.label2.TabIndex = 2;
this.label2.Text = "员工姓名";
//
// ID_txt
//
this.ID_txt.Location = new System.Drawing.Point(88, 16);
this.ID_txt.Name = "ID_txt";
this.ID_txt.TabIndex = 1;
this.ID_txt.Text = "";
this.ID_txt.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ID_txt_KeyPress);
this.ID_txt.TextChanged += new System.EventHandler(this.ID_txt_TextChanged);
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 16);
this.label1.TabIndex = 0;
this.label1.Text = "员工编号";
//
// button2
//
this.button2.Location = new System.Drawing.Point(784, 48);
this.button2.Name = "button2";
this.button2.TabIndex = 14;
this.button2.Text = "取消";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// pageSetupDialog1
//
this.pageSetupDialog1.Document = this.printDocument1;
this.pageSetupDialog1.ShowHelp = true;
//
// printPreviewDialog1
//
this.printPreviewDialog1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.ClientSize = new System.Drawing.Size(400, 300);
this.printPreviewDialog1.Document = this.printDocument1;
this.printPreviewDialog1.Enabled = true;
this.printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
this.printPreviewDialog1.Location = new System.Drawing.Point(333, 18);
this.printPreviewDialog1.MinimumSize = new System.Drawing.Size(375, 250);
this.printPreviewDialog1.Name = "printPreviewDialog1";
this.printPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty;
this.printPreviewDialog1.UseAntiAlias = true;
this.printPreviewDialog1.Visible = false;
//
// printDialog1
//
this.printDialog1.AllowSelection = true;
this.printDialog1.AllowSomePages = true;
this.printDialog1.Document = this.printDocument1;
this.printDialog1.ShowHelp = true;
//
// printDocument1
//
this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
//
// contextMenu2
//
this.contextMenu2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem2,
this.menuItem3});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.Text = "页面设置";
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.Text = "打印预览";
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
//
// menuItem3
//
this.menuItem3.Index = 2;
this.menuItem3.Text = "打印";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// TransferForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(928, 461);
this.Controls.Add(this.group1);
this.Controls.Add(this.dataGrid1);
this.Controls.Add(this.toolBar1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TransferForm";
this.Text = "部门调动";
this.EnabledChanged += new System.EventHandler(this.TransferForm_EnabledChanged);
this.Load += new System.EventHandler(this.TransferForm_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.group1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
public void TransferForm_Load(object sender, System.EventArgs e)
{
DBDataGrid();
this.DBddl();
switch(Form1.f1.power)
{
case "系统管理员":
{
this.toolBarButton5.Enabled = true;
this.toolBarButton6.Enabled = true;
this.toolBarButton7.Enabled = true;
break;
}
case "管理员":
{
this.toolBarButton5.Enabled = true;
this.toolBarButton6.Enabled = true;
this.toolBarButton7.Enabled = true;
break;
}
case "一般用户":
{
this.toolBarButton5.Enabled = false;
this.toolBarButton6.Enabled = false;
this.toolBarButton7.Enabled = false;
break;
}
default :
{
this.toolBarButton5.Enabled = false;
this.toolBarButton6.Enabled = false;
this.toolBarButton7.Enabled = false;
break;
}
}
}
private void DBddl()
{
string str = "select * from SectionInfo";
Base bb = new Base();
DataTable dt = bb.ExeSQLdt(str);
for(int i =0 ; i < dt.Rows.Count ;i ++)
{
this.comboBox1.Items.Add(dt.Rows[i]["sName"].ToString());
this.comboBox2.Items.Add(dt.Rows[i]["sName"].ToString());
}
string s = "select * from Title";
DataTable table = bb.ExeSQLdt(s);
for(int j= 0; j < table.Rows.Count ;j ++ )
{
this.comboBox3.Items.Add(table.Rows[j]["tName"].ToString());
this.comboBox4.Items.Add(table.Rows[j]["tName"].ToString());
}
}
public void DBDataGrid()
{
string str = "select TransferInfo.aaId,TransferInfo.traId as 员工编号,EmployInfo.eName as 员工姓名,TransferInfo.tDate as 调动时间,TransferInfo.fSection as 调动前部门,";
str += "TransferInfo.lSection as 调动后部门,TransferInfo.fJob as 调动前职务,TransferInfo.lJob as 调动后职务,TransferInfo.tReason as 调动原因,TransferInfo.tApp as 批准人,TransferInfo.tRemarks as [备注] ";
str += " from TransferInfo,EmployInfo where EmployInfo.traId=TransferInfo.traId order by TransferInfo.traId asc";
Base bb = new Base();
this.dt = bb.ExeSQLdt(str);
this.dataGrid1.DataSource = this.dt.DefaultView;
this.cm = (CurrencyManager)BindingContext[this.dt];
File.DataGridStyle(this.dt,2,this.dataGrid1);
}
#region 工具栏事件
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
switch(e.Button.ToolTipText)
{
case "首记录":
{
if(cm.Position != 0)
{
this.dataGrid1.UnSelect(cm.Position);
cm.Position = 0;
this.dataGrid1.Select(cm.Position);
this.dataGrid1.CurrentRowIndex = cm.Position;
}
break;
}
case "上记录":
{
if(cm.Position > 0)
{
this.dataGrid1.UnSelect(cm.Position );
cm.Position -= 1;
this.dataGrid1.Select(cm.Position);
this.dataGrid1.CurrentRowIndex = cm.Position;
}
break;
}
case "下记录":
{
if(cm.Position < cm.Count - 1)
{
this.dataGrid1.UnSelect(cm.Position );
cm.Position += 1;
this.dataGrid1.Select(cm.Position);
this.dataGrid1.CurrentRowIndex = cm.Position;
}
break;
}
case "尾记录":
{
if(cm.Position != cm.Count - 1)
{
this.dataGrid1.UnSelect(cm.Position);
cm.Position = cm.Count - 1;
this.dataGrid1.Select(cm.Count - 1);
this.dataGrid1.CurrentRowIndex = cm.Position;
}
break;
}
case "添加":
{
this.insert(sender,e);
break;
}
case "修改":
{
this.update(sender,e);
break;
}
case "删除":
{
this.delete(sender,e);
break;
}
case "退出":
{
this.close(sender,e);
break;
}
case "列选择":
{
this.Colselect(sender,e);
break;
}
case"查找":
{
this.search(sender,e);
break;
}
}
}
#endregion
#region 工具栏事件方法
//插入
private void insert(System.Object sender, System.EventArgs e)
{
TransferForm.employId = "insert";
if(mainForm.mf.CheckForm("Record") == true)
{
return ;
}
else
{
Record rd = new Record();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -