日期:2014-05-18 浏览次数:20972 次
//有些东西LZ根据你自己的情况修改下就可以了 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Security.Cryptography; using System.Web; namespace 电信查询 { public partial class Form1 : Form { //WebService引用 private objTele.Service1SoapClient objtele = new 电信查询.objTele.Service1SoapClient(); //当前查询号码 private string nowtnum = ""; //当前查询ID private string nowtid = ""; //当前用户余额 private string nowtmoney = ""; //当前用户名称 private string nowtname = ""; //上一个用户名 private string oldtname = ""; //上一个查询号码 private string oldtnum = ""; //上一个查询ID private string oldtid = ""; //上一用户余额 private string oldtmoney = ""; //刷新页面次数 private int islock = 0; public Form1() { InitializeComponent(); } private void tspstart_Click(object sender, EventArgs e) { if (cbbtime.Text != "") { if (tspstart.Text == "开始查询") { timer1.Interval = Convert.ToInt32(cbbtime.Text.ToString().Trim()); timer1.Enabled = true; tspstart.Text = "停止查询"; } else { tspstart.Text = "开始查询"; timer1.Enabled = false; timer2.Enabled = false; } } else { MessageBox.Show("请先设定查询时间间隔", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } private void cbbtime_SelectedIndexChanged(object sender, EventArgs e) { if (cbbtime.Text != "") { timer1.Interval = Convert.ToInt32(cbbtime.Text.ToString().Trim()); } } private void Form1_Load(object sender, EventArgs e) { webpage.Url = new Uri("http://www.1065921611.com/"); lvorder.Columns.Add("编号", 40); lvorder.Columns.Add("号码", 80); lvorder.Columns.Add("姓名", 80); lvorder.Columns.Add("用户余额", 80); lvorder.Columns.Add("状态", 120); lvorder.Columns.Add("时间", 120); lvorder.GridLines = true; //显示表格线 lvorder.View = View.Details;//显示表格细节 lvorder.HeaderStyle = ColumnHeaderStyle.Clickable;//对表头进行设置 lvorder.FullRowSelect = true;//是否可以选择行 cbbtime.Text = "5000"; this.Text = "电信查询"; } private void timer1_Tick(object sender, EventArgs e) { string strtele = ""; try { //从数据库中查询一条等待查询的数据 strtele = objtele.selectOneSelectStratMobile(Encrypt(), "2"); if (strtele != "") { string[] stroder = strtele.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries); if (stroder[0] != "0" && stroder[1] != "0") { try { HtmlDocument doc = webpage.Document.Window.Frame