public static void SendPasswordOtp(string cellNumber, string code) { var token = new Token().GetToken("db67a48dbe57332ec63980c", "rushwebSmsApi"); var ultraFastSend = new UltraFastSend() { Mobile = Convert.ToInt64(cellNumber), TemplateId = 33496, ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = "verifyCode", ParameterValue = code.ToString() } }.ToArray() }; UltraFastSendRespone ultraFastSendRespone = new UltraFast().Send(token, ultraFastSend); if (ultraFastSendRespone.IsSuccessful) { } else { } }
public bool SendFastVerificationCode(string mobile, string code) { try { var fastSend = new UltraFastSend() { Mobile = Convert.ToInt64(mobile), TemplateId = 24922, ParameterArray = new List <UltraFastParameters> { new UltraFastParameters { Parameter = "VerificationCode", ParameterValue = code } }.ToArray() }; var fastSendRes = new UltraFast().Send(_token, fastSend); if (fastSendRes.IsSuccessful) { return(true); } else { return(false); } } catch { return(false); } }
public static void SendOtpSms(string cellNumber, string code) { var token = new Token().GetToken("c34c137660319581a9c21376", "123qwe!@#QWE"); var ultraFastSend = new UltraFastSend() { Mobile = Convert.ToInt64(cellNumber), TemplateId = 34071, ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = "verifyCode", ParameterValue = code } }.ToArray() }; UltraFastSendRespone ultraFastSendRespone = new UltraFast().Send(token, ultraFastSend); if (ultraFastSendRespone.IsSuccessful) { } else { } }
public void SendSms(string cellNumber, string code) { var token = new Token().GetToken("773e6490afdaeccca1206490", "123qwe!@#QWE"); var ultraFastSend = new UltraFastSend() { Mobile = Convert.ToInt64(cellNumber), TemplateId = 29580, ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = "verifyCode", ParameterValue = code } }.ToArray() }; UltraFastSendRespone ultraFastSendRespone = new UltraFast().Send(token, ultraFastSend); if (ultraFastSendRespone.IsSuccessful) { } else { } }
public void CallSmSMethod(long MobileNumber, int TemplateId, string ParameterName, string ParameterValue) { var ultraFastSend = new UltraFastSend() { Mobile = MobileNumber, TemplateId = TemplateId, ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = ParameterName, ParameterValue = ParameterValue } }.ToArray() }; UltraFastSendRespone ultraFastSendRespone = new UltraFast().Send(tk.GetToken(userApiKey, secretKey), ultraFastSend); }
public Task SendAsync(IdentityMessage message) { var token = new Token().GetToken("7512463e2c1552e68a34463e", "s@n@@rv@ndp@y@"); var ultraFastSend = new UltraFastSend { Mobile = long.Parse(message.Destination), TemplateId = 7958, ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = "VerificationCode", ParameterValue = message.Body } }.ToArray() }; var ultraFastSendResponse = new UltraFast().Send(token, ultraFastSend); return(Task.CompletedTask); }
public static void SendInput(long mobile, string fullName, string inDate, int id) { try { var token = new Token().GetToken("17413e1864890dd130c73e17", "Fm&)**)!@(*"); var ultraFastSend = new UltraFastSend() { Mobile = mobile, TemplateId = 33365, ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = "FullName", ParameterValue = fullName, }, new UltraFastParameters() { Parameter = "InDate", ParameterValue = inDate } }.ToArray() }; UltraFastSendRespone ultraFastSendRespone = new UltraFast().Send(token, ultraFastSend); if (Convert.ToBoolean(ultraFastSendRespone.IsSuccessful)) { using (var dbx = new schooldbEntities()) { var find = dbx.TagRecorders.Find(id); find.SMS = true; var resultSave = dbx.SaveChanges(); Logger.WriteMessageSenderLog(Convert.ToBoolean(resultSave) ? $"Send Input {mobile}" : $"Not Send Input {mobile}"); } } } catch (Exception e) { Logger.WriteErrorLog(e, "SendInput"); } }
public void SendActivationCode(string cellNumber, int code) { var token = new Token().GetToken("14285fa8b944209efc925fa8", "123qwepjf!@#nvhk4FjS9"); var ultraFastSend = new UltraFastSend() { Mobile = Convert.ToInt64(cellNumber), TemplateId = 27234, ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = "verifyCode", ParameterValue = code.ToString() } }.ToArray() }; UltraFastSendRespone ultraFastSendRespone = new UltraFast().Send(token, ultraFastSend); if (ultraFastSendRespone.IsSuccessful) { } }
public UltraFastSMSResult Send(UltraFastSMSInput input) { if (string.IsNullOrWhiteSpace(input.Mobile)) { throw new ArgumentException("Value cannot be empty or whitespace only string.", "To"); } if (input.Parameters == null || input.Parameters.Count() == 0) { throw new ArgumentException("Value cannot be NULL .", "Parameters"); } var Params = new List <UltraFastParameters>(); foreach (var item in input.Parameters) { Params.Add(new UltraFastParameters { Parameter = item.Key, ParameterValue = item.Value }); } var ultraFastSend = new UltraFastSend() { Mobile = Int64.Parse(input.Mobile), TemplateId = input.TemplateId, ParameterArray = Params.ToArray() }; var Token = new Token().GetToken(input.ApiKey, input.SecretKey); UltraFastSendRespone ultraFastSendRespone = new UltraFast().Send(Token, ultraFastSend); UltraFastSMSResult result = new UltraFastSMSResult { IsSuccessful = ultraFastSendRespone.IsSuccessful, Message = ultraFastSendRespone.Message, VerificationCodeId = ultraFastSendRespone.VerificationCodeId }; return(result); }
public void Send() { var token = GetToken(); if (string.IsNullOrWhiteSpace(token)) { throw new Exception($@"{nameof(token) } is null"); } var ultraFastSend = new UltraFastSend() { Mobile = 09120000001, TemplateId = 26, ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = "VerificationCode", ParameterValue = "123321" } }.ToArray() }; UltraFastSendRespone ultraFastSendRespone = new UltraFast().Send(token, ultraFastSend); if (ultraFastSendRespone == null) { throw new Exception($@"{nameof(ultraFastSendRespone) } is null"); } if (ultraFastSendRespone.IsSuccessful) { } else { } }
public bool SendSecurityCode(string to, string code) { var token = new Token().GetToken(_config["Sms:UserApiKey"], _config["Sms:SecretKey"]); var ultraFastSend = new UltraFastSend() { Mobile = Convert.ToInt64(to), TemplateId = 22311, ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = "VerificationCode", ParameterValue = code }, new UltraFastParameters() { Parameter = "WebsiteAddress", ParameterValue = "نانوایی آنلاین" }, }.ToArray() }; UltraFastSendRespone ultraFastSendRespone = new UltraFast().Send(token, ultraFastSend); return(ultraFastSendRespone.IsSuccessful); }
//for Register ==> // TemplateToken : "VelvetRegister" // SMSForWichStatus : 2 public SMS_ir_Status SendVerificationCodeWithTemplate(int UserID, string TemplateToken, int SMSForWichStatus) { PDBC db = new PDBC("PandaMarketCMS", true); db.Connect(); using (DataTable dt = db.Select("SELECT [sms_irUserAPIKey] ,[sms_irSecretKey] FROM [tbl_sms_ir_APIvals]")) { if (dt.Rows.Count > 0) { var token = new Token().GetToken(dt.Rows[0]["sms_irUserAPIKey"].ToString(), dt.Rows[0]["sms_irSecretKey"].ToString()); List <ExcParameters> parss = new List <ExcParameters>(); ExcParameters par = new ExcParameters() { _KEY = "@id_Customer", _VALUE = UserID }; parss.Add(par); par = new ExcParameters() { _KEY = "@sms_irKeyType", _VALUE = SMSForWichStatus }; parss.Add(par); using (DataTable dtUser = db.Select("SELECT TOP(1) [sms_irSentKeyID] ,[id_Customer] ,[sms_irKeyType] ,[sms_irSentKey] ,[sms_irKeyGeneratedDate] ,[sms_irIsKeyAlive] FROM [tbl_sms_ir_CustomerKeys] WHERE [id_Customer] = @id_Customer AND sms_irKeyType = @sms_irKeyType AND [sms_irIsKeyAlive] = 1 ORDER BY sms_irSentKeyID DESC", parss)) { if (dtUser.Rows.Count > 0) { double RemainingDate = (DateTime.Now - DateTime.Parse(dtUser.Rows[0]["sms_irKeyGeneratedDate"].ToString())) .TotalSeconds; if (RemainingDate < 60) { parss = new List <ExcParameters>(); par = new ExcParameters() { _KEY = "@id_Customer", _VALUE = UserID }; parss.Add(par); using (DataTable UserStructure = db.Select("SELECT [id_Customer] ,[C_regDate] ,[C_Mobile] ,[C_FirstName] ,[C_LastNAme] FROM [tbl_Customer_Main] WHERE [id_Customer] = @id_Customer", parss)) { if (dt.Rows.Count > 0) { parss = new List <ExcParameters>(); par = new ExcParameters() { _KEY = "@TemplatePandaToken", _VALUE = TemplateToken }; parss.Add(par); using (DataTable dtTemplateToken = db.Select("SELECT [sms_irTemplate] ,[sms_irMessageType] ,[sms_irTemplateAPIKey] ,[TemplatePandaToken] FROM [tbl_sms_ir_Template] WHERE [TemplatePandaToken] LIKE @TemplatePandaToken", parss)) { if (dtTemplateToken.Rows.Count > 0) { string ssdd = long.Parse(UserStructure.Rows[0]["C_Mobile"].ToString()).ToString(); string UserFullName = $"{UserStructure.Rows[0]["C_FirstName"].ToString()} {UserStructure.Rows[0]["C_LastNAme"].ToString()}"; var ultraFastSend = new UltraFastSend() { Mobile = long.Parse(UserStructure.Rows[0]["C_Mobile"].ToString()), TemplateId = Int32.Parse(dtTemplateToken.Rows[0]["sms_irTemplateAPIKey"].ToString()), ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = "FullName", ParameterValue = UserFullName }, new UltraFastParameters() { Parameter = "Verify", ParameterValue = dtUser.Rows[0]["sms_irSentKey"].ToString() } }.ToArray() }; UltraFastSendRespone ultraFastSendRespone = new UltraFast().Send(token, ultraFastSend); if (ultraFastSendRespone.IsSuccessful) { parss = new List <ExcParameters>(); par = new ExcParameters() { _KEY = "@C_ActivationToken", _VALUE = dtUser.Rows[0]["sms_irSentKey"].ToString() }; parss.Add(par); par = new ExcParameters() { _KEY = "@id_Customer", _VALUE = UserID }; parss.Add(par); string RESult = db.Script( "UPDATE [dbo].[tbl_Customer_Main] SET [C_ActivationToken] = @C_ActivationToken WHERE [id_Customer] = @id_Customer", parss); if (RESult == "1") { db.DC(); return(new SMS_ir_Status() { StatusCode = "smsX:200OK", StatusMessage = $"SMS SENT ultraFastSendRespone.IsSuccessful == {ultraFastSendRespone.IsSuccessful} AND ultraFastSendRespone.Message == {ultraFastSendRespone.Message} AND ultraFastSendRespone.VerificationCodeId == {ultraFastSendRespone.VerificationCodeId}", StatusReturnedTime = DateTime.Now.ToString(), CustomerId = UserID }); } else { db.DC(); return(new SMS_ir_Status() { StatusCode = "smsX:407", StatusMessage = $"SMS SENT ultraFastSendRespone.IsSuccessful == {ultraFastSendRespone.IsSuccessful} AND ultraFastSendRespone.Message == {ultraFastSendRespone.Message} AND ultraFastSendRespone.VerificationCodeId == {ultraFastSendRespone.VerificationCodeId} BUT THERE IS ERROR IN Our CMS =={RESult}", StatusReturnedTime = DateTime.Now.ToString(), CustomerId = UserID }); } } else { db.DC(); return(new SMS_ir_Status() { StatusCode = "smsX:406", StatusMessage = $"CannotSendSMS Error From SMS.ir API ultraFastSendRespone.Message == {ultraFastSendRespone.Message}", StatusReturnedTime = DateTime.Now.ToString(), CustomerId = UserID }); } } else { db.DC(); return(new SMS_ir_Status() { StatusCode = "smsX:405", StatusMessage = $"SMS Template NotFound 404 TemplateToken : {TemplateToken}", StatusReturnedTime = DateTime.Now.ToString(), CustomerId = UserID }); } } } else { db.DC(); return(new SMS_ir_Status() { StatusCode = "smsX:404", StatusMessage = "User NotFound By id_Customer", StatusReturnedTime = DateTime.Now.ToString(), CustomerId = UserID }); } } } else { db.DC(); return(new SMS_ir_Status() { StatusCode = "smsX:403", StatusMessage = "KeyExpired (Time Remaining is in Parameter[StatusReturnedTime] in (Secend))", StatusReturnedTime = RemainingDate.ToString(), CustomerId = UserID }); } } else { db.DC(); return(new SMS_ir_Status() { StatusCode = "smsX:402", StatusMessage = "CannotFindUserFrom[tbl_sms_ir_CustomerKeys]", StatusReturnedTime = new DateTime().ToString(), CustomerId = UserID }); } } } else { db.DC(); return(new SMS_ir_Status() { StatusCode = "smsX:401", StatusMessage = "CannotFindSMSAPITokensFrom[tbl_sms_ir_APIvals]", StatusReturnedTime = new DateTime().ToString(), CustomerId = UserID }); } } }
public Task SendAsync(IdentityMessage message) { var token = new Token().GetToken("14efab49bf025f903ebafb4", "LanaDelRey"); var ultraFastSend = new UltraFastSend() { Mobile = long.Parse(message.Destination) }; switch (message.Subject) { case Smstemplate.Signup: ultraFastSend.TemplateId = int.Parse(Smstemplate.Signup); string[] up = message.Body.Split('%'); ultraFastSend.ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = "username", ParameterValue = up[0] }, new UltraFastParameters() { Parameter = "password", ParameterValue = up[1] } }.ToArray(); break; case Smstemplate.Payment_Done: ultraFastSend.TemplateId = int.Parse(Smstemplate.Payment_Done); ultraFastSend.ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = "price", ParameterValue = message.Body } }.ToArray(); break; case Smstemplate.Cerdit_Payment: ultraFastSend.TemplateId = int.Parse(Smstemplate.Payment_Done); string[] down = message.Body.Split('%'); ultraFastSend.ParameterArray = new List <UltraFastParameters>() { new UltraFastParameters() { Parameter = "price", ParameterValue = down[0] }, new UltraFastParameters() { Parameter = "code", ParameterValue = down[1] } }.ToArray(); break; } UltraFastSendRespone ultraFastSendRespone = new UltraFast().Send(token, ultraFastSend); if (ultraFastSendRespone.IsSuccessful) { return(Task.FromResult(1)); } else { return(Task.FromResult(0)); } }