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

📄 frmplatfdeptinfo.cs

📁 功能设计:平台管理、收费点维护、收费项目管理、缴费管理
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OracleClient;
using GlobleUtility;
using Charge;


namespace PlatF
{
	/// <summary>
	/// 部门详细信息的查看修改界面。
	/// </summary>
	public class CfrmPlatFDeptInfo : System.Windows.Forms.Form
	{
		#region
		private System.Windows.Forms.GroupBox gbDept;
		private System.Windows.Forms.Label labId;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TextBox txtDeptName;//“部门名称“文本框
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.ImageList imageListtbr;
		private System.Windows.Forms.ToolBar tbrDept;
		private System.Windows.Forms.ToolBarButton toolBarButton8;
		private System.Windows.Forms.ToolBarButton tbrButtonSave;//工具栏上“保存”按钮
		private System.Windows.Forms.ToolBarButton tbrButtonExit;//工具栏上“退出”按钮
		private System.ComponentModel.IContainer components;
		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.ComboBox cbbIsTeach;//“是否下属教工”下拉框
		private System.Windows.Forms.ComboBox cbbIsStud; //“是否下属学生”下拉框
		private System.Windows.Forms.TextBox txtOwnerDeptName;//“上级部门”文本框
		private System.Windows.Forms.TextBox txtDeptDesc;//”部门描述“文本框
		private System.Windows.Forms.TextBox txtDeptNumber;//”部门人数“文本框
        private System.Windows.Forms.Button btnDeptSel;//上级部门选择安钮
		#endregion

		ListView tp_lvDept;
		private string OrgName; //保存学校名称
		private int OrgID; //保存学校ID
		private string OwnerDeptName; //保存初始上级部门名称
		private int OwnerDeptID; //保存上级部门ID   	
		public CfrmPlatFDeptInfo(ListView lvDept,int AddSign)
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//初始化pnlDept部门显示控件
			//数据库查询操作,listview中按照名称顺序显示记录
			System.Data.OracleClient.OracleConnection Org_myConn = Connection.DBConnection;
			if (Org_myConn == null)
			{
				return;	
			}
			//判断有无学校信息存在,如果没有,则无法新建部门
			string Org_mySql = "SELECT OrgName FROM Charge_School_Info";
			OracleCommand selCommand = new OracleCommand(Org_mySql,Org_myConn);
			
			OracleDataReader trvDataReader = null;
			try
			{
				trvDataReader = selCommand.ExecuteReader();
			}
			catch(Exception ee)
			{
				MessageBox.Show("数据库查询出错,消息如下:\r\n"+ee.Message,"消息:",MessageBoxButtons.OK,MessageBoxIcon.Warning);
				return;
			}
			if (!trvDataReader.HasRows)
			{
				MessageBox.Show("在建立部门信息之前必须建立学校信息!");
				this.Close();
			}
			trvTagTemp TagTemp= new trvTagTemp();//为结构trvTagTemp分配内存
			TreeNode rootNode = new TreeNode();
			while (trvDataReader.Read ())
			{
				OrgName = trvDataReader.GetValue(0).ToString().Trim();
				OrgID = 0;
				
			}	
		    //对父窗体listview的引用
			tp_lvDept=lvDept;

			//初始化DateTimer,comboBox
			cbbIsStud.Items.Add("是");
			cbbIsStud.Items.Add("否");
			cbbIsStud.SelectedIndex = 1;
			cbbIsTeach.Items.Add("是");
			cbbIsTeach.Items.Add("否");
			cbbIsTeach.SelectedIndex = 0;
		    cbbIsStud.DropDownStyle = ComboBoxStyle.DropDownList;
			cbbIsTeach.DropDownStyle = ComboBoxStyle.DropDownList;

			//新增信息操作窗体
			if (AddSign ==1)
			{
				//toolbar设置
				
				tbrButtonSave.Enabled = false;
				//groupbox内控件设置
				txtDeptName.ReadOnly = false;
				txtDeptDesc.ReadOnly = false;
				txtDeptNumber.ReadOnly =false;
                cbbIsStud.Enabled =true;
				cbbIsTeach.Enabled =true;
				txtOwnerDeptName.ReadOnly = true;
				btnDeptSel.Enabled = true;
				labId.Text = "";

				//初始化部门信息
				txtDeptName.Text = "";				
				txtDeptDesc.Text = "";
				txtDeptNumber.Text = "";
				

				//初始化上级部门名称,默认为学校名称
				txtOwnerDeptName.Text = OrgName;	
				txtOwnerDeptName.Tag = OrgID;
		
				//在变量中保存当前上级部门名称与ID
                OwnerDeptName = OrgName;
			    OwnerDeptID = OrgID;
	
				txtDeptName.Focus();
				return;
			}
			//
			// 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()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CfrmPlatFDeptInfo));
			this.gbDept = new System.Windows.Forms.GroupBox();
			this.txtDeptDesc = new System.Windows.Forms.TextBox();
			this.cbbIsStud = new System.Windows.Forms.ComboBox();
			this.label8 = new System.Windows.Forms.Label();
			this.txtDeptNumber = new System.Windows.Forms.TextBox();
			this.cbbIsTeach = new System.Windows.Forms.ComboBox();
			this.label10 = new System.Windows.Forms.Label();
			this.label9 = new System.Windows.Forms.Label();
			this.txtOwnerDeptName = new System.Windows.Forms.TextBox();
			this.btnDeptSel = new System.Windows.Forms.Button();
			this.txtDeptName = new System.Windows.Forms.TextBox();
			this.labId = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label7 = new System.Windows.Forms.Label();
			this.imageListtbr = new System.Windows.Forms.ImageList(this.components);
			this.tbrDept = new System.Windows.Forms.ToolBar();
			this.toolBarButton8 = new System.Windows.Forms.ToolBarButton();
			this.tbrButtonSave = new System.Windows.Forms.ToolBarButton();
			this.tbrButtonExit = new System.Windows.Forms.ToolBarButton();
			this.gbDept.SuspendLayout();
			this.SuspendLayout();
			// 
			// gbDept
			// 
			this.gbDept.Controls.Add(this.txtDeptDesc);
			this.gbDept.Controls.Add(this.cbbIsStud);
			this.gbDept.Controls.Add(this.label8);
			this.gbDept.Controls.Add(this.txtDeptNumber);
			this.gbDept.Controls.Add(this.cbbIsTeach);
			this.gbDept.Controls.Add(this.label10);
			this.gbDept.Controls.Add(this.label9);
			this.gbDept.Controls.Add(this.txtOwnerDeptName);
			this.gbDept.Controls.Add(this.btnDeptSel);
			this.gbDept.Controls.Add(this.txtDeptName);
			this.gbDept.Controls.Add(this.labId);
			this.gbDept.Controls.Add(this.label1);
			this.gbDept.Controls.Add(this.label2);
			this.gbDept.Controls.Add(this.label7);
			this.gbDept.Location = new System.Drawing.Point(8, 64);
			this.gbDept.Name = "gbDept";
			this.gbDept.Size = new System.Drawing.Size(520, 216);
			this.gbDept.TabIndex = 2;
			this.gbDept.TabStop = false;
			this.gbDept.Text = "部门信息";
			// 
			// txtDeptDesc
			// 
			this.txtDeptDesc.Location = new System.Drawing.Point(72, 56);
			this.txtDeptDesc.MaxLength = 100;
			this.txtDeptDesc.Multiline = true;
			this.txtDeptDesc.Name = "txtDeptDesc";
			this.txtDeptDesc.Size = new System.Drawing.Size(440, 104);
			this.txtDeptDesc.TabIndex = 6;
			this.txtDeptDesc.Text = "textBox2";
			// 
			// cbbIsStud
			// 
			this.cbbIsStud.Location = new System.Drawing.Point(256, 176);
			this.cbbIsStud.Name = "cbbIsStud";
			this.cbbIsStud.Size = new System.Drawing.Size(72, 20);
			this.cbbIsStud.TabIndex = 8;
			this.cbbIsStud.Text = "comboBox2";
			// 
			// label8
			// 
			this.label8.Location = new System.Drawing.Point(160, 176);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(96, 23);
			this.label8.TabIndex = 25;
			this.label8.Text = "是否下属学生:";
			// 
			// txtDeptNumber
			// 
			this.txtDeptNumber.ImeMode = System.Windows.Forms.ImeMode.Alpha;
			this.txtDeptNumber.Location = new System.Drawing.Point(72, 176);
			this.txtDeptNumber.MaxLength = 10;
			this.txtDeptNumber.Name = "txtDeptNumber";
			this.txtDeptNumber.Size = new System.Drawing.Size(72, 21);
			this.txtDeptNumber.TabIndex = 7;
			this.txtDeptNumber.Text = "textBox1";
			// 
			// cbbIsTeach
			// 
			this.cbbIsTeach.Location = new System.Drawing.Point(440, 176);
			this.cbbIsTeach.Name = "cbbIsTeach";
			this.cbbIsTeach.Size = new System.Drawing.Size(72, 20);
			this.cbbIsTeach.TabIndex = 9;
			this.cbbIsTeach.Text = "comboBox1";
			// 
			// label10
			// 
			this.label10.Location = new System.Drawing.Point(8, 88);
			this.label10.Name = "label10";
			this.label10.Size = new System.Drawing.Size(72, 23);
			this.label10.TabIndex = 29;
			this.label10.Text = "部门描述:";
			// 
			// label9
			// 
			this.label9.Location = new System.Drawing.Point(344, 176);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(96, 23);
			this.label9.TabIndex = 26;
			this.label9.Text = "是否下属教工:";
			// 
			// txtOwnerDeptName
			// 
			this.txtOwnerDeptName.Location = new System.Drawing.Point(328, 24);
			this.txtOwnerDeptName.Name = "txtOwnerDeptName";
			this.txtOwnerDeptName.Size = new System.Drawing.Size(168, 21);
			this.txtOwnerDeptName.TabIndex = 2;
			this.txtOwnerDeptName.Text = "textBox1";
			this.txtOwnerDeptName.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtOwnerDeptName_KeyUp);
			// 
			// btnDeptSel
			// 
			this.btnDeptSel.Font = new System.Drawing.Font("宋体", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnDeptSel.Location = new System.Drawing.Point(496, 24);
			this.btnDeptSel.Name = "btnDeptSel";
			this.btnDeptSel.Size = new System.Drawing.Size(16, 24);
			this.btnDeptSel.TabIndex = 3;
			this.btnDeptSel.Text = "▼";
			this.btnDeptSel.Click += new System.EventHandler(this.btnDeptSel_Click);
			// 
			// txtDeptName
			// 
			this.txtDeptName.Location = new System.Drawing.Point(72, 24);
			this.txtDeptName.MaxLength = 20;
			this.txtDeptName.Name = "txtDeptName";
			this.txtDeptName.Size = new System.Drawing.Size(184, 21);
			this.txtDeptName.TabIndex = 1;
			this.txtDeptName.Text = "textBox1";
			this.txtDeptName.TextChanged += new System.EventHandler(this.txtDeptName_TextChanged);
			// 
			// labId
			// 
			this.labId.Location = new System.Drawing.Point(16, 96);
			this.labId.Name = "labId";
			this.labId.TabIndex = 11;
			this.labId.Visible = false;
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(72, 23);
			this.label1.TabIndex = 0;
			this.label1.Text = "部门名称:";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(264, 24);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(72, 16);
			this.label2.TabIndex = 2;
			this.label2.Text = "上级部门:";
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(0, 176);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(72, 23);
			this.label7.TabIndex = 24;
			this.label7.Text = "部门人数:";
			// 
			// imageListtbr
			// 
			this.imageListtbr.ImageSize = new System.Drawing.Size(32, 32);
			this.imageListtbr.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListtbr.ImageStream")));
			this.imageListtbr.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// tbrDept
			// 
			this.tbrDept.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
																					   this.toolBarButton8,
																					   this.tbrButtonSave,
																					   this.tbrButtonExit});
			this.tbrDept.ButtonSize = new System.Drawing.Size(52, 52);
			this.tbrDept.DropDownArrows = true;
			this.tbrDept.ImageList = this.imageListtbr;
			this.tbrDept.Location = new System.Drawing.Point(0, 0);
			this.tbrDept.Name = "tbrDept";
			this.tbrDept.ShowToolTips = true;
			this.tbrDept.Size = new System.Drawing.Size(536, 58);
			this.tbrDept.TabIndex = 10;

⌨️ 快捷键说明

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