//通用短信
        public void senderMesssage(string phoneNum, string messageContent)
        {
            WebSMS wsm = new WebSMS();

            if (wsm == null)
            {
                function.WriteErrMsg("网关初始化失败!", "Default.aspx");
                return;
            }
            string strIdentity = wsm.GetIdentityMark(Int32.Parse(g_eid), g_uid, g_pwd, Int32.Parse(g_gate_id));

            if (strIdentity == null || strIdentity == "")
            {
                function.WriteErrMsg("获取标识串失败!", "Default.aspx");
                return;
            }
            if (phoneNum == "" || messageContent == "")
            {
                function.WriteErrMsg("接收号码或者短信内容没有输入!", "Default.aspx");
                return;
            }
            //快速发送.直接提交到运营商网关
            SendResult status = wsm.FastSend(strIdentity, phoneNum, messageContent, "", "");
            //发送成功
        }
Exemple #2
0
    //------北京网通(东时方)
    public int SendByEast(string t_sendNo, string t_sendMemo)
    {
        WebSMS wsm       = new WebSMS();
        string g_uid     = SiteConfig.SiteOption.G_uid;
        string g_eid     = SiteConfig.SiteOption.G_eid;
        string g_pwd     = SiteConfig.SiteOption.G_pwd;
        string g_gate_id = SiteConfig.SiteOption.G_gate_id;

        string strIdentity = wsm.GetIdentityMark(Int32.Parse(g_eid), g_uid, g_pwd, Int32.Parse(g_gate_id));

        if (wsm.GetMoney(strIdentity) > 0)
        {
            if (wsm == null)
            {
                //Response.Write("<script>alert('网关初始化失败!');window.location='Default.aspx';</script>");
                return(1);
            }
            //string strIdentity = wsm.GetIdentityMark(Int32.Parse(g_eid), g_uid, g_pwd, Int32.Parse(g_gate_id));
            if (strIdentity == null || strIdentity == "")
            {
                //Response.Write("<script>alert('获取标识串失败!');window.location='Default.aspx';</script>");
                return(2);
            }
            if (t_sendNo.Trim() == "" || t_sendMemo.Trim() == "")
            {
                //Response.Write("<script>alert('接收号码或者短信内容没有输入!');window.location='Default.aspx';</script>");
                return(3);
            }

            //快速发送.直接提交到运营商网关
            SendResult status = wsm.FastSend(strIdentity, t_sendNo.Trim(), t_sendMemo.Trim().Replace(",", ""), "", "");
            //System.Web.HttpContext.Current.Response.Write(t_sendMemo.Trim());
            //System.Web.HttpContext.Current.Response.End();
            //发送成功
            if (status.RetCode > 0)
            {
                //js = "发送成功,共发送:" + status.RetCode.ToString() + "条";
                return(99);
                //this.Label1.Text = "当前余额:" + wsm.GetMoney(strIdentity).ToString("0.00");
            }

            else //发送失败
            {
                //js = "发送失败,错误代码:" + status.RetCode.ToString() + ",原因:" + status.ErrorDesc;
                //System.Web.HttpContext.Current.Response.Write(js);
                return(4);
            }

            // Response.Write("<script>alert('" + js + "');window.location='MessageInfo.aspx';</script>");
        }
        return(0);
    }
Exemple #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            WebSMS wsm = new WebSMS();

            g_uid                = SiteConfig.SiteOption.G_uid;
            g_eid                = SiteConfig.SiteOption.G_eid;
            g_pwd                = SiteConfig.SiteOption.G_pwd;
            g_gate_id            = SiteConfig.SiteOption.G_gate_id;
            this.x_uid.Value     = g_uid.ToString();
            this.x_eid.Value     = g_eid.ToString();
            this.x_pwd_md5.Value = g_pwd.ToString();
            this.h_gate_id.Value = g_gate_id.ToString();
            if (wsm == null)
            {
                function.WriteErrMsg("网关初始化失败!");
                return;
            }
            string strIdentity = wsm.GetIdentityMark(Int32.Parse(g_eid), g_uid, g_pwd, Int32.Parse(g_gate_id));

            if (strIdentity == null || strIdentity == "")
            {
                function.WriteErrMsg("获取标识串失败!");
                return;
            }
            if (this.t_sendNo.Text.ToString().Trim() == "" || this.t_sendMemo.Text.ToString().Trim() == "")
            {
                function.WriteErrMsg("接收号码或者短信内容没有输入!");
                return;
            }
            if (this.t_sendTime.Text.ToString().Trim() != "")
            {
                DateTime dt;
                if (!DateTime.TryParse(this.t_sendTime.Text.ToString().Trim(), out dt))
                {
                    function.WriteErrMsg("定时格式错误!");
                    return;
                }
                if (dt <= DateTime.Now)
                {
                    function.WriteErrMsg("定时时间必须大于当前时间!");
                    return;
                }
            }
            //快速发送.直接提交到运营商网关
            SendResult status = wsm.FastSend(strIdentity, this.t_sendNo.Text.ToString().Trim(), this.t_sendMemo.Text.ToString().Trim(), this.t_sendTime.Text.ToString().Trim(), "");
            //发送成功
            string js = "";

            if (status.RetCode > 0)
            {
                js = "发送成功,共发送:" + status.RetCode.ToString() + "条";
                this.Label1.Text = "当前余额:" + wsm.GetMoney(strIdentity).ToString("0.00");
            }
            else //发送失败
            {
                js = "发送失败,错误代码:" + status.RetCode.ToString() + ",原因:" + status.ErrorDesc;
            }
            js = js.Replace("\"", "\\\"");
            js = js.Replace("\'", "\\\'");
            // Response.Write("<script>alert('" + js + "');window.location='MessageInfo.aspx';</script>");
        }