Example #1
0
        private string g_content; //短信内容

        protected void Page_Load(object sender, EventArgs e)
        {
            function.AccessRulo();
            B_Admin badmin = new B_Admin();

            if (!B_ARoleAuth.Check(ZLEnum.Auth.other, "SiteConfig"))
            {
                function.WriteErrMsg("没有权限进行此项操作");
            }
            if (!this.IsPostBack)
            {
                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;
                g_content = SiteConfig.SiteOption.G_content;

                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();
                this.txtContent.Value = g_content.ToString();

                string strIdentity = wsm.GetIdentityMark(Int32.Parse(g_eid), g_uid, g_pwd, Int32.Parse(g_gate_id));
                this.Label1.Text = "当前余额:" + wsm.GetMoney(strIdentity).ToString("0.00");
                if (g_uid == "" || g_eid == "" || g_pwd == "" || g_gate_id == "")
                {
                    Response.Write("参数不全!");
                    return;
                }
            }
        }
        //通用短信
        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, "", "");
            //发送成功
        }
Example #3
0
    public string GetSZDXBalance()
    {
        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));

        return(wsm.GetMoney(strIdentity).ToString("0.00"));
    }
Example #4
0
        //从服务上取短信.功能被放弃。接收短信修改PUSH下发给客户。
        private void ReadSMS()
        {
            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;
            }
            try
            {
                string readxml = wsm.ReadXml(strIdentity);
                //如果是数字代表返回失败
                int code = 0;
                if (Int32.TryParse(readxml, out code))
                {
                    this.div_sms.InnerText = "接收失败,错误代码:" + code.ToString().Trim() + ",原因:" + wsm.GetErrorHint(code);
                    return;
                }
                if (readxml == null || readxml.ToString().Trim() == "")
                {
                    this.div_sms.InnerText = "没有收到短信回复!";
                    this.EGV.DataSource    = null;
                    this.EGV.DataBind();
                    return;
                }
                this.div_sms.Visible = false;
                DataSet ds = ConvertXMLToDataSet(readxml);
                this.EGV.DataSource = ds.Tables[0];
                this.EGV.DataBind();
            }
            catch (Exception ex)
            {
                this.div_sms.InnerText = "接收异常:原因" + ex.Message.ToString();
            }
        }
Example #5
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);
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            function.AccessRulo();
            if (!this.IsPostBack)
            {
                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;
                g_content             = SiteConfig.SiteOption.G_content;
                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();
                this.txtContent.Value = g_content.ToString();
                this.txtType.Value    = "";


                string t_sendNos = Request.QueryString["t_sendNo"];
                string conetent  = Request.QueryString["s_memo"];
                s_memo.Text   = conetent;
                t_sendNo.Text = t_sendNos;

                string strIdentity = wsm.GetIdentityMark(Int32.Parse(g_eid), g_uid, g_pwd, Int32.Parse(g_gate_id));
                if (g_uid == "" || g_eid == "" || g_pwd == "" || g_gate_id == "")
                {
                    Response.Write("参数不全!");
                    return;
                }
            }

            int id = DataConverter.CLng(Request.QueryString["id"]);

            this.oid = id;
            if (oll.FondOrder(id) == true)
            {
                orderinfo = oll.GetOrderListByid(id);
                string OrderNo = orderinfo.OrderNo.ToString();
            }
        }
Example #7
0
        static void ConnecttimeWarning(object source, System.Timers.ElapsedEventArgs e)
        {
            System.Timers.Timer pp = (System.Timers.Timer)source;
            pp.Enabled = false;
            string[] _strgame = GetConnect().Split(",".ToCharArray());

            for (int m = 0; m < _strgame.Length; m++)
            {
                int game_id = int.Parse(_strgame[m]);

                #region 电话列表
                string       str_sendsql = "SELECT Mobile_Phone FROM SMS_Mobile WHERE Mobile_Game =" + game_id;
                MSSQLOperate pSms        = new MSSQLOperate(strAnalyse);
                pSms.Connect(false);
                pSms.ExecuteQuery(str_sendsql);
                pSms.GetResult(RecordStyle.DATASET);
                DataSet psDataSet = (DataSet)pSms.RecordData;
                #endregion

                string       str_sql  = "SELECT Server_Internet,Access_User,Access_Pwd,Server_DBtype,Game_Name,Server_Name FROM Game_Server,Server_Access,Info_Game WHERE Server_DBtype <> 127 AND Server_Game = " + game_id + " AND Access_Server = Server_ID AND Game_ID=Server_Game AND Access_Sort = 14";
                MSSQLOperate pConnect = new MSSQLOperate(strAnalyse);
                pConnect.Connect(false);
                pConnect.ExecuteQuery(str_sql);
                pConnect.GetResult(RecordStyle.DATASET);
                DataSet pDataSet = (DataSet)pConnect.RecordData;

                if (pConnect.AffectRow > 0)
                {
                    for (int i = 0; i < pDataSet.Tables[0].Rows.Count; i++)
                    {
                        bool   pResult  = true;
                        string str_user = System.Text.Encoding.UTF8.GetString(Declassified.Decrypt(System.Convert.FromBase64String(pDataSet.Tables[0].Rows[i][1].ToString()), System.Text.Encoding.UTF8.GetBytes("1234567890abcdef")));
                        string str_pwd  = System.Text.Encoding.UTF8.GetString(Declassified.Decrypt(System.Convert.FromBase64String(pDataSet.Tables[0].Rows[i][2].ToString()), System.Text.Encoding.UTF8.GetBytes("1234567890abcdef")));

                        if ("2" == pDataSet.Tables[0].Rows[i][3].ToString())//
                        {
                            #region SQL SERVER
                            string str_conncet = "Connect Timeout=300000;Server=" + pDataSet.Tables[0].Rows[i][0].ToString() + ";Database=master;uid=" + str_user + "; pwd=" + str_pwd;

                            MSSQLOperate pSqlConnect = new MSSQLOperate(str_conncet);
                            try
                            {
                                if (!pSqlConnect.Connect(false))
                                {
                                    //连接失败
                                    pResult = false;
                                }
                            }
                            catch (Exception ex)
                            {
                                //连接失败
                                pResult = false;
                            }
                            #endregion
                        }
                        else if ("3" == pDataSet.Tables[0].Rows[i][3].ToString())//
                        {
                            #region MYSQL
                            string str_conncet = "Connect Timeout=300000;Server=" + pDataSet.Tables[0].Rows[i][0].ToString() + ";uid=" + str_user + "; pwd=" + str_pwd;

                            MysqlUtils pMysqlConnect = new MysqlUtils(str_conncet);
                            try
                            {
                                if (!pMysqlConnect.Connected())
                                {
                                    //连接失败
                                    pResult = false;
                                }
                            }
                            catch (Exception ex)
                            {
                                //连接失败
                                pResult = false;
                            }
                            #endregion
                        }

                        #region 发送短信
                        if (!pResult)//连接失败,发送短信
                        {
                            if (pSms.AffectRow > 0)
                            {
                                for (int j = 0; j < pSms.AffectRow; j++)
                                {
                                    try
                                    {
                                        WebSMS pWebSMSSend   = new WebSMS();
                                        string str_send      = "游戏‘" + pDataSet.Tables[0].Rows[i][4].ToString() + "’,服务器‘" + pDataSet.Tables[0].Rows[i][5].ToString() + "’连接失败";
                                        byte[] pResultBuffer = pWebSMSSend.sendSMS(psDataSet.Tables[0].Rows[j][0].ToString(), str_send);
                                        int    iResult       = Encoding.Default.GetString(pResultBuffer) == "OK" ? 1 : 0;
                                    }
                                    catch
                                    { }
                                }
                            }
                        }
                        #endregion
                    }
                }
            }
            pp.Enabled = true;
        }
Example #8
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>");
        }