📄 cdlgiteminfoview.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 Charge
{
/// <summary>
/// CdlgItemInfoView 的摘要说明。
/// </summary>
public class CdlgItemInfoView : System.Windows.Forms.Form
{
private ErrorCode E = new ErrorCode();
private ArrayList itemList=new ArrayList();
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lab2;
private System.Windows.Forms.Label labObject;
private System.Windows.Forms.ComboBox cbbItem;
private System.Windows.Forms.Button btnView;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label labStat;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label labDept;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label labItemID;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public CdlgItemInfoView()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// 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.cbbItem = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.btnView = new System.Windows.Forms.Button();
this.lab2 = new System.Windows.Forms.Label();
this.labObject = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.labStat = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.labDept = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.labItemID = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// cbbItem
//
this.cbbItem.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbbItem.Location = new System.Drawing.Point(184, 34);
this.cbbItem.Name = "cbbItem";
this.cbbItem.Size = new System.Drawing.Size(112, 20);
this.cbbItem.TabIndex = 0;
//
// label1
//
this.label1.Location = new System.Drawing.Point(48, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(104, 24);
this.label1.TabIndex = 1;
this.label1.Text = "收费项目:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnView
//
this.btnView.Location = new System.Drawing.Point(344, 32);
this.btnView.Name = "btnView";
this.btnView.Size = new System.Drawing.Size(64, 24);
this.btnView.TabIndex = 2;
this.btnView.Text = "查看(&V)";
this.btnView.Click += new System.EventHandler(this.btnView_Click);
//
// lab2
//
this.lab2.Location = new System.Drawing.Point(88, 424);
this.lab2.Name = "lab2";
this.lab2.Size = new System.Drawing.Size(104, 24);
this.lab2.TabIndex = 3;
this.lab2.Text = "收费对象:";
this.lab2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lab2.Visible = false;
//
// labObject
//
this.labObject.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.labObject.Location = new System.Drawing.Point(288, 440);
this.labObject.Name = "labObject";
this.labObject.Size = new System.Drawing.Size(72, 20);
this.labObject.TabIndex = 6;
this.labObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labObject.Visible = false;
//
// label2
//
this.label2.Location = new System.Drawing.Point(48, 200);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(104, 24);
this.label2.TabIndex = 9;
this.label2.Text = "项目状态:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// labStat
//
this.labStat.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.labStat.Location = new System.Drawing.Point(184, 192);
this.labStat.Name = "labStat";
this.labStat.Size = new System.Drawing.Size(112, 32);
this.labStat.TabIndex = 10;
this.labStat.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label5
//
this.label5.Location = new System.Drawing.Point(48, 134);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(104, 24);
this.label5.TabIndex = 11;
this.label5.Text = "收费部门:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// labDept
//
this.labDept.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.labDept.Location = new System.Drawing.Point(184, 136);
this.labDept.Name = "labDept";
this.labDept.Size = new System.Drawing.Size(112, 24);
this.labDept.TabIndex = 12;
this.labDept.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label6
//
this.label6.Location = new System.Drawing.Point(48, 80);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(104, 24);
this.label6.TabIndex = 13;
this.label6.Text = "项目编号:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// labItemID
//
this.labItemID.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.labItemID.Location = new System.Drawing.Point(184, 80);
this.labItemID.Name = "labItemID";
this.labItemID.Size = new System.Drawing.Size(112, 24);
this.labItemID.TabIndex = 14;
this.labItemID.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// CdlgItemInfoView
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.Desktop;
this.ClientSize = new System.Drawing.Size(434, 378);
this.Controls.Add(this.labItemID);
this.Controls.Add(this.label6);
this.Controls.Add(this.labDept);
this.Controls.Add(this.label5);
this.Controls.Add(this.labStat);
this.Controls.Add(this.label2);
this.Controls.Add(this.labObject);
this.Controls.Add(this.lab2);
this.Controls.Add(this.btnView);
this.Controls.Add(this.label1);
this.Controls.Add(this.cbbItem);
this.ForeColor = System.Drawing.SystemColors.Window;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "CdlgItemInfoView";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "收费项目属性查看";
this.Load += new System.EventHandler(this.CdlgItemInfoView_Load);
this.ResumeLayout(false);
}
#endregion
private void CdlgItemInfoView_Load(object sender, System.EventArgs e)
{
OracleConnection myConn = Connection.DBConnection;
if (myConn == null)
{
return;
}
//
// 获取项目名称
//
string mySql1 = "select ItemID,ItemName from Charge_Items ";
OracleCommand dbCommand1 = new OracleCommand(mySql1, myConn);
try
{
OracleDataReader myReader1 = dbCommand1.ExecuteReader();
while (myReader1.Read())
{
itemList.Add(myReader1.GetInt32(0));
itemList.Add(myReader1.GetString(1));
}
myReader1.Close();
}
catch
{
E.ShowMessage(ErrorCode.E_8_DBUnknownError_Code);
return;
}
if(itemList.Count==0)
{
return;
}
for (int i = 1; i < itemList.Count; i += 2)
{
cbbItem.Items.Add(itemList[i]);
}
cbbItem.SelectedIndex = 0;
myConn.Close();
}
private void btnView_Click(object sender, System.EventArgs e)
{
//string ItemName=""; //项目名称
string DeptName=""; //部门名称
//int tostudent=0; //是否面向学生变量
//int toteacher=0; //是否面向教工变量
int forcible=0; //是否为强制性收费变量
int repeated=0; //是否为一次性收费变量
int state=0; //项目当前状态
int ItemID=0; //项目号
OracleConnection myConn1 = Connection.DBConnection;
if (myConn1 == null)
{
return;
}
string mySql2="select t1.Useable,t2.DeptName,t1.ItemID"+
" from Charge_Items t1,charge_Dept_Info t2 "+
" where t1.ItemName='"+cbbItem.Text.Trim()+"'"+
" and t1.DeptID=t2.DeptID";
OracleCommand dbCommand2 = new OracleCommand(mySql2, myConn1);
try
{
OracleDataReader myReader2 = dbCommand2.ExecuteReader();
while (myReader2.Read())
{
//tostudent=myReader2.GetInt32(0);
//toteacher=myReader2.GetInt32(1);
//forcible=myReader2.GetInt32(0);
//repeated=myReader2.GetInt32(1);
state=myReader2.GetInt32(0);
DeptName=myReader2.GetString(1);
ItemID=myReader2.GetInt32(2);
}
myReader2.Close();
myConn1.Close();
}
catch
{
E.ShowMessage(ErrorCode.E_8_DBUnknownError_Code);
return;
}
if(state==0)
{
labStat.Text="未开通";
}
else if(state==1)
{
labStat.Text="在用";
}
else
{
labStat.Text="停用";
}
labDept.Text=DeptName;
labItemID.Text=ItemID.ToString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -