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

📄 formtest.cs

📁 GPRS数据采集驱动源码
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Data;

using CommCLB.Comm;
using CommCLB.asswctrl_ws;

namespace GPRSDrvWinApp
{
	public class FormTest : GPRSDrvWinApp.FormParent
	{
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.TextBox tb1;
		private System.Windows.Forms.TreeView tv1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button button3;
		private System.Windows.Forms.Button button4;
		private System.ComponentModel.IContainer components = null;

		public FormTest()
		{
			// 该调用是 Windows 窗体设计器所必需的。
			InitializeComponent();

			// TODO: 在 InitializeComponent 调用后添加任何初始化
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region 设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormTest));
			this.tv1 = new System.Windows.Forms.TreeView();
			this.tb1 = new System.Windows.Forms.TextBox();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.button3 = new System.Windows.Forms.Button();
			this.button4 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// imgLstMain
			// 
			this.imgLstMain.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgLstMain.ImageStream")));
			// 
			// tv1
			// 
			this.tv1.ImageIndex = -1;
			this.tv1.Location = new System.Drawing.Point(8, 8);
			this.tv1.Name = "tv1";
			this.tv1.SelectedImageIndex = -1;
			this.tv1.Size = new System.Drawing.Size(200, 368);
			this.tv1.TabIndex = 0;
			// 
			// tb1
			// 
			this.tb1.Location = new System.Drawing.Point(288, 104);
			this.tb1.Name = "tb1";
			this.tb1.TabIndex = 1;
			this.tb1.Text = "";
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(296, 200);
			this.button1.Name = "button1";
			this.button1.TabIndex = 2;
			this.button1.Text = "button1";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(296, 240);
			this.button2.Name = "button2";
			this.button2.TabIndex = 3;
			this.button2.Text = "button2";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// button3
			// 
			this.button3.Location = new System.Drawing.Point(400, 200);
			this.button3.Name = "button3";
			this.button3.TabIndex = 4;
			this.button3.Text = "button3";
			this.button3.Click += new System.EventHandler(this.button3_Click);
			// 
			// button4
			// 
			this.button4.Location = new System.Drawing.Point(408, 240);
			this.button4.Name = "button4";
			this.button4.TabIndex = 5;
			this.button4.Text = "button4";
			this.button4.Click += new System.EventHandler(this.button4_Click);
			// 
			// FormTest
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(530, 389);
			this.Controls.Add(this.button4);
			this.Controls.Add(this.button3);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.tb1);
			this.Controls.Add(this.tv1);
			this.Name = "FormTest";
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		///调用取得驱动服务层数据的例子
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void button1_Click(object sender, System.EventArgs e)
		{
			
			showData2(Class_Comm.GetServiceAsswCtrl().getDrvSvcByID(tb1.Text));
		
		}

		/// <summary>
		/// 调用后的类型转换例子
		/// </summary>
		/// <param name="ob"></param>
		private void showData2(strDrvSvc ob)

		{
			//strDrvSvc[] al = ob;
			if(ob.fd_valid==true)
			{
				tv1.Nodes.Add(ob.fd_id);
			}

		}

		/// <summary>
		/// 调用取得不同时段超标上下限结果集例子
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void button2_Click(object sender, System.EventArgs e)
		{
			//showData3(Class_Comm.GetServiceAsswCtrl().gettgtalmprd());		 
		}

		private void showData3(DataSet ds)
		{
			DataTable dt = ds.Tables["t_table"];
			foreach(DataRow dr in dt.Rows)
			{
				tv1.Nodes.Add(dr["fd_sid"].ToString());
			}
		}

		/// <summary>
		/// 调用监测点监测所有指标的例子
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void button3_Click(object sender, System.EventArgs e)
		{
			string sqlcmd;
			sqlcmd = "insert into tb_nwadmarea (fd_seq,fd_id,fd_name,fd_num) values(1893,'oo','ffd',5)";
			Class_Comm.GetServiceAsswCtrl().insertData(sqlcmd);
		
		}

		private void showData4(strRtuTargt[] str)
		{

			
			for(int i = 0;i<str.Length;i++)
			{
				tv1.Nodes.Add(str[i].fd_fldname);
			}

		}

		private void button4_Click(object sender, System.EventArgs e)
		{
			strRtuTargt[] strRtuTarget=null;
			strRtuTarget=Class_Comm.GetServiceAsswCtrl().getMntSptAll("2010");
			if(strRtuTarget!=null)
			{
				MessageBox.Show(strRtuTarget.Length.ToString());
			}
			else
				MessageBox.Show("null");
		}
	}
}

⌨️ 快捷键说明

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