Ejemplo n.º 1
0
        private String packageBatchSendSmsJsonData(String account, String passwd, List <SendSmsData> list)
        {
            String data = "{\"account\":\"" + account + "\""
                          + ",\"password\":\"" + passwd + "\""
                          + ",\"data\":[";

            for (int i = 0; i < list.Count; i++)
            {
                SendSmsData sendSmsData = list[i];
                data += "{"
                        + "\"msgid\":\"" + sendSmsData.Msgid + "\""
                        + ",\"phones\":\"" + sendSmsData.Phones + "\""
                        + ",\"content\":\"" + sendSmsData.Content + "\""
                        + ",\"sign\":\"" + sendSmsData.Sign + "\""
                        + ",\"subcode\":\"" + sendSmsData.Subcode + "\""
                        + "}";

                if (i < list.Count - 1)
                {
                    data += ",";
                }
            }

            data += "]}";
            return(data);
        }
Ejemplo n.º 2
0
        /**
         *
         * 批量发送短信
         *
         * **/
        private void _bsubmitBtn_Click(object sender, EventArgs e)
        {
            this._bsubmitBtn.Enabled = false;
            this._bexitBtn.Enabled   = false;
            if (checkBatchInput())
            {
                String _serverURL = this._btxtServerURL.Text.Trim();
                String _account   = this._btxtUserName.Text.Trim();
                String _passWord  = md5(this._btxtUserPswd.Text.Trim());
                String _data      = null;

                switch (opTag)
                {
                case "SendSMS":    //发送短信
                    String             _sign    = this.txtSign.Text.Trim();
                    String             _subCode = this.txtSubCode.Text.Trim();
                    List <SendSmsData> sendList = new List <SendSmsData>();

                    SendSmsData sendSmsData1 = new SendSmsData();
                    sendSmsData1.Content = this._btxtContent1.Text.Trim();
                    sendSmsData1.Phones  = this._btxtPhones1.Text.Trim();
                    sendSmsData1.Sign    = this._btxtSign1.Text.Trim();
                    sendSmsData1.Msgid   = this._btxtSmsId1.Text.Trim();
                    sendSmsData1.Subcode = this._btxtSubcode1.Text.Trim();

                    sendList.Add(sendSmsData1);

                    SendSmsData sendSmsData2 = new SendSmsData();
                    sendSmsData2.Content = this._btxtContent2.Text.Trim();
                    sendSmsData2.Phones  = this._btxtPhones2.Text.Trim();
                    sendSmsData2.Sign    = this._btxtSign2.Text.Trim();
                    sendSmsData2.Msgid   = this._btxtSmsId2.Text.Trim();
                    sendSmsData2.Subcode = this._btxtSubcode2.Text.Trim();
                    sendList.Add(sendSmsData2);
                    _data = this.packageBatchSendSmsJsonData(_account, _passWord, sendList);
                    break;

                case "GetSMS":    //获取上
                    _data = this.packageDeliverJsonData(_account, _passWord);
                    break;

                case "GetReport":    //获取状态报告
                    _data = this.packageReportJsonData(_account, _passWord);
                    break;

                default:
                    break;
                }
                this._btxtPostData.Text     = _data;
                this._btxtResponseData.Text = postMethodConnServer(_serverURL, _data);
            }
            this._bsubmitBtn.Enabled = true;
            this._bexitBtn.Enabled   = true;
        }
Ejemplo n.º 3
0
        /**
         *
         * 生成普通发送短信的JSON 请求数据包
         *
         *
         * **/
        private String packageSendSmsJsonData(String account, String passwd, SendSmsData sendSmsData)
        {
            String data = "{\"account\":\"" + account + "\""
                          + ",\"password\":\"" + passwd + "\""
                          + ",\"msgid\":\"" + sendSmsData.Msgid + "\""
                          + ",\"phones\":\"" + sendSmsData.Phones + "\""
                          + ",\"content\":\"" + sendSmsData.Content + "\""
                          + ",\"sign\":\"" + sendSmsData.Sign + "\""
                          + ",\"subcode\":\"" + sendSmsData.Subcode + "\""
                          + "}";

            return(data);
        }
Ejemplo n.º 4
0
        /**
         *
         * 普通发送短信
         * **/
        private void btnInvoke_Click(object sender, EventArgs e)
        {
            submitBtn.Enabled = false;
            exitBtn.Enabled   = false;
            if (checkInput())
            {
                String _serverURL = txtServerURL.Text.Trim();
                String _data      = null;
                String _account   = txtUserName.Text.Trim();
                String _passWord  = md5(txtPassWord.Text.Trim());
                switch (opTag)
                {
                case "SendSMS":    //发送短信

                    SendSmsData sendSmsData = new SendSmsData();
                    sendSmsData.Phones  = txtPhone.Text.Trim();
                    sendSmsData.Content = txtSmsContent.Text.Trim();
                    sendSmsData.Msgid   = txtSmsId.Text.Trim();
                    sendSmsData.Sign    = this.txtSign.Text.Trim();
                    sendSmsData.Subcode = this.txtSubCode.Text.Trim();
                    _data = this.packageSendSmsJsonData(_account, _passWord, sendSmsData);

                    break;

                case "GetSMS":    //获取上
                    _data = this.packageDeliverJsonData(_account, _passWord);
                    break;

                case "GetReport":    //获取状态报告
                    _data = this.packageReportJsonData(_account, _passWord);
                    break;

                default:
                    break;
                }
                this.txtPostData.Text     = _data;
                this.txtResponseData.Text = postMethodConnServer(_serverURL, _data);
            }
            submitBtn.Enabled = true;
            exitBtn.Enabled   = true;
        }