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

📄 cdlgaddws.cs

📁 功能设计:平台管理、收费点维护、收费项目管理、缴费管理
💻 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>
	/// CdlgAddWs 的摘要说明。
	/// </summary>
	public class CdlgAddWs : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.TextBox txtIP;
		private string wsIP;//新增工作站IP
		private int    wsID;//新增工作站ID

		public string IP
		{
			get
			{
				return wsIP;
			}
		}
		public int ID
		{
			get
			{
				return wsID;
			}
		}
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public CdlgAddWs()
		{
			//
			// 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.txtIP = new System.Windows.Forms.TextBox();
			this.btnOK = new System.Windows.Forms.Button();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.txtIP);
			this.groupBox1.Location = new System.Drawing.Point(0, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(288, 64);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "IP地址";
			// 
			// txtIP
			// 
			this.txtIP.Location = new System.Drawing.Point(32, 24);
			this.txtIP.Name = "txtIP";
			this.txtIP.Size = new System.Drawing.Size(208, 21);
			this.txtIP.TabIndex = 0;
			this.txtIP.Text = "";
			// 
			// btnOK
			// 
			this.btnOK.Location = new System.Drawing.Point(104, 80);
			this.btnOK.Name = "btnOK";
			this.btnOK.TabIndex = 1;
			this.btnOK.Text = "确定";
			this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
			// 
			// CdlgAddWs
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(292, 114);
			this.Controls.Add(this.btnOK);
			this.Controls.Add(this.groupBox1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
			this.Name = "CdlgAddWs";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			this.Text = "新增工作站";
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void btnOK_Click(object sender, System.EventArgs e)
		{
			if(txtIP.Text.Trim()!="")
			{
				
				wsIP=txtIP.Text.Trim();
				//添加存储过程输入参数
				OracleParameter[] inParam = {new OracleParameter()};
		
				inParam[0].ParameterName = "p_IPAddr";
				inParam[0].OracleType = OracleType.VarChar;
				inParam[0].Value = txtIP.Text.Trim();
				//添加存储过程输出参数
				OracleParameter[] outParam = {new OracleParameter(),new OracleParameter()};
				outParam[0].ParameterName = "p_Result";
				outParam[0].OracleType = OracleType.Int32;
				outParam[0].Direction = ParameterDirection.Output;

				outParam[1].ParameterName = "p_outWsID";
				outParam[1].OracleType = OracleType.Int32;
				outParam[1].Direction = ParameterDirection.Output;
                //执行存储过程
				int result=GlobleHelper.ExecStoredProc("sp_charge_setws", inParam, ref outParam);
				if(result==0)//存储过程执行成功
				{
					if(Convert.ToInt32(outParam[0].Value)==0)//存储过程正常执行
					{
						wsID=Convert.ToInt32(outParam[1].Value);
					}
					else//存储过程异常
					{
						MessageBox.Show("执行存储过程出现异常!");
						return;
					}
				}
				else//过程执行失败
				{
					MessageBox.Show("执行存储过程失败!");
					return;
				}
				this.DialogResult=DialogResult.OK;
            } 
		}
	}
}

⌨️ 快捷键说明

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