private void sendsmsinsurance() { string name, lname, mobile; DateTime date; for (int i = 0; i < tb_insurance.Rows.Count; i++) { name = tb_insurance.Rows[0]["name"].ToString(); lname = tb_insurance.Rows[0]["lname"].ToString(); mobile = tb_insurance.Rows[0]["mobile"].ToString(); dec_insurance = dec_insurance.Replace("xm", name + " " + lname);// string[] senderNumbers = { mobilesender }; string[] recipientNumbers = { mobile }; string[] messageBodies = { dec_register }; date = DateTime.Now; //date = DateTime.Now.AddMinutes(5); string[] senddate = { Convert.ToString(ConvertDatetimeToUnixTimeStamp(date)) }; int[] messageClasses = { }; long[] MessageIDs = { }; ir.smsapp.v2 ws = new ir.smsapp.v2(); MessageIDs = ws.SendSMS(username, password, senderNumbers, recipientNumbers, messageBodies, senddate, null, null); MessageBox.Show("MessageID : " + MessageIDs[0] + ""); insertdata(name, lname, mobile, MessageIDs[0].ToString(), "بیمه"); } }
public ActionResult SendPassword(string mobile) { var user = db.Users.Where(m => m.Mobile == mobile).FirstOrDefault(); ir.smsapp.v2 ws = new ir.smsapp.v2(); string smsUsername = System.Web.Configuration.WebConfigurationManager.AppSettings["SMS_UserName"]; string smsPassword = System.Web.Configuration.WebConfigurationManager.AppSettings["SMS_Password"]; string[] senderNumbers = { System.Web.Configuration.WebConfigurationManager.AppSettings["SMS_Sender"] }; string[] recipientNumbers = { user.Mobile }; string bodyText = string.Format("گیم سرور آرشا - کلمه عبور: {0}", user.Password); string[] messageBodies = { bodyText }; ws.SendSMS(smsUsername, smsPassword, senderNumbers, recipientNumbers, messageBodies, null, null, null); return(View("SendPassword")); }