using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace MWSeviceDemo
{
///
/// WebForm1 的摘要说明。
///
public class WebForm1 : System.Web.UI.Page
{
MWSeviceDemo.MW.wmgw ws;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.TextBox TextBox3;
protected System.Web.UI.WebControls.TextBox TextBox4;
protected System.Web.UI.WebControls.TextBox TextBox5;
protected System.Web.UI.WebControls.ListBox ListBox1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Button Button3;
protected System.Web.UI.WebControls.Button Button5;
protected System.Web.UI.WebControls.Label Label6;
protected System.Web.UI.WebControls.TextBox TextBox6;
protected System.Web.UI.WebControls.Label Label7;
protected System.Web.UI.WebControls.Button Button4;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
ws = new MWSeviceDemo.MW.wmgw();
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
///
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
///
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Button3.Click += new System.EventHandler(this.Button3_Click);
this.Button4.Click += new System.EventHandler(this.Button4_Click);
this.Button5.Click += new System.EventHandler(this.Button5_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
//单发
int result;
result=ws.MongateSendSms(TextBox1.Text,TextBox2.Text,TextBox4.Text,TextBox3.Text);
if(result > 0)
ListBox1.Items.Insert(0,"发送信息成功!");
else
ListBox1.Items.Insert(0,"发送信息失败!返回:"+result.ToString());
}
private void Button2_Click(object sender, System.EventArgs e)
{
int bal=ws.MongateQueryBalance(TextBox1.Text,TextBox2.Text);
int use=ws.MongateQueryUsed(TextBox1.Text,TextBox2.Text);
if(bal>=0 && use >=0){ListBox1.Items.Insert(0,"帐户余额:"+bal.ToString()+";帐户已用:"+use.ToString());}
else{ListBox1.Items.Insert(0,"返回:" + bal.ToString()+","+use.ToString());}
}
private void Button3_Click(object sender, System.EventArgs e)
{
string []result = ws.MongateCsGetSmsExEx(TextBox1.Text,TextBox2.Text);
if(result==null){ListBox1.Items.Insert(0,"无信息");}
else
foreach (string s in result)
{
ListBox1.Items.Insert(0,new ListItem(s,""));
}
}
private void Button4_Click(object sender, System.EventArgs e)
{
string []result = ws.MongateCsGetStatusReportExEx(TextBox1.Text,TextBox2.Text);
if(result==null){ListBox1.Items.Insert(0,"无状态报告");}
else
foreach (string s in result)
{
ListBox1.Items.Insert(0,new ListItem(s,""));
}
}
private void Button5_Click(object sender, System.EventArgs e)
{
string []ret=null;
//子端口发送
ret = ws.MongateCsSPSendSmsExEx(TextBox1.Text,TextBox2.Text,TextBox4.Text,TextBox3.Text,this.TextBox6.Text);
if(ret[0] == null)
{
ListBox1.Items.Insert(0,"发送信息成功!信息编号:"+ret[1]);
ListBox1.Items.Insert(0,"正确号码:"+ret[2]);
ListBox1.Items.Insert(0,"错误号码:"+ret[3]);
}
else
{
ListBox1.Items.Insert(0,"发送失败:" + ret[0] + "错误号码:"+ret[2]);
}
}
}
}