📄 cdlgsiteinfo.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 CdlgSiteInfoForCharge : System.Windows.Forms.Form
{
private int nSiteID = -1; //当前在修改的交费点ID,若为-1,则为添加
private CdlgWsInfoForCharge dlgWsInfo = new CdlgWsInfoForCharge();
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ListBox lbWs;//工作站列表框
private System.Windows.Forms.Button btnAdd;//“添加”按钮
private System.Windows.Forms.Button btnDel;//“删除”按钮
private System.Windows.Forms.Button btnOK;//“确定”按钮
private System.Windows.Forms.Button btnCancel;//“取消”按钮
private System.Windows.Forms.TextBox txtDesc;//“收费点描述”文本框
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox txtSiteID;//”收费点编号“文本框,用户不可更改
private System.Windows.Forms.TextBox txtName;//”收费点名称“文本框
private System.Windows.Forms.TextBox txtMaxMoney;//”最大收费金额“文本框
private System.Windows.Forms.CheckBox ckForbid;//”禁用“CheckBox控件
public int SiteID //改变当前交费点ID的可访问性
{
get
{
return nSiteID;
}
}
ErrorCode E = new ErrorCode();
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public CdlgSiteInfoForCharge()
{
//
// 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.groupBox1 = new System.Windows.Forms.GroupBox();
this.ckForbid = new System.Windows.Forms.CheckBox();
this.label7 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnDel = new System.Windows.Forms.Button();
this.btnAdd = new System.Windows.Forms.Button();
this.lbWs = new System.Windows.Forms.ListBox();
this.txtDesc = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.txtMaxMoney = new System.Windows.Forms.TextBox();
this.txtName = new System.Windows.Forms.TextBox();
this.txtSiteID = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.ckForbid);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Controls.Add(this.txtDesc);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.txtMaxMoney);
this.groupBox1.Controls.Add(this.txtName);
this.groupBox1.Controls.Add(this.txtSiteID);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(544, 272);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "收费点详细信息";
//
// ckForbid
//
this.ckForbid.Location = new System.Drawing.Point(296, 200);
this.ckForbid.Name = "ckForbid";
this.ckForbid.Size = new System.Drawing.Size(80, 21);
this.ckForbid.TabIndex = 14;
this.ckForbid.Text = "禁用";
this.ckForbid.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label7
//
this.label7.Location = new System.Drawing.Point(264, 136);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(16, 21);
this.label7.TabIndex = 13;
this.label7.Text = "元";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.btnDel);
this.groupBox2.Controls.Add(this.btnAdd);
this.groupBox2.Controls.Add(this.lbWs);
this.groupBox2.Location = new System.Drawing.Point(296, 32);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(192, 144);
this.groupBox2.TabIndex = 12;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "下属工作站";
//
// btnDel
//
this.btnDel.Location = new System.Drawing.Point(104, 104);
this.btnDel.Name = "btnDel";
this.btnDel.Size = new System.Drawing.Size(64, 32);
this.btnDel.TabIndex = 2;
this.btnDel.Text = "删除(&D)";
this.btnDel.Click += new System.EventHandler(this.btnDel_Click);
//
// btnAdd
//
this.btnAdd.Location = new System.Drawing.Point(16, 104);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(64, 32);
this.btnAdd.TabIndex = 1;
this.btnAdd.Text = "添加(&A)";
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// lbWs
//
this.lbWs.ItemHeight = 12;
this.lbWs.Location = new System.Drawing.Point(16, 24);
this.lbWs.Name = "lbWs";
this.lbWs.Size = new System.Drawing.Size(160, 64);
this.lbWs.TabIndex = 0;
//
// txtDesc
//
this.txtDesc.Location = new System.Drawing.Point(128, 184);
this.txtDesc.Multiline = true;
this.txtDesc.Name = "txtDesc";
this.txtDesc.Size = new System.Drawing.Size(128, 64);
this.txtDesc.TabIndex = 11;
this.txtDesc.Text = "";
//
// label6
//
this.label6.Location = new System.Drawing.Point(32, 208);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(48, 24);
this.label6.TabIndex = 10;
this.label6.Text = "描述:";
//
// txtMaxMoney
//
this.txtMaxMoney.Location = new System.Drawing.Point(128, 136);
this.txtMaxMoney.Name = "txtMaxMoney";
this.txtMaxMoney.Size = new System.Drawing.Size(120, 21);
this.txtMaxMoney.TabIndex = 9;
this.txtMaxMoney.Text = "10000";
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(128, 89);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(120, 21);
this.txtName.TabIndex = 6;
this.txtName.Text = "";
//
// txtSiteID
//
this.txtSiteID.Enabled = false;
this.txtSiteID.Location = new System.Drawing.Point(128, 34);
this.txtSiteID.Name = "txtSiteID";
this.txtSiteID.Size = new System.Drawing.Size(120, 21);
this.txtSiteID.TabIndex = 5;
this.txtSiteID.Text = "";
//
// label5
//
this.label5.Location = new System.Drawing.Point(32, 144);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(80, 24);
this.label5.TabIndex = 4;
this.label5.Text = "最大收费额:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label2
//
this.label2.Location = new System.Drawing.Point(32, 87);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(80, 24);
this.label2.TabIndex = 1;
this.label2.Text = "收费点名称:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label1
//
this.label1.Location = new System.Drawing.Point(32, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 24);
this.label1.TabIndex = 0;
this.label1.Text = "收费点编号:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(552, 48);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(72, 32);
this.btnOK.TabIndex = 1;
this.btnOK.Text = "确定";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(552, 152);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(72, 32);
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// CdlgSiteInfoForCharge
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(626, 274);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "CdlgSiteInfoForCharge";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "添加与修改收费点";
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 根据交费点编号刷新界面信息
/// </summary>
/// <param name="SiteID">交费点编号</param>
/// <returns>0:成功;1:失败</returns>
internal int RefreshSiteInfo(int SiteID)
{
nSiteID = SiteID;
if (SiteID == -1) //添加
{
txtSiteID.Text = "系统设定";
}
else //修改
{
OracleConnection myConn = Connection.DBConnection;
if (myConn == null)
{
E.ShowMessage(ErrorCode.E_3_ConnectDBFailed_Code);
return 1;
}
//交费点基本信息
string mySql = "Select SiteName,descrip,MaxMoney,State From Charge_Site_Info " +
"Where SiteID = " + SiteID.ToString();
OracleCommand dbCommand = new OracleCommand(mySql, myConn);
try
{
OracleDataReader dbReader = dbCommand.ExecuteReader();
if (dbReader.Read())
{
txtSiteID.Text = SiteID.ToString();//收费点ID号
txtName.Text = dbReader.GetString(0);//收费点名称
txtDesc.Text = dbReader.GetValue(1).ToString();//收费点描述
//最大收费金额
int money=0;
money=dbReader.GetInt32(2);
txtMaxMoney.Text=(((double)money) / 100).ToString();
//收费点状态
int state=dbReader.GetInt32(3);
if(state==1)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -