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

📄 frmplatfstudentinfo.cs

📁 本书主要介绍了从基础开始建立Portal的快速应用开发过程(RAD)的方法。通过本书你可以了解到关于Oracle 9iAS Portal产品的主要特性、入口的开发和组织、网络开发和管理、实际的关系型数
💻 CS
📖 第 1 页 / 共 3 页
字号:
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 System.IO;
using Charge;


namespace PlatF
{
	/// <summary>
	/// 学校地址详细信息的查看修改界面。
	/// </summary>
	public class CfrmPlatFStudentInfo : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label labId;
		private System.Windows.Forms.TextBox txtStudentName;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.ImageList imageListtbr;
		private System.Windows.Forms.ToolBar tbrStudent;
		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.Button btnDeptSel;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		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.GroupBox gbStudent1;
		private System.Windows.Forms.ComboBox cbbSex;
		private System.Windows.Forms.GroupBox gbStudent2;
		private System.Windows.Forms.TextBox txtUserNumber;
		private System.Windows.Forms.TextBox txtClassName;
		private System.Windows.Forms.ComboBox cbbUserType;
		private System.Windows.Forms.ComboBox cbbMajor;
		private System.Windows.Forms.DateTimePicker dtpEnroDate;
		private System.Windows.Forms.GroupBox gbStudent;

		ListView tp_lvStudent;
		private int tp_TableSign;
		private ArrayList tp_arrayMajor;		
		private ArrayList tp_arrayUserType;
		public  bool bModified;
		

		/***************************************************************************************************************
		 * 功能:初始化学生详细信息修改界面,显示被选择的部门信息,或者为新增信息界面,构造函数有两个参数,第一个参数
		 * lvStudent为ListView由学生查询界面传入,第二个参数AddSign由学生查询界面传入表示本窗体是否为学生信息新增
		 * 
		 * 输入参数:1、lvStudent,从父窗口(frmPlatFStudent)中传递过来的listview
		 *           2、AddSign,  0--此窗体为浏览显示
		 *                        1--此窗体为新增显示
		 *           3、TableSign,0--临时表
		 *                        1--正式表
		 *                      
		 * 输出参数:无
		 * 
		 * 最后修改时间:04-08-13   by cellz
		 * ************************************************************************************************************/	
		public CfrmPlatFStudentInfo(ListView lvStudent,int AddSign,int TableSign)
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//对父窗体listview的引用
			tp_lvStudent=lvStudent;
			//*TableSign,0--临时表
		    //*          1--正式表
			tp_TableSign=TableSign;

			//动态数组的内存分配
			this.tp_arrayMajor = new ArrayList();
			this.tp_arrayUserType = new ArrayList();
			


			//bPicModified = false;
			bModified = false;
			//defaultPic = false;
			System.Data.OracleClient.OracleConnection tp_myConn = Connection.DBConnection;
			if (tp_myConn == null)
			{
				return;	
			}
            
			//对数据库进行查询操作
			string tp_mySql = "SELECT ClassID FROM charge_Class_Info";
			OracleCommand tp_selCommand = new OracleCommand(tp_mySql,tp_myConn);
			
			OracleDataReader cbbDataReader = null;
			try
			{
				cbbDataReader = tp_selCommand.ExecuteReader();
			}
			catch(Exception ee)
			{
				MessageBox.Show("数据库查询出错,消息如下:\r\n"+ee.Message,"消息:",MessageBoxButtons.OK,MessageBoxIcon.Warning);
				return;
			}
			//如果没有查询到任何部门,则退出本窗体
			if (!cbbDataReader.HasRows)
			{
				MessageBox.Show("不存在任何班级,无法新建学生信息!");
				this.Close();
			}
			cbbSex.Items.Add("男");
			cbbSex.Items.Add("女");
			cbbSex.SelectedIndex = 0;
			cbbSex.DropDownStyle = ComboBoxStyle.DropDownList;

			string type_mySql = "SELECT ClassID,ClassName FROM charge_UserClass WHERE  ClassID in (1,2,3,4)";
			OracleCommand type_selCommand = new OracleCommand(type_mySql,tp_myConn);			
			cbbDataReader = null;
			try
			{
				cbbDataReader = type_selCommand.ExecuteReader();
			}
			catch(Exception ee)
			{
				MessageBox.Show("数据库查询出错,消息如下:\r\n"+ee.Message,"消息:",MessageBoxButtons.OK,MessageBoxIcon.Warning);
				return;
			}		
			
			while (cbbDataReader.Read ())
			{
				tp_arrayUserType.Add(cbbDataReader.GetValue(0).ToString().Trim());
				cbbUserType.Items.Add(cbbDataReader.GetValue(1).ToString().Trim());

			}
				
			cbbUserType.SelectedIndex = 2;
			cbbUserType.DropDownStyle = ComboBoxStyle.DropDownList;
			//导入专业
			string major_mysql="select majorid,majorname from charge_Major_Info";
			OracleCommand major_selCommand = new OracleCommand(major_mysql,tp_myConn);
			OracleDataReader cbbmajorReader = null;
			try
			{
				cbbmajorReader = major_selCommand.ExecuteReader();
			}
			catch(Exception ee)
			{
				MessageBox.Show("数据库查询出错,消息如下:\r\n"+ee.Message,"消息:",MessageBoxButtons.OK,MessageBoxIcon.Warning);
				return;
			}
			while (cbbmajorReader.Read ())
			{
				tp_arrayMajor.Add(cbbmajorReader.GetValue(0).ToString().Trim());
				cbbMajor.Items.Add(cbbmajorReader.GetValue(1).ToString().Trim());

			}
		



			cbbMajor.DropDownStyle = ComboBoxStyle.DropDownList;
			
			if (tp_TableSign==1)
			{
				//tbrButtonUsed.Visible =false;
				//tbrButtonAdd.Visible =false;
			}
		 //*AddSign,  0--此窗体为浏览显示
		 //*          1--此窗体为新增显示
			//新增信息操作窗体
			if (AddSign ==1)
			{
				//toolbar设置
				//tbrButtonAdd.Enabled = false;
				tbrButtonSave.Enabled = false;
		
				//groupbox设置
				txtStudentName.ReadOnly = false;
				txtUserNumber.ReadOnly = false;
				cbbSex.Enabled = true;

				cbbUserType.Enabled =true;				
				txtClassName.ReadOnly = true;
				btnDeptSel.Enabled = true;
				//dtpEnroDate.Enabled = true;
				cbbMajor.Enabled = true;
			
				//内容初始化
				labId.Text = "";
				txtStudentName.Text = "";
				txtUserNumber.Text ="";

				txtClassName.Text ="";
				//dtpEnroDate.Value =Convert.ToDateTime("2004-09-01 12:00:00");
				cbbMajor.Text ="";
			

				txtStudentName.Focus();
				return;
			}

		
			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}
		public CfrmPlatFStudentInfo()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

		

			//动态数组的内存分配
			this.tp_arrayMajor = new ArrayList();
			this.tp_arrayUserType = new ArrayList();

		
			System.Data.OracleClient.OracleConnection tp_myConn = Connection.DBConnection;
			if (tp_myConn == null)
			{
				return;	
			}
            
			//对数据库进行查询操作
			string tp_mySql = "SELECT ClassID FROM PlatF_Class_Info";
			OracleCommand tp_selCommand = new OracleCommand(tp_mySql,tp_myConn);
			
			OracleDataReader cbbDataReader = null;
			try
			{
				cbbDataReader = tp_selCommand.ExecuteReader();
			}
			catch(Exception ee)
			{
				MessageBox.Show("数据库查询出错,消息如下:\r\n"+ee.Message,"消息:",MessageBoxButtons.OK,MessageBoxIcon.Warning);
				return;
			}
			//如果没有查询到任何部门,则退出本窗体
			if (!cbbDataReader.HasRows)
			{
				MessageBox.Show("不存在任何班级,无法新建学生信息!");
				this.Close();
				return;
			}
			cbbSex.Items.Add("男");
			cbbSex.Items.Add("女");
			cbbSex.SelectedIndex = 0;
			cbbSex.DropDownStyle = ComboBoxStyle.DropDownList;

			string type_mySql = "SELECT ClassID,ClassName FROM PlatF_UserClass WHERE IsUsed =1 AND ClassID in (0,1,2,3,4,7)";
			OracleCommand type_selCommand = new OracleCommand(type_mySql,tp_myConn);			
			cbbDataReader = null;
			try
			{
				cbbDataReader = type_selCommand.ExecuteReader();
			}
			catch(Exception ee)
			{
				MessageBox.Show("数据库查询出错,消息如下:\r\n"+ee.Message,"消息:",MessageBoxButtons.OK,MessageBoxIcon.Warning);
				return;
			}
			while (cbbDataReader.Read ())
			{
				tp_arrayUserType.Add(cbbDataReader.GetValue(0).ToString().Trim());
				cbbUserType.Items.Add(cbbDataReader.GetValue(1).ToString().Trim());
			}
				
			cbbUserType.SelectedIndex = 2;
			cbbUserType.DropDownStyle = ComboBoxStyle.DropDownList;

			cbbMajor.DropDownStyle = ComboBoxStyle.DropDownList;

			//新增信息操作窗体
		
			
			tbrButtonSave.Enabled = false;
			

			//groupbox设置
			txtStudentName.ReadOnly = false;
			txtUserNumber.ReadOnly = false;
			cbbSex.Enabled = true;

			cbbUserType.Enabled =true;				
			txtClassName.ReadOnly = true;
			btnDeptSel.Enabled = true;
			dtpEnroDate.Enabled = true;
			cbbMajor.Enabled = true;
			
			//内容初始化
			labId.Text = "";
			txtStudentName.Text = "";
			txtUserNumber.Text ="";

			txtClassName.Text ="";
			dtpEnroDate.Value =Convert.ToDateTime("2004-09-01 12:00:00");
			cbbMajor.Text ="";
				

			
			//bPicModified = false;
			//defaultPic = true;
			txtStudentName.Focus();	
			
			
			
			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码

⌨️ 快捷键说明

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