public async Task <ResponseStatus> sendsms(sendSMSRequest sendSMSRequest)
        {
            ResponseStatus responseStatus = new ResponseStatus();

            try
            {
                var mobileno = appDbContex.promotionalMobileNos.Where(a => a.vendorId == sendSMSRequest.vendorId).ToList();
                foreach (var PhoneNo in mobileno)
                {
                    sendSMS.SendTextSms(sendSMSRequest.message, "+91" + PhoneNo.mobileno);
                    var        id         = Guid.NewGuid();
                    SMSHistory sMSHistory = new SMSHistory
                    {
                        id        = id.ToString(),
                        vendorId  = sendSMSRequest.vendorId,
                        message   = sendSMSRequest.message,
                        mobileno  = PhoneNo.mobileno,
                        createddt = DateTime.Now
                    };
                    appDbContex.SMSHistories.Add(sMSHistory);
                    await appDbContex.SaveChangesAsync();
                }
                responseStatus.status  = true;
                responseStatus.message = "Message sent successfully.";
                return(responseStatus);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        /// <summary>
        /// 发送短信接口
        /// </summary>
        /// <param name="content"></param>
        /// <param name="numbers"></param>
        /// <param name="priority"></param>
        /// <returns></returns>
        public static bool SendSMS(string content, string[] numbers, int priority = 5)
        {
            //获取短信接口的序列号,和自定义Key
            string SerialNo = BLL.SysManage.ConfigSystem.GetValueByCache("Emay_SMS_SerialNo");
            string Key      = BLL.SysManage.ConfigSystem.GetValueByCache("Emay_SMS_Key");

            if (String.IsNullOrWhiteSpace(SerialNo) || String.IsNullOrWhiteSpace(Key))
            {
                LogHelp.AddErrorLog("亿美短信接口缺少企业序列号或者自定义关键字Key", "亿美短信接口调用失败", HttpContext.Current.Request);
                return(false);
            }
            SMSService.SDKClient sdkClient  = new SDKClientClient();
            sendSMSRequest       smsRequest = new sendSMSRequest();

            smsRequest.arg0 = SerialNo;
            smsRequest.arg1 = Key;
            smsRequest.arg3 = numbers;
            smsRequest.arg4 = YSWL.Common.Globals.HtmlEncode(content);
            smsRequest.arg7 = priority;
            sendSMSResponse smsResponse = sdkClient.sendSMS(smsRequest);

            if (smsResponse.@return == 0)
            {
                return(true);
            }
            string msg = SendSMSException(smsResponse.@return);

            LogHelp.AddErrorLog("亿美短信接口发送短信出现异常,【" + msg + "】,错误码【" + smsResponse.@return + "】", "亿美短信接口调用失败", HttpContext.Current.Request);
            return(false);
        }
Example #3
0
    public System.Threading.Tasks.Task <sendSMSResponse> sendSMSAsync(sendSMS_Req sendSMS_Req)
    {
        sendSMSRequest inValue = new sendSMSRequest();

        inValue.sendSMS_Req = sendSMS_Req;
        return(((MobileMKTAdaptorSoap)(this)).sendSMSAsync(inValue));
    }
Example #4
0
    public sendSMS_Resp sendSMS(sendSMS_Req sendSMS_Req)
    {
        sendSMSRequest inValue = new sendSMSRequest();

        inValue.sendSMS_Req = sendSMS_Req;
        sendSMSResponse retVal = ((MobileMKTAdaptorSoap)(this)).sendSMS(inValue);

        return(retVal.sendSMS_Resp);
    }
Example #5
0
 System.Threading.Tasks.Task <sendSMSResponse> MobileMKTAdaptorSoap.sendSMSAsync(sendSMSRequest request)
 {
     return(base.Channel.sendSMSAsync(request));
 }
Example #6
0
 sendSMSResponse MobileMKTAdaptorSoap.sendSMS(sendSMSRequest request)
 {
     return(base.Channel.sendSMS(request));
 }