⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formdepartmentsum.cs

📁 蓝山人事管理系统
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data ;
using System.Data .SqlClient ;


namespace BlueHill.BlueHillWindows.SalaryManagement
{
	public class FormDepartmentSum : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.Button btnCancel;
		private System.Windows.Forms.TreeView treeView1;
	    Salary sm=new Salary  ();
		private System.ComponentModel.Container components = null;

		public FormDepartmentSum()
		{
			
			InitializeComponent();

		}

		
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.btnOK = new System.Windows.Forms.Button();
			this.btnCancel = new System.Windows.Forms.Button();
			this.treeView1 = new System.Windows.Forms.TreeView();
			this.SuspendLayout();
			// 
			// btnOK
			// 
			this.btnOK.Location = new System.Drawing.Point(208, 168);
			this.btnOK.Name = "btnOK";
			this.btnOK.Size = new System.Drawing.Size(72, 24);
			this.btnOK.TabIndex = 0;
			this.btnOK.Text = "确定";
			this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
			// 
			// btnCancel
			// 
			this.btnCancel.Location = new System.Drawing.Point(208, 248);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.Size = new System.Drawing.Size(72, 24);
			this.btnCancel.TabIndex = 1;
			this.btnCancel.Text = "取消";
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// treeView1
			// 
			this.treeView1.ImageIndex = -1;
			this.treeView1.Location = new System.Drawing.Point(16, 32);
			this.treeView1.Name = "treeView1";
			this.treeView1.SelectedImageIndex = -1;
			this.treeView1.Size = new System.Drawing.Size(160, 272);
			this.treeView1.TabIndex = 2;
			this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
			// 
			// FormDepartmentSum
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(304, 333);
			this.Controls.Add(this.treeView1);
			this.Controls.Add(this.btnCancel);
			this.Controls.Add(this.btnOK);
			this.Name = "FormDepartmentSum";
			this.Text = "部门汇总";
			this.Load += new System.EventHandler(this.FormDepartmentSum_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void btnOK_Click(object sender, System.EventArgs e)
		{
			if (this.treeView1 .SelectedNode !=null)
			{
				Form1 f=new Form1 (this.treeView1 .SelectedNode .Text);
				f.ShowDialog ();
			}
			else 
			{ 
				MessageBox.Show ("请选择一个部门!");
			}

		}

		private void btnCancel_Click(object sender, System.EventArgs e)
		{
			this.Hide ();
		}
		public SqlConnection conn=null; 
		public SqlDataAdapter adp=null;
		public DataSet ds=null;

//		public SqlConnection conn1=null; 
//		public SqlDataAdapter adp1=null;
//		public DataSet ds1=null;

		private void FormDepartmentSum_Load(object sender, System.EventArgs e)
		{
			SqlConnection conn=new SqlConnection("integrated security=SSPI;data source=(local);initial catalog=BlueHill");
			adp=new SqlDataAdapter ("select *from tblDepartment",conn);
			ds=new DataSet ();
			adp.Fill (ds,"tblDepartment");


			int k=ds.Tables [0].Rows .Count ;
			int i=0;
			for(i=0;i<k;i++)
			{
				treeView1.Nodes .Add (ds.Tables [0].Rows [i]["deptname"].ToString ());
			}
		}

		private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
		{
		
		}



		}
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -