?? formmoveemployeetodepartment.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace BlueHill.BlueHillWindows.DepartmentManagement
{
/// <summary>
/// FormMoveEmployeeToDepartment 的摘要說明。
/// </summary>
public class FormMoveEmployeeToDepartment : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btncel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.ComboBox cbDeptName;
/// <summary>
/// 必需的設(shè)計(jì)器變量。
/// </summary>
private System.ComponentModel.Container components = null;
private TreeView depttv;
private System.Windows.Forms.Label label2;
private string deptna;
public FormMoveEmployeeToDepartment(TreeView tv1,string dn)
{
//
// Windows 窗體設(shè)計(jì)器支持所必需的
//
InitializeComponent();
depttv=tv1;
deptna=dn;
//
// TODO: 在 InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設(shè)計(jì)器生成的代碼
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.btncel = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.btnOK = new System.Windows.Forms.Button();
this.cbDeptName = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btncel
//
this.btncel.Location = new System.Drawing.Point(200, 104);
this.btncel.Name = "btncel";
this.btncel.TabIndex = 7;
this.btncel.Text = "取消";
this.btncel.Click += new System.EventHandler(this.btncel_Click);
//
// label1
//
this.label1.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.Location = new System.Drawing.Point(24, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(184, 23);
this.label1.TabIndex = 6;
this.label1.Text = "刪除部門前,請先移動(dòng)員工";
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(32, 104);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(72, 24);
this.btnOK.TabIndex = 5;
this.btnOK.Text = "確定";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// cbDeptName
//
this.cbDeptName.Location = new System.Drawing.Point(136, 56);
this.cbDeptName.Name = "cbDeptName";
this.cbDeptName.Size = new System.Drawing.Size(121, 20);
this.cbDeptName.TabIndex = 4;
//
// label2
//
this.label2.Location = new System.Drawing.Point(24, 56);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(88, 23);
this.label2.TabIndex = 8;
this.label2.Text = "員工移動(dòng)至:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// FormMoveEmployeeToDepartment
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(304, 165);
this.Controls.Add(this.label2);
this.Controls.Add(this.btncel);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.cbDeptName);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "FormMoveEmployeeToDepartment";
this.Text = "員工轉(zhuǎn)移";
this.Load += new System.EventHandler(this.FormMoveEmployeeToDepartment_Load);
this.ResumeLayout(false);
}
#endregion
private void btnOK_Click(object sender, System.EventArgs e)
{
if(this.cbDeptName .Text != "")
{
MoveEmployee dept = new MoveEmployee ();
dept.deptname=this.cbDeptName .SelectedItem.ToString();
dept.deptname1 = deptna;
dept.updateemployee();
dept.com.ExecuteNonQuery();
MessageBox.Show("刪除部門成功!");
depttv.Nodes.Remove(depttv.SelectedNode);
dept.conn.Close();
dept.deldept();
dept.com1.ExecuteNonQuery();
dept.conn1.Close();
this.Close();
}
else
{
MessageBox.Show("請選擇一個(gè)部門!");
}
}
private void FormMoveEmployeeToDepartment_Load(object sender, System.EventArgs e)
{
int i=0;
for(i=0;i<depttv.Nodes.Count;i++)
{
if(! string.Equals(deptna,depttv.Nodes[i].Text))
{
this.cbDeptName .Items.Add(depttv.Nodes[i].Text);
}
}
}
private void btncel_Click(object sender, System.EventArgs e)
{
this.Close ();
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -