📄 frmplatfclassinfo.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;
using Charge;
namespace PlatF
{
/// <summary>
/// 学校地址详细信息的查看修改界面。
/// </summary>
public class CfrmPlatFClassInfo : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox gbClass;
private System.Windows.Forms.Label labId;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtClassName;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ImageList imageListtbr;
private System.Windows.Forms.ToolBar tbrClass;
private System.Windows.Forms.ToolBarButton toolBarButton8;
private System.Windows.Forms.ToolBarButton tbrButtonSave;
private System.Windows.Forms.ToolBarButton tbrButtonExit;
private System.ComponentModel.IContainer components;
// private string ClassId;
// private string ClassIndex;
private ArrayList tp_arrayClass;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtClassDesc;
private System.Windows.Forms.Button btnDeptSel;
private System.Windows.Forms.TextBox txtDeptName;
public bool modified;
ListView tp_lvClass;
/***************************************************************************************************************
* 功能:初始化班级详细信息修改界面,显示被选择的部门信息,或者为新增信息界面,构造函数有两个参数,第一个参数
* lvClass为ListView由班级查询界面传入,第二个参数AddSign由班级查询界面传入表示本窗体是否为班级信息新增
*
* 输入参数:1、lvClass,从父窗口(frmPlatFClass)中传递过来的listview
* 2、AddSign, 0--此窗体为浏览显示
* 1--此窗体为新增显示
* 输出参数:无
*
* 最后修改时间:04-08-13 by cellz
* ************************************************************************************************************/
public CfrmPlatFClassInfo(ListView lvClass,int AddSign)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
modified = false;
//对父窗体listview的引用
tp_lvClass=lvClass;
//动态数组的内存分配
this.tp_arrayClass = new ArrayList();
//按照PlatF_Org_Addr表在cbbAddrName中显示所有单位地址名称
System.Data.OracleClient.OracleConnection tp_myConn = Connection.DBConnection;
if (tp_myConn == null)
{
return;
}
//对数据库进行查询操作
string tp_mySql = "SELECT DeptID FROM charge_Dept_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();
}
//dtpClassFrom.Value = DateTime.Now;
//dtpClassTo.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设置
txtClassName.ReadOnly = false;
txtDeptName.ReadOnly = true;
//btnDeptSel.Enabled = true;
//txtGrade.ReadOnly = false;
//dtpClassFrom.Enabled = true;
//dtpClassTo.Enabled = true;
txtClassDesc.ReadOnly = false;
//btnAdd.Enabled = false;
//btnSave.Enabled = false;
//btnEdit.Enabled = false;
//btnDel.Enabled = false;
labId.Text = "";
txtClassName.Text = "";
txtDeptName.Text ="";
//txtGrade.Text = "";
txtClassDesc.Text = "";
txtClassName.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(CfrmPlatFClassInfo));
this.gbClass = new System.Windows.Forms.GroupBox();
this.txtDeptName = new System.Windows.Forms.TextBox();
this.btnDeptSel = new System.Windows.Forms.Button();
this.txtClassDesc = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.labId = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txtClassName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.imageListtbr = new System.Windows.Forms.ImageList(this.components);
this.tbrClass = 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.gbClass.SuspendLayout();
this.SuspendLayout();
//
// gbClass
//
this.gbClass.Controls.Add(this.txtDeptName);
this.gbClass.Controls.Add(this.btnDeptSel);
this.gbClass.Controls.Add(this.txtClassDesc);
this.gbClass.Controls.Add(this.label4);
this.gbClass.Controls.Add(this.labId);
this.gbClass.Controls.Add(this.label2);
this.gbClass.Controls.Add(this.txtClassName);
this.gbClass.Controls.Add(this.label1);
this.gbClass.Location = new System.Drawing.Point(8, 64);
this.gbClass.Name = "gbClass";
this.gbClass.Size = new System.Drawing.Size(392, 240);
this.gbClass.TabIndex = 2;
this.gbClass.TabStop = false;
this.gbClass.Text = "班级信息";
//
// txtDeptName
//
this.txtDeptName.Location = new System.Drawing.Point(72, 64);
this.txtDeptName.Name = "txtDeptName";
this.txtDeptName.Size = new System.Drawing.Size(296, 21);
this.txtDeptName.TabIndex = 2;
this.txtDeptName.Text = "textBox1";
this.txtDeptName.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtDeptName_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(368, 64);
this.btnDeptSel.Name = "btnDeptSel";
this.btnDeptSel.Size = new System.Drawing.Size(16, 21);
this.btnDeptSel.TabIndex = 3;
this.btnDeptSel.Text = "▼";
this.btnDeptSel.Click += new System.EventHandler(this.btnDeptSel_Click);
//
// txtClassDesc
//
this.txtClassDesc.Location = new System.Drawing.Point(72, 120);
this.txtClassDesc.MaxLength = 50;
this.txtClassDesc.Multiline = true;
this.txtClassDesc.Name = "txtClassDesc";
this.txtClassDesc.Size = new System.Drawing.Size(312, 64);
this.txtClassDesc.TabIndex = 7;
this.txtClassDesc.Text = "textBox2";
//
// label4
//
this.label4.Location = new System.Drawing.Point(8, 160);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(72, 23);
this.label4.TabIndex = 17;
this.label4.Text = "班级描述:";
//
// labId
//
this.labId.Location = new System.Drawing.Point(32, 112);
this.labId.Name = "labId";
this.labId.TabIndex = 11;
this.labId.Visible = false;
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 64);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 23);
this.label2.TabIndex = 2;
this.label2.Text = "所属部门:";
//
// txtClassName
//
this.txtClassName.Location = new System.Drawing.Point(72, 32);
this.txtClassName.MaxLength = 10;
this.txtClassName.Name = "txtClassName";
this.txtClassName.Size = new System.Drawing.Size(312, 21);
this.txtClassName.TabIndex = 1;
this.txtClassName.Text = "textBox1";
this.txtClassName.TextChanged += new System.EventHandler(this.txtClassName_TextChanged);
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 23);
this.label1.TabIndex = 0;
this.label1.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;
//
// tbrClass
//
this.tbrClass.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
this.toolBarButton8,
this.tbrButtonSave,
this.tbrButtonExit});
this.tbrClass.ButtonSize = new System.Drawing.Size(52, 52);
this.tbrClass.DropDownArrows = true;
this.tbrClass.ImageList = this.imageListtbr;
this.tbrClass.Location = new System.Drawing.Point(0, 0);
this.tbrClass.Name = "tbrClass";
this.tbrClass.ShowToolTips = true;
this.tbrClass.Size = new System.Drawing.Size(410, 58);
this.tbrClass.TabIndex = 7;
this.tbrClass.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.tbrClass_ButtonClick);
//
// toolBarButton8
//
this.toolBarButton8.Enabled = false;
this.toolBarButton8.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// tbrButtonSave
//
this.tbrButtonSave.ImageIndex = 1;
this.tbrButtonSave.Text = "保存";
this.tbrButtonSave.ToolTipText = "保存";
//
// tbrButtonExit
//
this.tbrButtonExit.ImageIndex = 6;
this.tbrButtonExit.Text = "退出";
this.tbrButtonExit.ToolTipText = "退出";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -