📄 frmplatfmajorinfo.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OracleClient;
using GlobleUtility;
namespace PlatF
{
/// <summary>
/// 学校地址详细信息的查看修改界面。
/// </summary>
public class CfrmPlatFMajorInfo : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox gbMajor;
private System.Windows.Forms.Label labId;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtMajorName;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ImageList imageListtbr;
private System.Windows.Forms.ToolBar tbrMajor;
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 label10;
private System.Windows.Forms.TextBox txtMajorDesc;
private System.Windows.Forms.ComboBox cbbDeptName;
private ArrayList tp_arrayDept;
ListView tp_lvMajor;
/***************************************************************************************************************
* 功能:初始化专业详细信息修改界面,显示被选择的专业信息,或者为新增信息界面,构造函数有两个参数,第一个参数
* lvMajor为ListView由专业查询界面传入,第二个参数AddSign由专业查询界面传入表示本窗体是否为专业信息新增
*
* 输入参数:1、lvMajor,从父窗口(frmPlatFMajor)中传递过来的listview
* 2、AddSign, 0--此窗体为浏览显示
* 1--此窗体为新增显示
* 输出参数:无
*
* 最后修改时间:04-08-14 by cellz
* ************************************************************************************************************/
public CfrmPlatFMajorInfo(ListView lvMajor,int AddSign)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//初始化pnlMajor专业显示控件
//对父窗体listview的引用
tp_lvMajor=lvMajor;
//动态数组的内存分配
this.tp_arrayDept = new ArrayList();
//按照PlatF_Org_Major表在cbbMajorName中显示所有单位地址名称
System.Data.OracleClient.OracleConnection tp_myConn = Connection.DBConnection;
if (tp_myConn == null)
{
return;
}
//对数据库进行查询操作
//string tp_mySql = "SELECT A.DeptID,A.DeptName FROM PlatF_Dept_Info A,PlatF_R_DEPT B WHERE B.FROMDEPTID=0 AND A.DeptID = B.TODEPTID AND A.ISSTUDENT=1 ORDER BY DeptName";
string tp_mySql = "SELECT A.DeptID,A.DeptName FROM charge_Dept_Info A where A.tostu=1 ORDER BY DeptName";
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();
}
//在comboBox中显示所有单位地址名称
while (cbbDataReader.Read ())
{
tp_arrayDept.Add(cbbDataReader.GetValue(0).ToString().Trim());
cbbDeptName.Items.Add(cbbDataReader.GetValue(1).ToString().Trim());
}
//cbbDeptName.SelectedIndex = 0;
cbbDeptName.DropDownStyle = ComboBoxStyle.DropDownList;
//初始化DateTimer,comboBox
//dtpMajorFrom.Value = DateTime.Now;
//dtpMajorTo.Value = Convert.ToDateTime("3004-12-31 23:59:59");
//新增信息操作窗体
if (AddSign ==1)
{
//toolbar设置
//tbrButtonAdd.Enabled = false;
tbrButtonSave.Enabled = false;
//tbrButtonEdit.Enabled = false;
//tbrButtonDel.Enabled = false;
//groupbox设置
txtMajorName.ReadOnly = false;
//dtpMajorFrom.Enabled = true;
//dtpMajorTo.Enabled = true;
txtMajorDesc.ReadOnly = false;
cbbDeptName.Enabled = true;
//btnAdd.Enabled = false;
//btnSave.Enabled = false;
//btnEdit.Enabled = false;
//btnDel.Enabled = false;
labId.Text = "";
//初始化专业信息
txtMajorName.Text = "";
txtMajorDesc.Text = "";
cbbDeptName.Text = "";
txtMajorName.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(CfrmPlatFMajorInfo));
this.gbMajor = new System.Windows.Forms.GroupBox();
this.txtMajorDesc = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.cbbDeptName = new System.Windows.Forms.ComboBox();
this.txtMajorName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.labId = new System.Windows.Forms.Label();
this.imageListtbr = new System.Windows.Forms.ImageList(this.components);
this.tbrMajor = 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.gbMajor.SuspendLayout();
this.SuspendLayout();
//
// gbMajor
//
this.gbMajor.Controls.Add(this.txtMajorDesc);
this.gbMajor.Controls.Add(this.label10);
this.gbMajor.Controls.Add(this.cbbDeptName);
this.gbMajor.Controls.Add(this.txtMajorName);
this.gbMajor.Controls.Add(this.label1);
this.gbMajor.Controls.Add(this.label2);
this.gbMajor.Controls.Add(this.labId);
this.gbMajor.Location = new System.Drawing.Point(8, 64);
this.gbMajor.Name = "gbMajor";
this.gbMajor.Size = new System.Drawing.Size(520, 176);
this.gbMajor.TabIndex = 2;
this.gbMajor.TabStop = false;
this.gbMajor.Text = "专业信息";
//
// txtMajorDesc
//
this.txtMajorDesc.Location = new System.Drawing.Point(72, 56);
this.txtMajorDesc.MaxLength = 100;
this.txtMajorDesc.Multiline = true;
this.txtMajorDesc.Name = "txtMajorDesc";
this.txtMajorDesc.Size = new System.Drawing.Size(440, 104);
this.txtMajorDesc.TabIndex = 5;
this.txtMajorDesc.Text = "textBox2";
//
// label10
//
this.label10.Location = new System.Drawing.Point(8, 80);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(72, 23);
this.label10.TabIndex = 29;
this.label10.Text = "专业描述:";
//
// cbbDeptName
//
this.cbbDeptName.Location = new System.Drawing.Point(328, 16);
this.cbbDeptName.Name = "cbbDeptName";
this.cbbDeptName.Size = new System.Drawing.Size(184, 20);
this.cbbDeptName.TabIndex = 2;
this.cbbDeptName.Text = "comboBox1";
//
// txtMajorName
//
this.txtMajorName.Location = new System.Drawing.Point(72, 16);
this.txtMajorName.MaxLength = 25;
this.txtMajorName.Name = "txtMajorName";
this.txtMajorName.Size = new System.Drawing.Size(184, 21);
this.txtMajorName.TabIndex = 1;
this.txtMajorName.Text = "textBox1";
this.txtMajorName.TextChanged += new System.EventHandler(this.txtMajorName_TextChanged);
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 16);
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, 16);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 23);
this.label2.TabIndex = 2;
this.label2.Text = "所属院系:";
//
// labId
//
this.labId.Location = new System.Drawing.Point(8, 40);
this.labId.Name = "labId";
this.labId.TabIndex = 11;
this.labId.Visible = false;
//
// 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;
//
// tbrMajor
//
this.tbrMajor.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
this.toolBarButton8,
this.tbrButtonSave,
this.tbrButtonExit});
this.tbrMajor.ButtonSize = new System.Drawing.Size(52, 52);
this.tbrMajor.DropDownArrows = true;
this.tbrMajor.ImageList = this.imageListtbr;
this.tbrMajor.Location = new System.Drawing.Point(0, 0);
this.tbrMajor.Name = "tbrMajor";
this.tbrMajor.ShowToolTips = true;
this.tbrMajor.Size = new System.Drawing.Size(536, 58);
this.tbrMajor.TabIndex = 6;
this.tbrMajor.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.tbrMajor_ButtonClick);
//
// toolBarButton8
//
this.toolBarButton8.Enabled = false;
this.toolBarButton8.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -