public string EmaySendSMS(Dictionary<string, string> serivceConfig, SMSEntity sms)
        {
            string serverHost = serivceConfig["EmaySMSServerHost"];
            string action = "sendSMS";
            WebServiceProxy wsd = new WebServiceProxy(serverHost, action);

            object[] paramArray = { serivceConfig["EmayAuthCode"], serivceConfig["EmayAuthCodePassword"], DateTime.Now.ToString(), sms.ReceivePhoneNumber.Split(new char[] { ';' }), sms.SMSBody, "", "GBK", 3, Convert.ToInt64(DateTime.Now.ToString("yyyyMMddHHmmssfff")) };

            return string.Format("{0}#SPLIT#{1}", sms.SysNo, wsd.ExecuteQuery(action, paramArray).ToString());
        }
Beispiel #2
0
 static void InsertSMSTest()
 {
     SMSEntity entity = new SMSEntity()
     {
         ReceiveName = "ABC",
         ReceivePhoneNumber = "13833441501",
         SMSBody = "Test短信",
         Status = SMSStatus.AuditPassed
     };
     SMSProcessor.Instance.InsertSMS(entity);
 }
 /// <summary>
 /// 亿美接口发送方式
 /// </summary>
 /// <param name="serivceConfig">服务配置</param>
 /// <param name="sms">短信对象</param>
 public void Send(Dictionary<string, string> serivceConfig, SMSEntity sms)
 {
     EmaySendSMSDelegate _emaySendSMS = new EmaySendSMSDelegate(EmaySendSMS);
     IAsyncResult ar = _emaySendSMS.BeginInvoke(serivceConfig, sms, new AsyncCallback(SendCompleted), _emaySendSMS);
 }
Beispiel #4
0
        /// <summary>
        /// 写入短信数据
        /// </summary>
        /// <param name="entity">短信对象</param>
        public bool InsertSMS(SMSEntity entity)
        {
            int retVal = 0;
            string sql = @"INSERT INTO [SohoEmailAndSMS].[dbo].[SMS]
                            ([UserSysNo]
                            ,[ReceiveName]
                            ,[ReceivePhoneNumber]
                            ,[SMSBody]
                            ,[Status]
                            ,[SendTime]
                            ,[InDate]
                            ,[LastUpdateTime]
                            ,[Note])
                        VALUES
                            (@UserSysNo
                            ,@ReceiveName
                            ,@ReceivePhoneNumber
                            ,@SMSBody
                            ,@Status
                            ,@SendTime
                            ,GETDATE()
                            ,NULL
                            ,@Note)";

            SqlServerDBHelper db = new SqlServerDBHelper();
            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@UserSysNo", entity.UserSysNo.HasValue ? entity.UserSysNo.Value : 0),
                    new SqlParameter("@ReceiveName", string.IsNullOrWhiteSpace(entity.ReceiveName) ? "" : entity.ReceiveName),
                    new SqlParameter("@ReceivePhoneNumber", entity.ReceivePhoneNumber),
                    new SqlParameter("@SMSBody", entity.SMSBody),
                    new SqlParameter("@Status", entity.Status),
                    new SqlParameter("@SendTime", string.IsNullOrWhiteSpace(entity.SendTime) ? "" : entity.SendTime),
                    new SqlParameter("@Note", string.IsNullOrWhiteSpace(entity.Note) ? "" : entity.Note)
                };
                retVal = db.ExecuteNonQuery(CommandType.Text, sql, para);
            }
            catch (Exception ex)
            {
                Logger.WriteException(ex.ToString());
            }
            finally
            {
                db.Dispose();
            }

            return retVal > 0 ? true : false;
        }
 /// <summary>
 /// 插入短信
 /// 说明:短信若无审核,则初始状态写入200,否则写入0
 /// </summary>
 /// <param name="sms">短信对象</param>
 /// <returns></returns>
 public bool InsertSMS(SMSEntity sms)
 {
     return GetDAInstance.InsertSMS(sms);
 }