Exemplo n.º 1
0
        public static bool SendSmsForNewsLetter(string linNumber, string[] MobileNo, string message)
        {
            ApplicationDbContext database = new ApplicationDbContext();
            var q = database.Tbl_SettingSite.FirstOrDefault();

            SmsIrRestful.Token tokenInstance = new SmsIrRestful.Token();

            var token = tokenInstance.GetToken(q.SmsApiService, q.SmsSecretKey);

            SmsIrRestful.MessageSend messageInstance = new SmsIrRestful.MessageSend();
            var res = messageInstance.Send(token, new SmsIrRestful.MessageSendObject()
            {
                CanContinueInCaseOfError = false,
                LineNumber = linNumber,
                Messages   = new List <string> {
                    message
                }.ToArray(),
                MobileNumbers = MobileNo,
                SendDateTime  = DateTime.Now,
            });

            if (res.IsSuccessful == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        public void Send(string To, string Body)
        {
            SmartStoreContext db = new SmartStoreContext();

            SmsIrRestful.Token tokenInstance = new SmsIrRestful.Token();

            string mobilenumber = To;
            string code         = Body;


            var token = tokenInstance.GetToken("a151711852a2c88060d564d5", "09378971585");

            //SmsIrRestful.UltraFast ultraFast = new SmsIrRestful.UltraFast();

            //var uf = ultraFast.Send(token, new SmsIrRestful.UltraFastSend()
            //{
            //    Mobile = Convert.ToInt64(mobilenumber),
            //    TemplateId = 5731,

            //    ParameterArray = new List<SmsIrRestful.UltraFastParameters>()
            //    {
            //        new SmsIrRestful.UltraFastParameters()
            //        {
            //            Parameter = "ثبت نام شما با موفقیت انجام شد کد فعال سازی شما" ,
            //            ParameterValue = code
            //        }
            //    }.ToArray()
            //});


            SmsIrRestful.VerificationCode verificationCode = new SmsIrRestful.VerificationCode();

            var vc = verificationCode.Send(token, new SmsIrRestful.RestVerificationCode()
            {
                MobileNumber = mobilenumber,
                Code         = code
            });
        }