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

📄 treenodeform.cs

📁 c#编写的人事管理系统源码 写得不错 值得收藏
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace PM
{
	/// <summary>
	/// TreeNodeForm 的摘要说明。
	/// </summary>
	public class TreeNodeForm : System.Windows.Forms.Form
	{
		public System.Windows.Forms.Label label1;
		public System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public static TreeNodeForm tnf;
		public TreeNodeForm()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			tnf = this;

			//
			// 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(TreeNodeForm));
			this.label1 = new System.Windows.Forms.Label();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(24, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(100, 16);
			this.label1.TabIndex = 0;
			// 
			// textBox1
			// 
			this.textBox1.Location = new System.Drawing.Point(24, 40);
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(184, 21);
			this.textBox1.TabIndex = 1;
			this.textBox1.Text = "";
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(32, 80);
			this.button1.Name = "button1";
			this.button1.TabIndex = 2;
			this.button1.Text = "确定";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(128, 80);
			this.button2.Name = "button2";
			this.button2.TabIndex = 2;
			this.button2.Text = "取消";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// TreeNodeForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(240, 117);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.textBox1);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.button2);
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "TreeNodeForm";
			this.ResumeLayout(false);

		}
		#endregion

        #region  取消
		private void button2_Click(object sender, System.EventArgs e)
		{
		    this.Close();
		}
		#endregion

        #region  确定
		private void button1_Click(object sender, System.EventArgs e)
		{
			Base bb = new Base();
			switch(this.label1.Text)
			{
				case "请输入部门名称":
				{
					string s = "insert into SectionInfo (sName) values ('" + this.textBox1.Text.Trim() + "')";
					string str = "select * from SectionInfo where sName='" + this.textBox1.Text.Trim() + "'";
					if(bb.IsRead(str) == false)
					{
					    Base b = new Base();
						b.ExeSQL(s);
						sessionForm.sf.sessionForm_Load(sender,e);
					}
				    break;
				}
				case "请输入民族名称":
				{
				    string s = "insert into RaceInfo (rName) values('" + this.textBox1.Text.Trim() + "')";
					string str = "select * from RaceInfo where rName='" + this.textBox1.Text.Trim() + "'" ;
					if(bb.IsRead(str) == false)
					{
						Base b = new Base();
						b.ExeSQL(s);
						otherForm.of.DBListBox1();
					}
					else
					{
					    MessageBox.Show("你添加的民族已经存在!");
					}
					break;
				}
				case "请输入职务名称":
				{
				    string s = "insert into JobInfo (JName) values('" + this.textBox1.Text.Trim() + "')";
					string str = "select * from JobInfo where JName='" + this.textBox1.Text.Trim() + "'";
					if(bb.IsRead(str) == false)
					{
						Base b = new Base();
						b.ExeSQL(s);
						otherForm.of.DBListBox2();
					}
					else
					{
					    MessageBox.Show("你添加的职务已经存在!");
					}
					break;
				}
				case "请输入职称名称":
				{
				    string s = "insert into Title (tName) values('" + this.textBox1.Text.Trim() + "')";
					string str = "select * from Title where tName='" + this.textBox1.Text.Trim() + "'";
					if(bb.IsRead(str) == false)
					{
						Base b = new Base();
						b.ExeSQL(s);
						otherForm.of.DBListBox3();
					}
					else
					{
					    MessageBox.Show("你添加的职称已经存在!");
					}
					break;
				}
				case "请输入新部门名称":
				{
					 sessionForm.sf.treeView1.SelectedNode.Text = this.textBox1.Text;
					 string s = "update SectionInfo set sName='" + this.textBox1.Text.Trim() + "' where sId=" + int.Parse(sessionForm.sf.sessionId);
					 Base b = new Base();
					b.ExeSQL(s);
					sessionForm.sf.sessionForm_Load(sender,e);
				     break;
				}
			}
		}
		#endregion
	}
}

⌨️ 快捷键说明

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