protected void sndmsg_Click(object sender, EventArgs e) { string mobnoms = ""; foreach (GridViewRow gvro in GridView1.Rows) { if (gvro.RowType == DataControlRowType.DataRow) { //TextBox txt =(TextBox)gvro.FindControl("txt"); CheckBox cko = new CheckBox(); cko = (CheckBox)gvro.FindControl("cchk"); if (cko.Checked == true) { mobnoms += gvro.Cells[2].Text + ","; //mobnoms += txt.Text + ","; } } } // Send sms if (mobnoms.Length > 0) { mobnoms = mobnoms.Substring(0, mobnoms.Length - 1);// Remove last , sms Snd = new sms(); Snd.SendSMS(mobnoms, TxtMessage.Text); lblSuccess.Text = "Message has been sent successfully"; // lblmessage.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { firstName = Request.QueryString["fnm"].ToString(); lastName = Request.QueryString["lnm"].ToString(); pass = Request.QueryString["pass"].ToString(); string hash = GenerateSHA256String(pass); email = Request.QueryString["email"].ToString(); adress = Request.QueryString["adr"].ToString(); phone = Request.QueryString["phone"].ToString(); System.Diagnostics.Debug.WriteLine("Begin+ " + email); try { String connString = System.Configuration.ConfigurationManager.ConnectionStrings["WebbAppConnString"].ToString(); conn = new MySql.Data.MySqlClient.MySqlConnection(connString); conn.Open(); queryStr = ""; queryStr = " INSERT INTO user (email,firstName,lastName,password,address,phone,type ) values ('" + email + "','" + firstName + "','" + lastName + "','" + hash + "','" + adress + "','" + phone + "','user')"; cmd = new MySql.Data.MySqlClient.MySqlCommand(queryStr, conn); cmd.ExecuteReader(); } catch (Exception mye) { Response.Redirect("RegisterNewCustomer.aspx"); } conn.Close(); sms s = new sms(); s.Sendsms(phone, "You have been registered att Movie Store"); System.Diagnostics.Debug.WriteLine("Phone+ " + email); sendEmail mail = new sendEmail(); mail.newuser_mail(email); }
public ActionResult SendSms(sms sms) { info = Session["userData"] as User; if (info != null) { if (info.user_types_id == 1) { var accountSid = "AC46897a0b56a6a2660459976a95a26dc5"; var authToken = "a6e59bc47ad203cf654db8404fc768b9"; TwilioClient.Init(accountSid, authToken); var to = new PhoneNumber(sms.to); var message = MessageResource.Create( to, from: new PhoneNumber("+12075608670"), body: sms.body); return(View()); } else { return(RedirectToAction("page_error_400", "Dashboard")); } } else { return(RedirectToAction("page_error_400", "Dashboard")); } }
/// <summary> /// /// </summary> /// <param name="modem"></param> /// <param name="smsPublished"></param> private void doPublishedSMS(IModem modem, sms smsPublished) { if (this.publishingSMS != null) { this.publishingSMS(this, modem, smsPublished); } }
private void registerUser() { try { firstName = textBoxFName.Text; lastName = textBoxLName.Text; pass = textBoxPass.Text; email = textBoxEmail.Text; street = textBoxStreet.Text; phone = textBoxPhone.Text; System.Diagnostics.Debug.WriteLine("SomeText2 " + pass); String connString = System.Configuration.ConfigurationManager.ConnectionStrings["WebbAppConnString"].ToString(); conn = new MySql.Data.MySqlClient.MySqlConnection(connString); conn.Open(); queryStr = ""; queryStr = "INSERT INTO customers (email,firstName,lastName,password,address,phone) values('" + email + "','" + firstName + "','" + lastName + "','" + pass + "','" + street + "','" + phone + "')"; cmd = new MySql.Data.MySqlClient.MySqlCommand(queryStr, conn); cmd.ExecuteReader(); conn.Close(); }catch (Exception e) { } System.Diagnostics.Debug.WriteLine("regester user with phone: " + phone); sms s = new sms(); s.Sendsms("+", "You have been registered att Movie Store"); clearBoxes(); }
protected void Button1_Click(object sender, EventArgs e) { MessageBox msg = new MessageBox(); admin ad = new admin(); MembershipUser u = Membership.GetUser(TextBox1.Text); if (u == null) { msg.Show("Invalid username"); } else { Guid a = new Guid(u.ProviderUserKey.ToString()); DataSet ds = ad.getuserpassword(a); string pass = ds.Tables[0].Rows[0]["password"].ToString(); string email = u.Email.ToString(); ProfileCommon comm = Profile.GetProfile(TextBox1.Text); string username = TextBox1.Text; string mobile = comm.Mobile; string name = comm.FirstName; mailing mail = new mailing(); string mess1 = "Dear " + name + ",<br><br>Your freshprawnsonline account password is:" + pass + "<br><br>Regards,<br>Admin, Farm Fresh Prawns."; string mess = "Dear " + name + " Your freshprawnsonline account password is:" + pass; mail.mymail(email, mess1, "Password Retrieval"); sms s = new sms(); s.SendSMS(mobile, mess); TextBox1.Text = ""; msg.Show("Password has been sent to your provided email and mobile number"); } }
protected void Button2_Click(object sender, EventArgs e) { sms s = new sms(); int z = 0; for (int i = 0; i < GridView1.Rows.Count; i++) { CheckBox c = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1"); Label m = (Label)GridView1.Rows[i].FindControl("Label2"); if (c.Checked == true) { s.SendSMS(m.Text, TextBox1.Text); z = 1; } } if (z == 1) { TextBox1.Text = ""; msg.Show("SMS sent successfully"); } else { msg.Show("Select users"); } }
protected void Button1_Click(object sender, EventArgs e) { sms s = new sms(); s.SendSMS(Label6.Text, TextBox1.Text); MessageBox msg = new MessageBox(); TextBox1.Text = ""; msg.Show("SMS sent successfully"); }
public IActionResult Create(sms sms, string returnUrl = null) { if (ModelState.IsValid) { this.repository.AddEntity(sms); return(RedirectToLocal(returnUrl)); } ViewData["ParentId"] = sms.hookId; ViewData["ReturnUrl"] = returnUrl; return(View(sms)); }
public void LoginToWay2Sms() { using (SqlCommand cmd = new SqlCommand("FetchSMSSettings", Db.DbConnect())) { cmd.CommandType = CommandType.StoredProcedure; SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { ResultSmsObject = new sms(api, rdr["username"].ToString(), rdr["password"].ToString()); } } }
/// <summary> /// /// </summary> private void publishFromBench() { this.doShareStatus("Starting publishing...", common.logger.logLevel.Information); sms[] localSetOfSMSToSend = null; while (true) { if (!this.instMre.WaitOne(new TimeSpan(0, 0, 5))) { continue; } //* Collecting set of sms to publish lock (this.smsBench) { if (this.smsBench.Count == 0) { this.doShareStatus("SMS bench found empty", common.logger.logLevel.Information); this.instMre.Reset(); this.doShareStatus("SMS publishing halted!", common.logger.logLevel.Information); localSetOfSMSToSend = null; continue; } else { if (localSetOfSMSToSend == null) { this.doShareStatus("SMS publishing started...", common.logger.logLevel.Information); } int presentBatchSize = this.smsBench.Count >= 10 ? 10 : this.smsBench.Count; localSetOfSMSToSend = new sms[presentBatchSize]; this.smsBench.CopyTo(0, localSetOfSMSToSend, 0, presentBatchSize); this.smsBench.RemoveRange(0, presentBatchSize); } } if (localSetOfSMSToSend != null) { IModem instModem = null; for (int indx = 0; indx < localSetOfSMSToSend.Length; indx++) { instModem = transports.modemPool.getModem(); instModem.sendSms(localSetOfSMSToSend[indx]); //this.doPublishedSMS(instModem, localSetOfSMSToSend[ indx ]); } } } }
protected void Button1_Click(object sender, EventArgs e) { string account = this.Txtaccount.Text.Trim(); string password = this.Txtpassword.Text.Trim();//密码可以使用明文密码或使用32位MD5加密 string mobile = this.Txtmobile.Text.Trim(); string content = this.Txtcontent.Text.Trim(); sms sms1 = new sms(); SubmitResult SubmitResult1 = sms1.Submit(account, password, mobile, content); this.LabelRetMsg.Text = "<br>code:" + SubmitResult1.code + "<br>msg:" + SubmitResult1.msg; //Response.Write("<br>code:" + SubmitResult1.code + "<br>msg:" + SubmitResult1.msg); }
public void SMS() { MainWindow mainWindow = new MainWindow(); string testHeader = "S123456789"; string testBody = "+123123123 This is my test body with a ROTFL textspeak example"; mainWindow.sortMessageType(testHeader, testBody); sms smsAsset = new sms(); mainWindow.assignAttributes(smsAsset, testBody); mainWindow.removeTextspeak(smsAsset); Assert.AreEqual(smsAsset.Sender, "+123123123"); Assert.AreEqual(smsAsset.Body, "This is my test body with a ROTFL <Rolling on the floor laughing> textspeak example"); }
protected void Page_Load(object sender, EventArgs e) { c = new Customers(); c = (Customers)Session["myCustomer"]; movies = (List <Movies>)Session["myMovies"]; addOrder(); sms s = new sms(); s.Sendsms(c.Phone, "Your order att MovieStore have been mabe and payed"); string emailCustomer = c.Email; System.Diagnostics.Debug.WriteLine("sending mail to" + emailCustomer); sendEmail email = new sendEmail(); email.booking_mail(emailCustomer); }
public IActionResult Edit(int id, sms sms, string returnUrl = null) { if (id != sms.id) { return(NotFound()); } if (ModelState.IsValid) { this.repository.UpdateEntity(sms); return(RedirectToLocal(returnUrl)); } ViewData["ReturnUrl"] = returnUrl; return(View(sms)); }
public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, TraceWriter log) { string target = req.GetQueryNameValuePairs() .FirstOrDefault(q => string.Compare(q.Key, "target", true) == 0) .Value; string action = req.GetQueryNameValuePairs() .FirstOrDefault(q => string.Compare(q.Key, "action", true) == 0) .Value; string validation_string = utilitles.RandomString(8); //string action = "unlock"; //+972587559289 sms unlock_signal = new sms(action, target, validation_string); unlock_signal.send(); return(req.CreateResponse(HttpStatusCode.OK, unlock_signal._last_response + "code: " + validation_string)); }
//private bool setModemTextSMSReady() { // lock(this) { // if(this.instPort != null) { // //this.mreModemOperation.Set(); // //this.instPort.WriteLine("AT" + (char)(13)); // //Thread.Sleep(4); // //this.instPort.WriteLine("AT+CMGF=1" + (char)(13)); // //Thread.Sleep(5); // this.instPort.WriteLine("AT+CMGF=1" + (char)(13)); // Thread.Sleep(5); // //string strData = string.Empty; // //if(this.mreModemOperation.WaitOne(this.modemOperationTimeOut)) { // // strData = this.instPort.ReadExisting(); // //} // //if(strData == string.Empty) { // // return false; // //} // } // } // return false; //} /// <summary> /// /// </summary> /// <param name="sms"></param> public void sendSms(sms sms) { lock (this) { try { //this.instPort.RtsEnable = false; //* Disabling SMS Receiving this.resetSignalCheckerTimer(false); if (this.instPort != null && this.instPort.IsOpen) { string strData = string.Empty; sms.status = smsStatus.FailedToSent; this.modemResponseBuffer = this.instPort.ReadExisting(); if (this.executeATCommandWithoutLock(ATCommands.AT, this.OK, out this.modemResponseBuffer)) { this.modemResponseBuffer = this.instPort.ReadExisting(); if (this.executeATCommandWithoutLock(ATCommands.ATCMGF_TextMode, this.OK, out this.modemResponseBuffer)) { this.modemResponseBuffer = this.instPort.ReadExisting(); if (this.executeATCommandWithoutLock("AT+CMGS=\"" + sms.mobileNo + "\"" + (char)(13), ">", out this.modemResponseBuffer)) { if (this.executeATCommandWithoutLock((char)(8) + sms.message + (char)(26) + (char)(13), this.OK, out this.modemResponseBuffer)) { sms.status = smsStatus.Sent; } } } } } else { sms.status = smsStatus.None; } } finally { if (this.smsSent != null) { this.smsSent(this, sms); } this.disposeSyncObjectOfModemResponse(); this.resetSignalCheckerTimer(true); //this.instPort.RtsEnable = true; } } }
static void Main(string[] args) { SchoolGroup sg = new SchoolGroup(); CollegeGroup cg = new CollegeGroup(); DeloitteGroup dg = new DeloitteGroup(); sms sms = sg.message; sms += cg.message; sms += dg.message; sms("Good morning"); sms -= cg.message; sms -= sg.message; sms("Alumini meeting at college auditorium on saterday"); sms += dg.message; sms -= cg.message; sms("dotnet stream traing starting on 18/7"); }
public void BindSmsSettingsToControl() { using (SqlCommand cmd = new SqlCommand("FetchSMSSettings", db.DbConnect())) { cmd.CommandType = CommandType.StoredProcedure; SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { lblUsernameSms.Text = rdr["username"].ToString(); lblPasswordSms.Text = rdr["password"].ToString(); tbUsernameSms.Text = rdr["username"].ToString(); tbPasswordSms.Text = rdr["password"].ToString(); tbSender.Text = rdr["username"].ToString(); //create and load the sms settings TestSmsSetting = new sms(apikey, rdr["username"].ToString(), rdr["password"].ToString()); } } }
public bool SmsKaydet(sms model) { try { _smsRepository.Insert(model); if (_uow.SaveChanges() > 0) { return(true); } else { return(false); } } catch (Exception) { throw; } }
private void SendSmsAndMail(shop shop, transaction_category tran, debt debt, debt_transaction dtran, debt_lodgement_reimbursment newmlr) { try { bool mailvalidity = new Utilities.Mail_Validity_Helper().getMailSendingStatus(); SMS_Vendor_Validity_Helper valhelp = new SMS_Vendor_Validity_Helper(); sms_vendor vendor = valhelp.getVendorsByName("50kobo"); bool smsvalidity = (DateTime.Today <= vendor.expiry_date) ? true : false; if (shop.agent != null) { sms message; if (tran.code == "DL") { if (smsvalidity) { sm mm = new CRUD.sms_crud().findByCode("DL"); message = new sms(); if (message.initializeDebtParameters(shop, debt, dtran, newmlr, mm.subject.Trim() + "\r\n" + mm.content.Trim() + "\r\n" + mm.conclusion.Trim())) { message.CustomizeAndSendSMS(); } } if (mailvalidity) { mail mail = new CRUD.mail_crud().findByCode("DL"); MailClient client = new MailClient(); client.SendDebtLodgement(shop, mail, debt, dtran); } } } } catch (Exception) { } }
public ActionResult BorcSmsKaydet(sms model) { model.tarih = DateTime.Now.ToString("yyyy-MM-dd"); string mesaj = model.icerik; string gonMesaj = Fonksiyonlar.tr2en(mesaj); string gonderimzanani = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); try { var borcluListesi = _borclandirmaService.TumBorcListesi(); foreach (var item in borcluListesi) { var tel = _kisilerService.KisiGetirId(item.kisi_id).tel1; model.kisi_id = item.kisi_id; model.tel = tel; // _smsService.SmsKaydet(model); var telparIlk = tel.Replace("(", ""); var telParSon = telparIlk.Replace(")", ""); var telTire = telParSon.Replace("-", ""); var telefon = telTire; numaralar.Add(telefon); } sms.singlesmsgonder("BETOYAZILIM", gonMesaj, "tr", "0", gonderimzanani, numaralar); } catch (Exception) { return(Json(false, JsonRequestBehavior.AllowGet)); } return(Json(true, JsonRequestBehavior.AllowGet)); }
/// <summary> /// /// </summary> /// <param name="modem"></param> /// <param name="state"></param> private void modemSmsEventHandler(IModem modem, sms smsEntity) { this.doPublishedSMS(modem, smsEntity); }
public IActionResult New(web_db._Weighing.TblContractType.KindCotractTypeEnum Kind, web_CusDB.tblReqContractRow model, List <Guid> Product, List <Guid> Packing) { var dbweb = new web_db.sardweb_Context(); if (Kind == web_db._Weighing.TblContractType.KindCotractTypeEnum.ASardKhane) { if (!Product.Any()) { ModelState.AddModelError("CodeMahsuls", "محصولات انتخاب نشده است"); } if (!Packing.Any()) { ModelState.AddModelError("CodeMahsuls", "سبد انتخاب نشده است"); } } else if (Kind == web_db._Weighing.TblContractType.KindCotractTypeEnum.ASabad) { if (!Packing.Any()) { ModelState.AddModelError("CodeMahsuls", "سبد انتخاب نشده است"); } } if (model.WeightCount < 10) { ModelState.AddModelError("WeightCount", "مقدار اشتباه است"); } if (ModelState.IsValid) { var db = new web_CusDB.db_Context(); var row = new web_CusDB.tblReqContract { Code = (db.tblReqContracts.Max(a => (long?)a.Code) ?? 0) + 1, DateAdd = DateTime.Now, DateLast = DateTime.Now, Id = Guid.NewGuid(), KindContract = Kind, tblCusId = User._getuserId().Value, }; db.tblReqContracts.Add(row); var p = new List <Guid>(); p.AddRange(Product); p.AddRange(Packing); var z = dbweb.TblProducts.Where(a => Product.Contains(a.Id)).Select(a => a.Title).ToList(); z.AddRange(dbweb.TblPackings.Where(a => Packing.Contains(a.Id)).Select(a => a.Title).ToList()); db.tblReqContractRows.Add(new web_CusDB.tblReqContractRow { CodeMahsuls = p.ToJson(), Date = row.DateLast, Id = Guid.NewGuid(), Vaziat = web_CusDB.tblReqContractRow.ResEnum.Save, WeightCount = model.WeightCount, TblReqContractId = row.Id, Mahsuls = string.Join(',', z) }); db.SaveChanges(); var dbmain = new web_db.sardweb_Context(); sms sms = new sms() { numfrom = dbmain.TblConf.SingleOrDefault(a => a.Key == web_db.TblConf.KeyEnum.Main_NumSms).Value, password = dbmain.TblConf.SingleOrDefault(a => a.Key == web_db.TblConf.KeyEnum.Main_PassSms).Value, username = dbmain.TblConf.SingleOrDefault(a => a.Key == web_db.TblConf.KeyEnum.Main_UserSms).Value, }; var us = db.TblCustomers.Find(User._getuserId().Value); sms.sendsmsAsync(us.Mob, (dbmain.TblConf.SingleOrDefault(a => a.Key == web_db.TblConf.KeyEnum.Main_SherkatName) ?? new web_db.TblConf()).Value + @$ " درخواست شما با کد " + row.Code.ToString() + " ثبت گردید"); return(RedirectToAction("Index")); } if (Kind == web_db._Weighing.TblContractType.KindCotractTypeEnum.ASardKhane) { ViewBag.listPacking = dbweb.TblPackings.AsEnumerable().Where(a => a.ForContractType().Contains(web_db._Weighing.TblContractType.KindCotractTypeEnum.ASardKhane) && a.IsActive == true) .OrderBy(a => a.Code).ToList(); } else if (Kind == web_db._Weighing.TblContractType.KindCotractTypeEnum.ASabad) { ViewBag.listPacking = dbweb.TblPackings.AsEnumerable().Where(a => a.ForContractType().Contains(web_db._Weighing.TblContractType.KindCotractTypeEnum.ASabad) && a.IsActive == true) .OrderBy(a => a.Code).ToList(); } ViewBag.listProduct = dbweb.TblProducts.Where(a => a.IsActive).OrderBy(a => a.Ord).ToList(); ViewBag.US_WeightMax = (dbweb.TblConf.SingleOrDefault(a => a.Key == web_db.TblConf.KeyEnum.US_WeightMax) ?? new web_db.TblConf()).Value; ViewBag.US_WeightMin = (dbweb.TblConf.SingleOrDefault(a => a.Key == web_db.TblConf.KeyEnum.US_WeightMin) ?? new web_db.TblConf()).Value; ViewBag.US_WeightVahed = (dbweb.TblConf.SingleOrDefault(a => a.Key == web_db.TblConf.KeyEnum.US_WeightVahed) ?? new web_db.TblConf()).Value; ViewBag.US_WeightZarib = (dbweb.TblConf.SingleOrDefault(a => a.Key == web_db.TblConf.KeyEnum.US_WeightZarib) ?? new web_db.TblConf()).Value; ViewBag.Kind = Kind; var Kinds = dbweb.TblContractTypes.Where(a => a.FkSalmali == dbweb.TblSalMalis.SingleOrDefault(a => a.IsOpen && a.IsOrginal).Id).Select(a => a.KindCotractType).Distinct().ToList(); Kinds.Remove(web_db._Weighing.TblContractType.KindCotractTypeEnum.ABaskul); ViewBag.kinds = Kinds; return(View(model)); }
/// <summary> /// 新建 /// </summary> public void Addsms(sms sms) { //sms.SMSId= new aers_sys_seedSqlMapDao().GetMaxID("sms"); ExecuteInsert("Insertsms", sms); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string s = Request.Form["responseparams"]; string[] param = s.Split('|'); Label2.Text = param[0].ToString(); Label3.Text = param[5].ToString(); Label4.Text = param[6].ToString(); MembershipUser memb = Membership.GetUser(Profile.UserName); string userid = ""; try { userid = memb.ProviderUserKey.ToString(); } catch (Exception ex) { Response.Redirect("Login.aspx"); } DataSet ds = or.select_order(userid); string name = ds.Tables[0].Rows[0]["firstname"].ToString(); string address = ds.Tables[0].Rows[0]["address"].ToString(); string city = ds.Tables[0].Rows[0]["city"].ToString(); string state = ds.Tables[0].Rows[0]["state"].ToString(); string email = ds.Tables[0].Rows[0]["email"].ToString(); string mobile = ds.Tables[0].Rows[0]["mobile"].ToString(); string ship_name = ds.Tables[0].Rows[0]["delivery_firstname"].ToString(); string ship_address = ds.Tables[0].Rows[0]["delivery_address"].ToString(); string ship_city = ds.Tables[0].Rows[0]["delivery_city"].ToString(); string ship_state = ds.Tables[0].Rows[0]["delivery_state"].ToString(); string ship_email = ds.Tables[0].Rows[0]["delivery_email"].ToString(); string ship_mobile = ds.Tables[0].Rows[0]["delivery_mobile"].ToString(); //email to delivery address string msg = "Dear " + ship_name + ", An order for prawn from " + name + " account of amount Rs." + Label4.Text + " has been marked as unsuccessfull. Order id is " + Label3.Text + " and direcpay reference id " + Label2.Text; em.mymail(ship_email, msg, "Order Unsuccessfull"); string msg1 = "Dear " + name + ", " + "An order made for " + ship_name + " from your farmfreshprawns account of amount Rs." + Label4.Text + " has been marked as unsuccessfull. Order id is " + Label3.Text + " and direcpay reference id " + Label2.Text; //email to billing address em.mymail(email, msg1, "Order Unsuccessfull"); sms sm = new sms(); sm.SendSMS(mobile, msg1); string adminmobile = sms.adminsms; string adminemail = sms.adminemail; string adminmessage = "Dear Admin, New order placed from " + name + "for amount of Rs." + Label4.Text + ". has been marked as unsuccessfull. Order id is " + Label3.Text + " and DirecPay reference id is " + Label2.Text; em.mymail(adminemail, adminmessage, "Order Unsuccessfull"); sm.SendSMS(adminmobile, adminmessage); Profile.prawncrunchShopping.Items.Clear(); } }
/// <summary> /// 修改 /// </summary> public void Updatesms(sms sms) { ExecuteUpdate("Updatesms", sms); }
private void btnSend_Click(object sender, RoutedEventArgs e) { try { //read in message from input string header = txtHeader.Text; string body = txtBody.Text; if (txtHeader.Text != "" || txtBody.Text != "") { if (!txtBody.Text.Contains(" ")) { throw new Exception("Please ensure there is a space between the sender and the main body text."); } //determine message type string type = sortMessageType(header, body); if (type == null) { MessageBox.Show("Message type could not be determined. Check header."); } List <message> msgList = new List <message>(); switch (type) { case "E": email emailAsset = new email(); //assign sender and body text to message assignAttributes(emailAsset, body); assignId(emailAsset); List <string> incidents = new List <string>(); sirList SIRList = new sirList(); //fill list of registered incidents incidents = createIncidentList(incidents); assignEmailSubject(emailAsset, incidents, SIRList); urlQuarantinedList quarantinedList = new urlQuarantinedList(); removeUrls(emailAsset, quarantinedList); //display details on UI emailDisplay(SIRList, quarantinedList); serialiser(emailAsset, msgList); break; case "T": tweet tweetAsset = new tweet(); //assign sender and body text to message assignAttributes(tweetAsset, body); assignId(tweetAsset); removeTextspeak(tweetAsset); trendingList trending = new trendingList(); detectHashtags(tweetAsset, trending); mentionsList mentions = new mentionsList(); detectMentions(tweetAsset, mentions); tweetDisplay(tweetAsset, trending, mentions); serialiser(tweetAsset, msgList); break; case "S": sms smsAsset = new sms(); //assign sender and body text to message assignAttributes(smsAsset, body); assignId(smsAsset); //identify textspeak and add extension of it removeTextspeak(smsAsset); serialiser(smsAsset, msgList); break; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public ActionResult KaydetIslem(sms model, string tip) { model.tarih = DateTime.Now.ToString("yyyy-MM-dd"); try { string mesaj = model.icerik; string gonMesaj = Fonksiyonlar.tr2en(mesaj); string gonderimzanani = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (tip == "kisi") { var telparIlk = model.tel.Replace("(", ""); var telParSon = telparIlk.Replace(")", ""); var telTire = telParSon.Replace("-", ""); // _smsService.SmsKaydet(model); var telefon = telTire; numaralar.Add(telefon); } if (tip == "katmaliki") { var katMalikiListe = _kisilerService.KatmalikiListesi(); foreach (var item in katMalikiListe) { var tel = _kisilerService.KisiGetirId(item.kisi_id).tel1; model.kisi_id = item.kisi_id; model.tel = tel; //_smsService.SmsKaydet(model); var telparIlk = tel.Replace("(", ""); var telParSon = telparIlk.Replace(")", ""); var telTire = telParSon.Replace("-", ""); var telefon = telTire; numaralar.Add(telefon); } } if (tip == "kiraci") { var kiraciListe = _kisilerService.KiraciListesi(); foreach (var item in kiraciListe) { var tel = _kisilerService.KisiGetirId(item.kisi_id).tel1; model.kisi_id = item.kisi_id; model.tel = tel; //_smsService.SmsKaydet(model); var telparIlk = tel.Replace("(", ""); var telParSon = telparIlk.Replace(")", ""); var telTire = telParSon.Replace("-", ""); var telefon = telTire; numaralar.Add(telefon); } } sms.singlesmsgonder("BETOYAZILIM", gonMesaj, "tr", "0", gonderimzanani, numaralar); } catch (Exception) { return(Json(false, JsonRequestBehavior.AllowGet)); } return(Json(true, JsonRequestBehavior.AllowGet)); }
public static string Send_Message_Short(string msg, string phone, int type = 0) { string result = "ok"; //禁止浏览器直接访问ajax页面 if (HttpContext.Current.Request.UrlReferrer.Host != HttpContext.Current.Request.Url.Host) { HttpContext.Current.Response.Redirect("/404"); } else { string send_type = ConfigHelper.GetConfigString("Short_Message"); if (type == 1) { send_type = "zhiqingwangluo"; } //志晴网络 if (send_type == "zhiqingwangluo") { #region 志晴网络短信 ShortMessageService sms = new ShortMessageService(); result = sms.sendmessage(msg + "【X职 场】", phone); result = result.Replace("</int>", ""); result = result.Substring(result.LastIndexOf(">") + 1); if (result == "0") { result = "ok"; } else { result = "1"; } #endregion } else//华亿无线 { #region 华亿无线短信 //shortMessageWord = "您的验证码是:" + code + "。请不要把验证码泄露给其他人。";//shortMessageWord; sms sms1 = new sms(); DateTime dtn = DateTime.Now; int minute_one = 0; int cnt = 0; int cntip = 0; //是否在做活动,0:否,1:是 int IsActive_Now = ConfigHelper.GetConfigInt("IsActive_Now"); //当天发送的总记录数 int send_total_cnt = 0; #region 验证是否1分钟之内重复发送 try { minute_one = Convert.ToInt32(DbHelperSQL.GetSingle("select count(*) as cnt from HRENH_SEND_TEL_CODE where tel='" + phone + "' and datediff(ss,addtime,'" + dtn + "')<=60 and datediff(ss,addtime,'" + dtn + "')>=0").ToString()); } catch (Exception ex) { } #endregion if (minute_one > 0) { result = "one"; } else { //验证手机号格式是否正确 //(13[0-9]{9})|(15[0-9]{9})|(170[0-9]{8})|(176[0-9]{8})|(177[0-9]{8})|(178[0-9]{8})|(18[0-9]{9}) bool f = System.Text.RegularExpressions.Regex.IsMatch(phone, @"^(13[0-9]{9})|(15[0-9]{9})|(170[0-9]{8})|(176[0-9]{8})|(177[0-9]{8})|(178[0-9]{8})|(18[0-9]{9})"); if (!f) { result = "1"; } else { #region 添加发送记录并验证是否已经发送超过5次 try { DbHelperSQL.ExecuteSql("insert into HRENH_SEND_TEL_CODE(tel,num,addtime,ip) values('" + phone + "',1,'" + dtn + "','" + RequestHelper.GetIP() + "')"); } catch (Exception ex) { } try { cnt = Convert.ToInt32(DbHelperSQL.GetSingle("select (isnull((select count(*) from THINK_SNS_DB.DBO.HRENH_SEND_TEL_CODE where tel='" + phone + "'),0)+isnull((select count(*) from Reds_Parliament.DBO.HRENH_SEND_TEL_CODE where tel='" + phone + "'),0)) as cnt").ToString()); } catch (Exception ex) { cnt = 0; } try { send_total_cnt = Convert.ToInt32(DbHelperSQL.GetSingle("select (isnull((select count(*) from THINK_SNS_DB.DBO.HRENH_SEND_TEL_CODE),0)+isnull((select count(*) from Reds_Parliament.DBO.HRENH_SEND_TEL_CODE),0)) as cnt").ToString()); } catch (Exception ex) { } #region 一个IP每天只能发送10次记录 try { cntip = Convert.ToInt32(DbHelperSQL.GetSingle("select (isnull((select count(*) from THINK_SNS_DB.DBO.HRENH_SEND_TEL_CODE where ip='" + RequestHelper.GetIP() + "'),0)+isnull((select count(*) from Reds_Parliament.DBO.HRENH_SEND_TEL_CODE where ip='" + RequestHelper.GetIP() + "'),0)) as cnt").ToString()); } catch (Exception ex) { } if (cntip <= 10) { #region 添加发送记录并验证是否已经发送超过5次 if (cnt > 5) { result = "5"; } else { #region 发送验证码 if (IsActive_Now == 0) { if (send_total_cnt <= 1000) { SubmitResult SubmitResult1 = sms1.Submit("", "", phone, msg); result = SubmitResult1.code.ToString(); string result_msg = SubmitResult1.msg; if (result == "2") { result = "ok"; } else if (result_msg.IndexOf("5") >= 0) { result = "5"; } else { result = "1"; } } else { #region 当天发送的短信的条数大于1000则发送通知给孙传、子龙和我 try { if (send_total_cnt == 1001) { string more_100 = "衣品搭配系统提示今日:衣品搭配发送短信数已超过1000条,请即时查看。"; //孙伟 SubmitResult SubmitResult1000 = sms1.Submit("", "", "18600863778", more_100); //子龙 SubmitResult1000 = sms1.Submit("", "", "15831601607", more_100); //我 SubmitResult1000 = sms1.Submit("", "", "13426021774", more_100); } } catch (Exception ex) { } #endregion result = "1"; } } else { SubmitResult SubmitResult1 = sms1.Submit("", "", phone, msg); result = SubmitResult1.code.ToString(); string result_msg = SubmitResult1.msg; if (result == "2") { result = "ok"; } else if (result_msg.IndexOf("5") >= 0) { result = "5"; } else { result = "1"; } } #endregion } #endregion } else { result = "10"; } #endregion #endregion #region 添加发送记录,生成txt文档 string[] error_msg_arr = { "1分钟:" + minute_one, "发送次数:" + cnt, "同一个IP的发送次数:" + cntip, "返回结果(result):" + result }; Message.WriteError(phone, "发送短信验证码,IP:" + RequestHelper.GetIP(), "register_PC", error_msg_arr); #endregion } } #endregion } } return(result); }