public bool DeleteSMS(SMS entity) { if (entity == null) return false; _unitOfWork.SMSRepository.Delete(entity); _unitOfWork.Save(); return true; }
static void Main(string[] args) { UsbManager manager = UsbManager.getInstance(new Utilities()); try { if (manager.connect()) { while(true) { Console.WriteLine("Ecrivez votre message :"); string msg = Console.ReadLine(); Contact c = new Contact("Adrien", "0647657049"); if (!string.IsNullOrEmpty(msg)) { SMS sms = new SMS(msg, c); manager.send(sms); } Console.WriteLine("Message envoyé !"); } } else { Console.WriteLine("Aucun téléphone connecté !"); } } catch (Exception e) { Console.WriteLine("Exception occured : {0}", e); } }
protected void Page_Load(object sender, EventArgs e) { ChannelSerial channel =new ChannelSerial(); //下发验证码 try { string strMsg = ""; strMsg = Common.GetReqStrValue("msg"); SMS sms = new SMS(); channel = new ChannelSerial(); channel.PortName = "COM4"; if (channel.Open() == false) { Response.Write("-101"); Response.End(); } sms.CenterNo = "8613800571500"; sms.Channel = channel; sms.SendMessage(Common.GetReqStrValue("tel"), strMsg); channel.Close(); } catch { channel.Close(); Response.Write("-102"); Response.End(); } Response.Write("0"); Response.End(); }
public string SMS(string tel) { SMS sms = new SMS(); sms.SendCode(tel); return sms.ErrorMessage; }
public ActionResult LogOn(SMS.UI.Mvc3.Models.tb_User model) { //bool sucess = false; string message = string.Empty; if (ModelState.IsValid) { tb_User user = SMS.UI.Mvc3.Models.SMSModel.GetOneUserEntity(model.UserName); if (user!=null) { FormsAuthentication.SetAuthCookie(user.UserName.ToString(), false); return RedirectToAction("Default", "Books"); } else { // 如果我们进行到这一步时某个地方出错,则重新显示表单 return View(model); } } // 如果我们进行到这一步时某个地方出错,则重新显示表单 return View(model); //return Json(new //{ // Succeed = sucess, // ErrorInfo = message //}, JsonRequestBehavior.AllowGet); }
static void Main(string[] args) { SMS a = new SMS(); System.Console.Out.WriteLine(a.compress(" I like your style ")); System.Console.In.ReadLine(); // // TODO: Add code to start application here // }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary>SMS sending process.</summary> /// <param name="destination">The address of the recipient of the message.</param> /// <param name="text">The message text to send.</param> /// <param name="originAddress">The sender's phone Number</param> /// <param name="xChargedId">The phone number of the api payer. If not indicated, the payer will be the sender.</param> /// <param name="senderName">Human-readable text for remitent.</param> /// <param name="endpoint">String which contains the endpoint where status notifications will be sent.</param> /// <param name="correlator">The correlator for the status notifications.</param> /// <returns>It returns a String containing the smsId of the SMS sent. To poll for delivery status.</returns> //////////////////////////////////////////////////////////////////////////////////////////////////// protected string SendProcess(string[] destination, string text, SMS.Schemas.UserIdType originAddress , string xChargedId, string senderName , string endpoint, string correlator) { SMSTextType smsTextType=null; SimpleReferenceType reference=null; if (destination == null || destination.Length <= 0) { throw new BlueviaException("Null destination when sending SMS." , ExceptionCode.InvalidArgumentException); } if (string.IsNullOrWhiteSpace(text)) { throw new BlueviaException("Null or Empty text when sending MMS." , ExceptionCode.InvalidArgumentException); } if(!string.IsNullOrEmpty(endpoint)&&!string.IsNullOrEmpty(correlator))//Both endpoint and correlator arent null nor empty { reference= new SimpleReferenceType(){endpoint=endpoint,correlator=correlator}; } else if(!(string.IsNullOrEmpty(endpoint)&&string.IsNullOrEmpty(correlator)))//One of enpoint or correlator is null or empty { throw new BlueviaException("Both endpoint and correlator parameters,are mandatory when sending message for status notifications." , ExceptionCode.InvalidArgumentException); } //Building the object wich will be serialized to serve as body smsTextType = SMSTools.CreateSMSTextType(text, originAddress, senderName, reference, destination); Dictionary<string,string> headers = CreateHeaders(HttpTools.ContetTypeXML); if(!string.IsNullOrEmpty(xChargedId)) { headers.Add(Messagery.Constants.XChargedKey,xChargedId); } //Selecting the apropiate parser/serializer for the operation: serializer = xmlSerializer; parser = null; BaseCreate<string, SMSTextType>( string.Format(url, Constants.SMSMessageMT_Send) , CreateParameters() , smsTextType , headers); //As the usefull info of the response isnt in the body, //lets look for it in the Location header of the response string statusUrl = null; response.GetResponseHeaders().TryGetValue("Location", out statusUrl); string[] parts = statusUrl.Split(new Char[] { '/' }); //And return only the statusId return parts[8]; }
// // GET: /Essemess/ public ActionResult Index(string id) { //SMS.Send("mama speaking", 4797177229, 4741800072); SMS sms = new SMS(); //String jsonresult = SMS.Get(4799104626); //SMS sms = JsonConvert.DeserializeObject<SMS>(jsonresult); ViewBag.mama = HttpUtility.UrlEncode(id); return View(sms); }
public ActionResult Register(SMS.Entities.User model) { if (ModelState.IsValid) { db.Users.Add(model); db.SaveChanges(); return RedirectToAction("Default","Books"); } // 如果我们进行到这一步时某个地方出错,则重新显示表单 return View(model); }
protected void btnGetCode_Click(object sender, EventArgs e) { string to = Session["FP_userName"].ToString(); SMS sms = new SMS(); sms.SendCode(to); Tick = 120; if (sms.ErrorMessage == "成功") lbSMS.Text = "短信验证已发送(10分钟内有效)。"; else lbSMS.Text = sms.ErrorMessage; }
public void ShowSMSList(SMS.MessageCollection smsCollection) { lvSMS.Items.Clear(); for (int i=0;i<smsCollection.Count;i++) { lvSMS.Items.Add(new ListViewItem(new string[]{i.ToString(), smsCollection[i].DBID.ToString(), smsCollection[i].MessageStatus.ToString(), smsCollection[i].Address.ToString(), smsCollection[i].ReceiveTime.ToString("yyyy-MM-dd HH:mm:ss"), smsCollection[i].MessageText})); } lvSMS.Refresh(); }
public string GetSmsCode(string mobile, string code) { try { if (code.Trim().ToUpper() != HttpContext.Current.Session["verificationCode"].ToString()) return "0"; SMS sms = new SMS(); sms.SendCode(mobile); return sms.ErrorMessage; } catch (Exception ex) { return ex.ToString(); } }
public string Get(string id) { try { if (id.Trim().ToUpper() != HttpContext.Current.Session["verificationCode"].ToString()) { return "0"; } SMS sms = new SMS(); sms.SendCode(Security.UserMobile); return sms.ErrorMessage; } catch (Exception) { } return "发送失败"; }
public string ParseSMS(SMS sms) { string subgroup = ""; string answer = ""; List<string> parts = sms.Text.Split(new string[] { " " } , StringSplitOptions.RemoveEmptyEntries).ToList(); if (parts[0].ToLower() != ServicePrefix.Timetable) { return string.Empty; } var usr = userList.Find(u => u.PhoneNumber == sms.Sender); if (usr != null) { subgroup = usr.Subgroup; } answer = timeTable.GetTodayLessons(subgroup); return answer; }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary>Funtion to build a full SMSTextType, from simple fields.</summary> /// <param name="text">The message text to send.</param> /// <param name="originAddress">The sender's phone Number.</param> /// <param name="senderName">Human-readable text for remitent.</param> /// <param name="reference">The Endpoint and correlator in a complex object.</param> /// <param name="destination">Array of address of the recipients of the message.</param> /// <returns>A SMSTextType, ready to be serialized and sent.</returns> //////////////////////////////////////////////////////////////////////////////////////////////////// public static Schemas.SMSTextType CreateSMSTextType(string text, SMS.Schemas.UserIdType originAddress , string senderName, SMS.Schemas.SimpleReferenceType reference, string[] destination) { List<SMS.Schemas.UserIdType> destinationsList = new List<SMS.Schemas.UserIdType>(); foreach (string dest in destination) { Core.Tools.Extension.checkIsNumber(dest, "destination"); destinationsList.Add(new SMS.Schemas.UserIdType() { Item = dest , ItemElementName = SMS.Schemas.ItemChoiceType1.phoneNumber }); } Schemas.SMSTextType smsTextType = new Schemas.SMSTextType(); smsTextType.address = destinationsList.ToArray(); smsTextType.originAddress = originAddress; smsTextType.message = text; smsTextType.senderName = senderName; smsTextType.receiptRequest = reference; return smsTextType; }
/// <summary> /// Add the message to the conversation /// </summary> /// <param name="sms"></param> public void smsReceived(SMS sms) { // Do something to notify }
public void SendOneSMS_Response_Matches_Send() { Clockwork.API api = new API(key); List<SMS> smsList = new List<SMS>(); SMS sms = new SMS { To = "441234567891", Message = "Hello World" }; smsList.Add(sms); List<SMSResult> result = api.Send(smsList); Assert.AreSame(sms, result[0].SMS); }
protected void btnGetCode1_Click(object sender, EventArgs e) { string to = phone; //判断字符串是否为数字 Int64 num = 0; if (!Int64.TryParse(to, out num)) { lbSMS1.Text = "提示:请输入正确的手机号。"; return; } string code = verificationCode1.Text.Trim().ToUpper(); if (code == HttpContext.Current.Session["verificationCode"].ToString()) { SMS sms = new SMS(); sms.SendCode(to); Tick = 120; Session["TickValidityTime"] = DateTime.Now.AddMinutes(2); if (sms.ErrorMessage == "成功") lbSMS1.Text = "短信验证已发送(10分钟内有效)。"; else lbSMS1.Text = sms.ErrorMessage; } else lbSMS1.Text = "图片验证码不正确"; }
public SMS(SMS AnotherSMS) { this.Sender = AnotherSMS.Sender; this.Message = AnotherSMS.Message; this.RXTimeStamp = AnotherSMS.RXTimeStamp; }
internal static string Parse(string arg) { var method = Methods.Instance; var com = new Comm(); var settings = new Settings(); var args = arg.Contains("</lock>") ? arg.SplitArguments() : arg.ToValues().SplitArguments(); string output = string.Empty; switch (args[1]) { #region Timer case "timer": case "sleep": Thread.Sleep(Convert.ToInt32(args[2])); break; #endregion #region Serial case "serial": switch (args[2]) { case "open": if (args.Count() > 3) { SerialComm.ActivateSerialPort(args[3]); } else { SerialComm.ActivateSerialPort(string.Empty); } Thread.Sleep(50); output = string.Format("Serial port state: {0}", SerialComm.port.IsOpen); break; case "close": SerialComm.DeactivateSerialPort(); Thread.Sleep(50); output = string.Format("Serial port state: {0}", SerialComm.port.IsOpen); break; case "send": case "listen": case "monitor": if ((args[2] == "listen" || args[2] == "monitor") && args.Count() > 3) { output = SerialComm.WriteToSerialPort(string.Empty, args[2].ToTypeOfSerialMessage(), Convert.ToInt32(args[3])); } else if (args.Count() > 4) { output = SerialComm.WriteToSerialPort(args[3], args[2].ToTypeOfSerialMessage(), Convert.ToInt32(args[4])); } else { output = SerialComm.WriteToSerialPort(args[3], args[2].ToTypeOfSerialMessage()); } break; case "set": case "setup": if (args.Count() >= 4) { com.ComPort = args[3]; } if (args.Count() == 5) { com.BaudRate = args[4]; } output = method.AddToXML(com, AppStructure.SystemCommRoot); break; case "settings": output = string.Format("{0}\r\n{1}", Comm.GetComPort, Comm.GetBaudRate); break; case "state": case "status": default: output = string.Format("Serial port state: {0}", SerialComm.port.IsOpen); break; } break; #endregion #region Instruction Sets case "inset": switch (args[2]) { case "add": case "new": case "set": case "setup": var li = new List <InstructionSet>(); if (args.Count() == 5) { li.Add(new InstructionSet { Id = "*" + args[3], Action = args[4] }); li.Add(new InstructionSet { Id = args[3], Action = "*" + args[3] }); } else { li.Add(new InstructionSet { Id = "*" + args[3], Action = args[4] }); li.Add(new InstructionSet { Id = args[3], Action = "*" + args[3], Category = args[5], Header = args[6], ShortDescription = args[7], Description = args[8], ThumbnailUrl = args[9], Reference = args[10] }); } li.ForEach(item => output = method.AddToXML(item, AppStructure.SystemInstructionsRoot)); break; case "remove": case "rm": case "delete": case "del": case "kill": output = method.RemoveFromXML(args[3], AppStructure.SystemInstructionsRoot, "InstructionSet"); break; case "list": case "ls": default: XmlNodeList xList = method.GetXmlElementList(AppStructure.SystemInstructionsRoot, "InstructionSet"); foreach (XmlNode nodeItem in xList) { output += string.Format("{0}\r\n", nodeItem.OuterXml); } break; } break; #endregion #region Events case "event": switch (args[2]) { case "add": case "new": case "set": case "setup": method.AddToXML(new Event { Id = args[3], Action = args[4] }, AppStructure.SystemEventsRoot); output = method.AddToXML(new InstructionSet { Id = args[3], Action = "%~>" + args[3] + "%" }, AppStructure.SystemInstructionsRoot); break; case "remove": case "rm": case "delete": case "del": case "kill": output = method.RemoveFromXML(args[3], AppStructure.SystemEventsRoot, "event"); break; case "list": case "ls": default: XmlNodeList xList = method.GetXmlElementList(AppStructure.SystemEventsRoot, "event"); foreach (XmlNode nodeItem in xList) { output += string.Format("{0}\r\n", nodeItem.OuterXml); } break; } break; #endregion #region Trusted case "trusted": switch (args[2]) { case "settings": output = string.Format("{0}", Comm.GetTrusted); break; } break; #endregion #region TCP Socket case "socket": switch (args[2]) { case "trust": output = method.AddToXML(new Comm { Trusted = args[3] }, AppStructure.SystemCommRoot); break; case "on": case "enable": case "start": case "listen": case "open": TcpServer.Start(); Thread.Sleep(50); output = string.Format("Socket state: {0}", TcpServer.ServerState); break; case "off": case "disable": case "stop": case "close": TcpServer.Stop(); Thread.Sleep(50); output = string.Format("Socket state: {0}", TcpServer.ServerState); break; case "set": case "setup": if (args.Count() >= 4) { com.LocalHost = args[3]; } if (args.Count() == 5) { com.LocalPort = args[4]; } output = method.AddToXML(com, AppStructure.SystemCommRoot); break; case "settings": output = string.Format("{0}\r\n{1}\r\n{2}", Comm.GetLocalHost, Comm.GetLocalPort, Comm.GetTrusted); break; case "state": case "status": default: output = string.Format("Socket state: {0}", TcpServer.ServerState); break; } break; #endregion #region Webserver case "server": switch (args[2]) { case "on": case "enable": case "start": case "listen": WebServer.Start(); Thread.Sleep(50); output = string.Format("Web server state: {0}", WebServer.httplistener.IsListening); break; case "off": case "disable": case "stop": WebServer.Stop(); Thread.Sleep(50); output = string.Format("Web server state: {0}", WebServer.httplistener.IsListening); break; case "login": case "cred": case "credentials": output = settings.Save(".htaccess", string.Format("{0}\r\n{1}", args[3], args[4])); break; case "set": case "setup": if (args.Count() >= 4) { com.Hostname = args[3]; } if (args.Count() >= 5) { com.HttpPort = args[4]; } if (args.Count() == 6) { com.Authentication = args[5]; } output = method.AddToXML(com, AppStructure.SystemCommRoot); break; case "settings": output = string.Format("{0}\r\n{1}\r\n{2}", Comm.GetHostname, Comm.GetHttpPort, Comm.GetAuthentication); break; case "state": case "status": default: output = string.Format("Web server state: {0}", WebServer.httplistener.IsListening); break; } break; #endregion #region Scheduler case "schedule": switch (args[2]) { case "add": case "new": case "set": case "setup": var s = arg.Replace("judo schedule add ", string.Empty).ToSchedule(); if (s.Date == Schedule.Period.Repeat || s.Date == Schedule.Period.Interval || s.Date == Schedule.Period.Timer) { output = Schedule.Add(s, Convert.ToInt32(s.Time)); } else { output = Schedule.Add(s); } break; case "enable": case "activate": case "start": case "on": output = Schedule.ChangeStatus(args[3], Schedule.State.Enable); break; case "enable-all": case "activate-all": case "start-all": case "on-all": output = Schedule.ChangeStatus(Schedule.State.EnableAll); break; case "disable": case "deactivate": case "stop": case "off": output = Schedule.ChangeStatus(args[3], Schedule.State.Disable); break; case "disable-all": case "deactivate-all": case "stop-all": case "off-all": output = Schedule.ChangeStatus(Schedule.State.DisableAll); break; case "remove": case "rm": case "delete": case "del": output = Schedule.ChangeStatus(args[3], Schedule.State.Remove); break; case "remove-all": case "delete-all": case "del-all": case "cleanup": case "clear": case "empty": output = Schedule.ChangeStatus(Schedule.State.RemoveAll); break; case "active": case "actives": case "active-list": case "active-ls": case "list-actives": case "ls-actives": foreach (Schedule schedule in Schedule.ScheduleList) { if (schedule.Status) { output += string.Format("{0}\r\n", schedule.Name); } } break; case "inactive": case "inactives": case "inactive-list": case "inactive-ls": case "list-inactives": case "ls-inactives": foreach (Schedule schedule in Schedule.ScheduleList) { if (!schedule.Status) { output += string.Format("{0}\r\n", schedule.Name); } } break; case "names": case "name-list": case "name-ls": case "list-names": case "ls-names": foreach (Schedule schedule in Schedule.ScheduleList) { output += string.Format("{0}\r\n", schedule.Name); } break; case "active-details": case "actives-details": case "active-list-details": case "active-ls-details": case "list-actives-details": case "ls-actives-details": foreach (Schedule schedule in Schedule.ScheduleList) { if (schedule.Status) { output += string.Format( "{0} | {1} | {2} | {3} | {4}\r\n", schedule.Name, schedule.Date, schedule.Time, schedule.Action, schedule.Status.ToString().ToLower().Replace("true", "Active")); } } break; case "inactive-details": case "inactives-details": case "inactive-list-details": case "inactive-ls-details": case "list-inactives-details": case "ls-inactives-details": foreach (Schedule schedule in Schedule.ScheduleList) { if (!schedule.Status) { output += string.Format( "{0} | {1} | {2} | {3} | {4}\r\n", schedule.Name, schedule.Date, schedule.Time, schedule.Action, schedule.Status.ToString().ToLower().Replace("false", "Inactive")); } } break; case "details": case "state": case "status": case "list": case "ls": default: foreach (Schedule schedule in Schedule.ScheduleList) { if (args.Count() > 3) { if (args[3] == schedule.Name) { output += string.Format( "{0} | {1} | {2} | {3} | {4}\r\n", schedule.Name, schedule.Date, schedule.Time, schedule.Action, schedule.Status.ToString().ToLower().Replace("true", "Active") .Replace("false", "Inactive")); } } else { output += string.Format( "{0} | {1} | {2} | {3} | {4}\r\n", schedule.Name, schedule.Date, schedule.Time, schedule.Action, schedule.Status.ToString().ToLower().Replace("true", "Active") .Replace("false", "Inactive")); } } break; } break; #endregion #region Smtp case "smtp": switch (args[2]) { case "add": case "new": case "setup": case "set": output = settings.Save( ".smtpsettings", string.Format("{0}\r\n{1}\r\n{2}\r\n{3}\r\n{4}", args[3], args[4], args[5], args[6], args[7])); break; case "settings": var smtpSettings = new Mail.SmtpSettings(); output = string.Format( "{0}\r\n{1}\r\n{2}\r\n{3}\r\n{4}", smtpSettings.Host, smtpSettings.Username, smtpSettings.Password, smtpSettings.Port, smtpSettings.SSL); break; } break; #endregion #region Pop3 case "pop3": switch (args[2]) { case "add": case "new": case "setup": case "set": output = settings.Save( ".pop3settings", string.Format("{0}\r\n{1}\r\n{2}\r\n{3}\r\n{4}", args[3], args[4], args[5], args[6], args[7])); break; case "settings": var pop3Settings = new Mail.Pop3Settings(); output = string.Format( "{0}\r\n{1}\r\n{2}\r\n{3}\r\n{4}", pop3Settings.Host, pop3Settings.Username, pop3Settings.Password, pop3Settings.Port, pop3Settings.SSL); break; } break; #endregion #region Gmail case "gmail": switch (args[2]) { case "add": case "new": case "setup": case "set": output = settings.Save(".gmailsettings", string.Format("{0}\r\n{1}", args[3], args[4])); break; case "settings": var gmailSettings = new Mail.GmailSettings(); output = string.Format("{0}\r\n{1}", gmailSettings.Username, gmailSettings.Password); break; } break; #endregion #region Mail case "mail": switch (args[2]) { case "send": output = new Mail().Send( args[3], args[4], args[5], args[6]).ToString() .Replace("True", "Mail sent!").Replace("False", "Mail could not be sent"); break; } break; #endregion #region Mail Headers case "mailheaders": case "mailheader": switch (args[2]) { case "add": case "new": case "set": case "setup": output = method.AddToXML( new MailHeaders { MailFrom = args[3], MailTo = args[4], MailSubject = args[5] }, AppStructure.SystemAlertsMailHeadersRoot); break; case "settings": output = string.Format("{0}\r\n{1}\r\n{2}", MailHeaders.GetMailHeaderFrom, MailHeaders.GetMailHeaderTo, MailHeaders.GetMailHeaderSubject); break; } break; #endregion #region Sms case "sms": var sms = new SMS(); switch (args[2]) { case "add": case "new": case "setup": case "set": output = settings.Save(".smssettings", string.Format("{0}\r\n{1}\r\n{2}", args[3], args[4], args[5])); break; case "settings": output = string.Format("{0}\r\n{1}\r\n{2}", sms.API, sms.Username, sms.Password); break; case "send": output = sms.Send(args[3], args[4]); break; } break; #endregion #region Web Api case "json": switch (args[2]) { case "add": case "new": case "set": case "setup": var li = new List <InstructionSet> { new InstructionSet { Id = "*" + args[3], Action = "judo json get " + WebServer.SimpleUriEncode(args[4]) + " " + args[5] }, new InstructionSet { Id = args[3], Action = "*" + args[3] } }; li.ForEach(item => output = method.AddToXML(item, AppStructure.SystemInstructionsRoot)); break; case "get": case "response": case "consume": case "extract": output = new Helpers.Json().SelectSingleNode(WebServer.SimpleUriDecode(args[3]), args[4]); break; } break; #endregion #region Web Service case "xml": switch (args[2]) { case "add": case "new": case "set": case "setup": var li = new List <InstructionSet>(); switch (args.Count()) { case 6: li.Add(new InstructionSet { Id = "*" + args[3], Action = "judo xml get " + WebServer.SimpleUriEncode(args[4]) + " " + args[5] }); li.Add(new InstructionSet { Id = args[3], Action = "*" + args[3] }); break; case 7: li.Add(new InstructionSet { Id = "*" + args[3], Action = "judo xml get " + WebServer.SimpleUriEncode(args[4]) + " " + args[5] + " " + args[6] }); li.Add(new InstructionSet { Id = args[3], Action = "*" + args[3] }); break; case 8: li.Add(new InstructionSet { Id = "*" + args[3], Action = "judo xml get " + WebServer.SimpleUriEncode(args[4]) + " " + args[5] + " " + args[6] + " " + args[7] }); li.Add(new InstructionSet { Id = args[3], Action = "*" + args[3] }); break; } li.ForEach(item => output = method.AddToXML(item, AppStructure.SystemInstructionsRoot)); break; case "get": case "response": case "consume": case "extract": switch (args.Count()) { case 5: output = Helpers.Xml.SelectSingleNode(WebServer.SimpleUriDecode(args[3]), args[4]); break; case 6: output = args[4].Contains("=") ? Helpers.Xml.SelectNodes(WebServer.SimpleUriDecode(args[3]), args[4], args[5])[0] : Helpers.Xml.SelectSingleNode(WebServer.SimpleUriDecode(args[3]), args[4], Convert.ToInt32(args[5])); break; case 7: output = Helpers.Xml.SelectNodes(WebServer.SimpleUriDecode(args[3]), args[4], args[5])[Convert.ToInt32(args[6])]; break; } break; } break; #endregion #region Http case "http": switch (args[2]) { case "get": output = Helpers.Http.Get(WebServer.SimpleUriDecode(args[3])); break; } break; #endregion #region DynDns case "dyndns": case "ddns": case "noip": case "no-ip": var ddns = new NetInfo.DynDns(); switch (args[2]) { case "add": case "new": case "setup": case "set": output = settings.Save(".dyndnssettings", string.Format("{0}\r\n{1}\r\n{2}", args[3], args[4], args[5])); break; case "settings": output = string.Format("{0}\r\n{1}\r\n{2}", ddns.Hostname, ddns.Username, ddns.Password); break; case "update": if (args.Count() == 6) { ddns.Hostname = args[3]; ddns.Username = args[4]; ddns.Password = args[5]; NetInfo.DynDns.DynamicUpdateAsync(ddns); } else { NetInfo.DynDns.DynamicUpdateAsync(ddns); } break; } break; #endregion #region Weather case "weather": switch (args[2]) { case "add": case "new": case "set": case "setup": output = method.AddToXML(new Others { Weather = args[3] }, AppStructure.SystemOthersRoot); break; case "settings": output = Others.GetWeather; break; } break; #endregion #region Pinger case "ping": output = args.Count() == 3 ? NetInfo.SimplePing.Ping(args[2]).ToString() : NetInfo.SimplePing.Ping(args[2], Convert.ToInt32(args[3])).ToString(); break; #endregion #region Help case "help": case "?": output = args.Count() > 2 ? output = method.GetHelp(args[2]) : output = method.GetHelp("all"); break; #endregion } return(output); }
/// <summary> /// Manage what was received /// </summary> private void handle() { int index = 0; int nbComs = 0; SMS sms = null; string toHandle; ConversationManager business = new ConversationManager(); while (!m_stop) { try { toHandle = m_manager.getLastReceived(); if (!string.IsNullOrEmpty(toHandle)) { if (toHandle.StartsWith("ACK")) { m_manager.popSending(); } else { m_manager.send("ACK"); // Acquittal #region Connexion if (toHandle.StartsWith("OK")) { m_manager.hasBeenConnected(); } #endregion #region SMS HEADER if (toHandle.StartsWith("SMSHEADER")) { // SMS Header string[] args = toHandle.Split(':'); // Get arguments if (checkHeader(args)) { // Check // Get contact Contact c = business.getContactFromString(args[1]); // Get contact // Get a phone number which begin by 0 if (c != null) { if (args[1].StartsWith("+33")) { args[1] = "0" + args[1].Substring(3); } c = new Contact(args[1]); } // Get the date string pattern = "dd-MM-yyyy HH.mm.ss"; DateTime date = DateTime.ParseExact(args[2], pattern, CultureInfo.InvariantCulture); sms = new SMS(c, date, true); nbComs = int.Parse(args[3]); index = 1; } else { // If problem throw new Exception("Incorrect Header !"); } } #endregion #region SMS BODY else if (toHandle.StartsWith("SMSBODY")) { // SMS Body if (index != 0 && nbComs != 0) { toHandle = toHandle.Substring(8); // Delete "SMSBODY:" // Get the number of the part of the message int i = int.Parse(toHandle.Split(':')[0]); toHandle = toHandle.Substring(2); // Delete number // Get a part if (i == index && index <= nbComs) { sms.appendBody(toHandle); } else if (nbComs > 0 && i != index) { throw new Exception("Incorrect part of the message received !"); } // Is the message complete ? if (index == nbComs) { // Yes // Add the message in the conversation Conversation c = business.getConversationsFromContact(sms.Contact.Num); business.AddMessageToConv(sms, c); m_manager.smsReceived(sms); // Notify the interface nbComs = 0; index = 0; } else { // No index++; } } else { throw new Exception("Body unexpected !"); } } #endregion #region CONTACT else if (toHandle.StartsWith("CONTACT")) { // TODO : to implement } #endregion } } // End if } catch (Exception e) { LogManager.WriteToFile(e.Message, "ReceiveHandler"); } Thread.Sleep(50); // For scheduling } // End while }
/// <summary> /// 发表商品评价 /// </summary> public void Comment_Write() { int id = RequestTool.RequestInt("id", 0); //int Product_id = 0; if (!Comment.CheckSafeWord(RequestTool.RequestSafeString("Content"))) { Response.Write("{\"msg\":\"" + Tag("内容中包含敏感词") + "\"}"); return; } Lebi_Order_Product Order_Product = B_Lebi_Order_Product.GetModel("User_id=" + CurrentUser.id + " and id = " + id); if (Order_Product == null) { Response.Write("{\"msg\":\"" + Tag("该商品已经下架") + "\"}"); return; } else { Lebi_Order order = B_Lebi_Order.GetModel(Order_Product.Order_id); if (order == null) { Response.Write("{\"msg\":\"" + Tag("无效订单") + "\"}"); return; } else { if (order.IsReceived == 0) { Response.Write("{\"msg\":\"" + Tag("已购买商品在已收货之后才可以发表评价") + "\"}"); return; } } Order_Product.IsCommented = 1; B_Lebi_Order_Product.Update(Order_Product); } Lebi_Product checkproduct = B_Lebi_Product.GetModel(Order_Product.Product_id); if (checkproduct == null) { Response.Write("{\"msg\":\"" + Tag("该商品已经下架") + "\"}"); return; } Lebi_Comment model = new Lebi_Comment(); model.TableName = "Product"; model.Keyid = Order_Product.Product_id; model.Admin_UserName = "******"; model.Admin_id = 0; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.NickName; model.Content = RequestTool.RequestSafeString("Content"); model.Star = RequestTool.RequestInt("Star", 5); model.Parentid = 0; model.Status = 280; model.Time_Add = System.DateTime.Now; model.Language_Code = CurrentLanguage.Code; model.Images = RequestTool.RequestSafeString("Images"); model.ImagesSmall = RequestTool.RequestSafeString("ImagesSmall"); model.Product_id = Order_Product.Product_id; model.IsRead = 1; model.Supplier_id = checkproduct.Supplier_id; B_Lebi_Comment.Add(model); //List<Lebi_Order_Product> modelproducts = B_Lebi_Order_Product.GetList("User_id=" + CurrentUser.id + " and id = " + id + "", ""); //foreach (Lebi_Order_Product modelproduct in modelproducts) //{ // modelproduct.IsCommented = 1; // B_Lebi_Order_Product.Update(modelproduct); //} Lebi_Product product = B_Lebi_Product.GetModel(Order_Product.Product_id); if (product != null) { EX_Product.UpdateStar(product); } model.id = B_Lebi_Comment.GetMaxId(); //处理图片 ImageHelper.LebiImagesUsed(model.Images, "comment", model.id); //发送邮件 Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id); Email.SendEmail_comment(user, model); //发送短信 SMS.SendSMS_comment(user, model); Response.Write("{\"msg\":\"OK\"}"); }
protected void btnAccept_Click(object sender, EventArgs e) { foreach (GridViewRow gr in GridView1.Rows) { CheckBox Check = (CheckBox)gr.FindControl("chk_select"); Label Reg_Id = (Label)gr.FindControl("Label1"); Label Miller_MobileNo = (Label)gr.FindControl("Miller_MobileNo"); if (Check.Checked == true) { using (con = new SqlConnection(strcon)) { try { string GetIp = Request.ServerVariables["REMOTE_ADDR"].ToString(); string DistCode = Session["dist_id"].ToString(); string useragent = Session["DistrictManager"].ToString(); string Update = string.Format("Update Miller_Registration_2017 set Status='1',DM_IP_Address='{0}',DM_Current_DateTime={1},DM_User_Agent='{2}',DM_District='{3}' where Registration_ID='{4}' ", GetIp.ToString(), "GETDATE()", useragent, ViewState["DistName"].ToString(), Reg_Id.Text); con.Open(); cmd = new SqlCommand(Update, con); int count = cmd.ExecuteNonQuery(); if (count > 0) { string strMobileNo = Miller_MobileNo.Text; string strMessage = "आपके धान मिलिंग का रजिस्ट्रेशन स्वीकार कर लिया गया है तथा आपका रजिस्ट्रेशन नंबर '" + Reg_Id.Text + "' हैं| आप धान मिलिंग के अनुबंध के लिए जिला कार्यालय '" + ViewState["H_DistName"] + "' से संपर्क करें|"; Page.RegisterClientScriptBlock("mymsg1", "<script language=javascript> alert('Miller Registration is Accepted...'); </script> "); //btnAccept.Enabled = btnReject.Enabled = false; btnAccept.Enabled = false; SMS Message = new SMS(); Message.SendSMS(strMobileNo, strMessage); //Search(); } else { Page.RegisterClientScriptBlock("mymsg1", "<script language=javascript> alert('!!!!Failed'); </script> "); } } catch (Exception ex) { Page.RegisterClientScriptBlock("mymsg1", "<script language=javascript> alert('" + ex.Message + "'); </script> "); btnAccept.Enabled = false; } finally { if (con.State != ConnectionState.Closed) { con.Close(); } } } } } }
public ActionResult Process(SMS smsInput, int smsAction) { bool success = false; string loggedUserName = UserSession.GetLoggedUserName(); if (smsAction == 1) { smsInput.TimeStamp = DateTime.Now; smsInput.Sent = false; smsInput.Draft = false; // Dikomentari sementara, nanti masalah nilai bawaan harus diatur di model, bukan di kode ini (seperti tiga baris diatas itu) if (ModelState.IsValid) { success = messageProcess.Send(this, smsInput); if (success) { // delete jika dari draft int draftId = Convert.ToInt32(Request.Form["draftId"]); if (draftId > 0) { messageProcess.DeleteDraft(this, draftId); } if (!Request.IsAjaxRequest()) { return(Redirect("~/Message/Outbox?success=1")); } else { return(Json(true)); } } else { if (!Request.IsAjaxRequest()) { return(Redirect("~/Message/Outbox?error=1")); } else { return(Json(false)); } } } else { // simpan ke draft kalau belum ada di draft int draftId = Convert.ToInt32(Request.Form["draftId"]); if (draftId > 0) { Draft draft = messageProcess.ConvertToDraft(smsInput); messageProcess.UpdateDraft(this, draftId, draft); } else { messageProcess.SaveDraft(this, smsInput); int lastDraftId = ( from draftUser in db.DraftUser where draftUser.UserName == loggedUserName select draftUser.DraftId ).ToList().Last(); draftId = lastDraftId; } if (!Request.IsAjaxRequest()) { return(Redirect("~/Message/Compose?draftId=" + draftId + "&isValid=0")); } else { return(Json(false)); } } } else { success = messageProcess.SaveDraft(this, smsInput); if (success) { return(Redirect("~/Message/Draft?success=1")); } else { return(Redirect("~/Message/Draft?success=0")); } } }
static void Main(string[] args) { SMS testSMS = new SMS("", null, false, ""); Console.WriteLine(testSMS); }
public bool EditSMS(SMS entity) { _unitOfWork.SMSRepository.Edit(entity); _unitOfWork.Save(); return true; }
public bool AddSMS(SMS entity) { _unitOfWork.SMSRepository.Add(entity); _unitOfWork.Save(); return true; }
public static void Send(SMS sms) { }
private SMS ProcessSMS(SMS message) { message.Text = SobstituteAbbreviations(message.Text); return(message); }
public bool LoadRom(string path, CoreComm nextComm, bool forceAccurateCore = false) // forceAccurateCore is currently just for Quicknes vs Neshawk but could be used for other situations { if (path == null) { return(false); } using (var file = new HawkFile()) { var romExtensions = new[] { "SMS", "SMC", "SFC", "PCE", "SGX", "GG", "SG", "BIN", "GEN", "MD", "SMD", "GB", "NES", "FDS", "ROM", "INT", "GBC", "UNF", "A78", "CRT", "COL", "XML", "Z64", "V64", "N64", "WS", "WSC" }; // lets not use this unless we need to // file.NonArchiveExtensions = romExtensions; file.Open(path); // if the provided file doesnt even exist, give up! if (!file.Exists) { return(false); } // try binding normal rom extensions first if (!file.IsBound) { file.BindSoleItemOf(romExtensions); } // if we have an archive and need to bind something, then pop the dialog if (file.IsArchive && !file.IsBound) { var result = HandleArchive(file); if (result.HasValue) { file.BindArchiveMember(result.Value); } else { return(false); } } // set this here so we can see what file we tried to load even if an error occurs CanonicalFullPath = file.CanonicalFullPath; IEmulator nextEmulator = null; RomGame rom = null; GameInfo game = null; try { var ext = file.Extension.ToLower(); if (ext == ".iso" || ext == ".cue") { var disc = ext == ".iso" ? Disc.FromIsoPath(path) : Disc.FromCuePath(path, new CueBinPrefs()); var hash = disc.GetHash(); game = Database.CheckDatabase(hash); if (game == null) { // try to use our wizard methods game = new GameInfo { Name = Path.GetFileNameWithoutExtension(file.Name), Hash = hash }; switch (disc.DetectDiscType()) { case DiscType.SegaSaturn: game.System = "SAT"; break; case DiscType.SonyPSP: game.System = "PSP"; break; case DiscType.SonyPSX: game.System = "PSX"; break; case DiscType.MegaCD: game.System = "GEN"; break; case DiscType.TurboCD: case DiscType.UnknownCDFS: case DiscType.UnknownFormat: default: // PCECD was bizhawk's first CD core, // and during that time, all CDs were blindly sent to it // so this prevents regressions game.System = "PCECD"; break; } } switch (game.System) { case "GEN": var genesis = new GPGX( nextComm, null, disc, "GEN", GetCoreSettings <GPGX>(), GetCoreSyncSettings <GPGX>()); nextEmulator = genesis; break; case "SAT": nextEmulator = new Yabause(nextComm, disc, GetCoreSyncSettings <Yabause>()); break; case "PSP": nextEmulator = new PSP(nextComm, file.Name); break; case "PSX": nextEmulator = new Octoshock(nextComm); (nextEmulator as Octoshock).LoadCuePath(file.CanonicalFullPath); nextEmulator.CoreComm.RomStatusDetails = "PSX etc."; break; case "PCE": case "PCECD": nextEmulator = new PCEngine(nextComm, game, disc, GetCoreSettings <PCEngine>(), GetCoreSyncSettings <PCEngine>()); break; } } else if (file.Extension.ToLower() == ".xml") { try { var xmlGame = XmlGame.Create(file); // if load fails, are we supposed to retry as a bsnes XML???????? game = xmlGame.GI; switch (game.System) { case "DGB": var left = Database.GetGameInfo(xmlGame.Assets["LeftRom"], "left.gb"); var right = Database.GetGameInfo(xmlGame.Assets["RightRom"], "right.gb"); nextEmulator = new GambatteLink( nextComm, left, xmlGame.Assets["LeftRom"], right, xmlGame.Assets["RightRom"], GetCoreSettings <GambatteLink>(), GetCoreSyncSettings <GambatteLink>(), Deterministic); // other stuff todo break; default: return(false); } } catch (Exception ex) { DoLoadErrorCallback(ex.ToString(), "DGB", LoadErrorType.XML); return(false); } } else // most extensions { rom = new RomGame(file); if (string.IsNullOrEmpty(rom.GameInfo.System)) { // Has the user picked a preference for this extension? if (PreferredPlatformIsDefined(rom.Extension.ToLower())) { rom.GameInfo.System = Global.Config.PreferredPlatformsForExtensions[rom.Extension.ToLower()]; } else if (ChoosePlatform != null) { rom.GameInfo.System = ChoosePlatform(rom); } } game = rom.GameInfo; var isXml = false; // other xml has already been handled if (file.Extension.ToLower() == ".xml") { game.System = "SNES"; isXml = true; } switch (game.System) { case "SNES": if (Global.Config.SNES_InSnes9x && VersionInfo.DeveloperBuild) { var snes = new Emulation.Cores.Nintendo.SNES9X.Snes9x(nextComm, rom.FileData); nextEmulator = snes; } else { // need to get rid of this hack at some point ((CoreFileProvider)nextComm.CoreFileProvider).SubfileDirectory = Path.GetDirectoryName(path.Replace("|", String.Empty)); // Dirty hack to get around archive filenames (since we are just getting the directory path, it is safe to mangle the filename var romData = isXml ? null : rom.FileData; var xmlData = isXml ? rom.FileData : null; var snes = new LibsnesCore(game, romData, Deterministic, xmlData, nextComm, GetCoreSettings <LibsnesCore>(), GetCoreSyncSettings <LibsnesCore>()); nextEmulator = snes; } RACore.OnLoad(RAConsoleID.SNES, rom.GameInfo.Name, rom.GameInfo.Hash); break; case "SMS": case "SG": case "GG": nextEmulator = new SMS(nextComm, game, rom.RomData, GetCoreSettings <SMS>(), GetCoreSyncSettings <SMS>()); RACore.OnLoad(RAConsoleID.MasterSystem, rom.GameInfo.Name, rom.GameInfo.Hash); break; case "A26": nextEmulator = new Atari2600( nextComm, game, rom.FileData, GetCoreSettings <Atari2600>(), GetCoreSyncSettings <Atari2600>()); break; case "PCE": case "PCECD": case "SGX": nextEmulator = new PCEngine(nextComm, game, rom.RomData, GetCoreSettings <PCEngine>(), GetCoreSyncSettings <PCEngine>()); RACore.OnLoad(RAConsoleID.PCEngine, rom.GameInfo.Name, rom.GameInfo.Hash); break; case "GEN": nextEmulator = new GPGX(nextComm, rom.RomData, null, "GEN", GetCoreSettings <GPGX>(), GetCoreSyncSettings <GPGX>()); RACore.OnLoad(RAConsoleID.MegaDrive, rom.GameInfo.Name, rom.GameInfo.Hash); break; case "TI83": nextEmulator = new TI83(nextComm, game, rom.RomData, GetCoreSettings <TI83>()); break; case "NES": if (!Global.Config.NES_InQuickNES || forceAccurateCore) { nextEmulator = new NES( nextComm, game, rom.FileData, GetCoreSettings <NES>(), GetCoreSyncSettings <NES>()); } else { nextEmulator = new QuickNES(nextComm, rom.FileData, GetCoreSettings <QuickNES>()); } RACore.OnLoad(RAConsoleID.NES, rom.GameInfo.Name, rom.GameInfo.Hash); break; case "GB": case "GBC": if (!Global.Config.GB_AsSGB) { nextEmulator = new Gameboy( nextComm, game, rom.FileData, GetCoreSettings <Gameboy>(), GetCoreSyncSettings <Gameboy>(), Deterministic); } else { try { game.System = "SNES"; game.AddOption("SGB"); var snes = new LibsnesCore(game, rom.FileData, Deterministic, null, nextComm, GetCoreSettings <LibsnesCore>(), GetCoreSyncSettings <LibsnesCore>()); nextEmulator = snes; } catch { // failed to load SGB bios or game does not support SGB mode. // To avoid catch-22, disable SGB mode Global.Config.GB_AsSGB = false; throw; } } if (game.System == "GB") { RACore.OnLoad(RAConsoleID.Gameboy, rom.GameInfo.Name, rom.GameInfo.Hash); } else if (game.System == "GBC") { RACore.OnLoad(RAConsoleID.GameboyColor, rom.GameInfo.Name, rom.GameInfo.Hash); } break; case "Coleco": nextEmulator = new ColecoVision(nextComm, game, rom.RomData, GetCoreSyncSettings <ColecoVision>()); break; case "INTV": nextEmulator = new Intellivision(nextComm, game, rom.RomData); break; case "A78": var gamedbpath = Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "EMU7800.csv"); nextEmulator = new Atari7800(nextComm, game, rom.RomData, gamedbpath); break; case "C64": var c64 = new C64(nextComm, game, rom.RomData, rom.Extension); nextEmulator = c64; break; case "GBA": if (false) { //var gba = new GBA(nextComm); //gba.Load(rom.RomData); //nextEmulator = gba; } else { var gba = new VBANext(rom.RomData, nextComm); nextEmulator = gba; RACore.OnLoad(RAConsoleID.GameboyAdvance, rom.GameInfo.Name, rom.GameInfo.Hash); } break; case "N64": nextEmulator = new N64(nextComm, game, rom.RomData, GetCoreSettings <N64>(), GetCoreSyncSettings <N64>()); RACore.OnLoad(RAConsoleID.Nintendo64, rom.GameInfo.Name, rom.GameInfo.Hash); break; case "WSWAN": nextEmulator = new WonderSwan(nextComm, rom.RomData, Deterministic, GetCoreSettings <WonderSwan>(), GetCoreSyncSettings <WonderSwan>()); break; case "DEBUG": if (VersionInfo.DeveloperBuild) { nextEmulator = LibRetroEmulator.CreateDebug(nextComm, rom.RomData); } break; } } if (nextEmulator == null) { DoLoadErrorCallback("No core could load the rom.", null); return(false); } } catch (Exception ex) { string system = null; if (game != null) { system = game.System; } // Specific hack here, as we get more cores of the same system, this isn't scalable if (ex is UnsupportedMapperException) { return(LoadRom(path, nextComm, forceAccurateCore: true)); } else if (ex is MissingFirmwareException) { DoLoadErrorCallback(ex.Message, system, LoadErrorType.MissingFirmware); } else if (ex is CGBNotSupportedException) { // Note: GB as SGB was set to false by this point, otherwise we would want to do it here DoMessageCallback("Failed to load a GB rom in SGB mode. Disabling SGB Mode."); return(LoadRom(path, nextComm)); } else { DoLoadErrorCallback("A core accepted the rom, but threw an exception while loading it:\n\n" + ex, system); } return(false); } Rom = rom; LoadedEmulator = nextEmulator; Game = game; return(true); } }
/// <summary> /// 发送验证短信验证码 http://192.168.1.223/GR_Home/SendSmsCode /// </summary> /// <param name="mobile"></param> /// <returns></returns> public string SendSmsCode(string mobile) { bool flg = false; string sID = "", sEmail = "", sMobile = ""; if (!string.IsNullOrEmpty(mobile)) { //查询用户信息 using (var db = new shhouseEntities()) { var persons = db.user_details.Where(x => x.mobile == mobile).FirstOrDefault(); //var persons = (from u in db.user_details join b in db.user_member on u.userid equals b.userid where b.mobile == mobile select u).FirstOrDefault(); if (persons != null) { sID = persons.userid.ToString(); sEmail = persons.email; sMobile = persons.mobile; flg = true; } else { sID = "0"; sEmail = null; sMobile = mobile; flg = true; } } if (flg) { Random random = new Random(); string sCode = random.Next(111111, 1000000).ToString(); if (SMS.SendSMS_New(sMobile, "验证码:" + sCode + " 【e房网】") != "100") { return(JsonConvert.SerializeObject(new repmsg { state = 2, msg = "短信发送失败,请稍侯再试", data = null })); } else { //添加到数据库 using (var db = new shhouseEntities()) { var user_validityrecord = new user_validityrecord() { userid = int.Parse(sID), //用户id validity = DateTime.Now.AddHours(24), //有效期 checkcode = sCode, //验证码 codetype = 1, //类型 发短信为1 发邮件为2 这里默认为1 state = "0", //是否有效 状态 body = "", //描述 Mobile = mobile //新增用户手机号码 }; db.user_validityrecord.Add(user_validityrecord); db.SaveChanges(); } } } return(JsonConvert.SerializeObject(new repmsg { state = 1, msg = "发送成功", data = null })); } return(JsonConvert.SerializeObject(new repmsg { state = 2, msg = "发送失败", data = null })); }
public void AddMessageToConv(SMS sms, Conversation conv) { bdd.AddMessageToConv(sms, conv); }
/// <summary> /// Display a new SMS received /// </summary> /// <param name="sms"></param> public void smsReceived(SMS sms) { Console.WriteLine("Nouveau message reçu : " + sms.Body); }
protected void btnCancel_Click(object sender, EventArgs e) { if (ddlMobileNo.SelectedIndex <= 0) { Page.RegisterClientScriptBlock("mymsg1", "<script language=javascript> alert('Please Select Mobile Number For OTP'); </script> "); return; } else { if (txtMODate.Text != "") { ClientIP objClientIP = new ClientIP(); string GetIp = (objClientIP.GETIP()); if (Session["update"].ToString() == ViewState["update"].ToString()) { using (con = new SqlConnection(strcon)) { try { con.Open(); string instr = "", smsToDist = "", smsToDistCode = "", smsToDist1 = "", smsToDistCode1 = "", strSMS1 = "", SMSToRackDist1 = ""; for (int i = 0; i < GridView1.Rows.Count; i++) { smsToDist += ((smsToDist == "") ? "" : " , ") + "'" + GridView1.Rows[i].Cells[2].Text + "' = '" + GridView1.Rows[i].Cells[5].Text + "'"; smsToDistCode += ((smsToDistCode == "") ? "" : ",") + "'" + GridView1.Rows[i].Cells[6].Text + "'"; } if (ViewState["hdfModeofDist"].ToString() == "Other") { for (int i = 0; i < GridView2.Rows.Count; i++) { smsToDist1 += ((smsToDist1 == "") ? "" : ",") + "'" + GridView2.Rows[i].Cells[2].Text + "(" + GridView2.Rows[i].Cells[3].Text + ")'"; smsToDistCode1 += ((smsToDistCode1 == "") ? "" : ",") + "'" + GridView2.Rows[i].Cells[4].Text + "'"; SMSToRackDist1 += ((SMSToRackDist1 == "") ? "" : ",") + "'" + GridView2.Rows[i].Cells[1].Text + " To " + GridView2.Rows[i].Cells[2].Text + "-" + GridView2.Rows[i].Cells[3].Text + "'"; } strSMS1 = "Movement Order Cancelled By Head Office Bhopal with MO Number='" + ddlMvmtNo.SelectedItem.ToString() + "'.Please Stop All Transportation Against This Movement Order"; } if (ViewState["hdfModeofDist"].ToString() == "Both") { for (int i = 0; i < GridView2.Rows.Count; i++) { if (GridView2.Rows[i].Cells[1].Text != GridView2.Rows[i].Cells[2].Text) { smsToDist1 += ((smsToDist1 == "") ? "" : ",") + "'" + GridView2.Rows[i].Cells[2].Text + "(" + GridView2.Rows[i].Cells[3].Text + ")'"; smsToDistCode1 += ((smsToDistCode1 == "") ? "" : ",") + "'" + GridView2.Rows[i].Cells[4].Text + "'"; } SMSToRackDist1 += ((SMSToRackDist1 == "") ? "" : ",") + "'" + GridView2.Rows[i].Cells[1].Text + " To " + GridView2.Rows[i].Cells[2].Text + "-" + GridView2.Rows[i].Cells[3].Text + "'"; } strSMS1 = "Movement Order Cancelled By Head Office Bhopal with MO Number='" + ddlMvmtNo.SelectedItem.ToString() + "'.Please Stop All Transportation Against This Movement Order"; } if (ViewState["hdfModeofDist"].ToString() == "Both" || ViewState["hdfModeofDist"].ToString() == "Other") { instr = "BEGIN TRY; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED BEGIN TRANSACTION " + "Update StateMovementOrder Set IsCancelled='Y', CancelledIP='" + GetIp + "',CancelledDate=GETDATE(),Cancelled_EmpID='" + hdfEmpID.Value + "',Cancelled_MobileNo='" + hdfMobileNo.Value + "',Cancelled_OTP='" + hdfOTP.Value + "' where MoveOrdernum='" + ddlMvmtNo.SelectedItem.ToString() + "';"; instr += "Update StateSubMovementOrder Set IsCancelled='Y' where MoveOrdernum='" + ddlMvmtNo.SelectedItem.ToString() + "';"; instr += "COMMIT end TRY BEGIN CATCH IF @@TRANCOUNT > 0 ROLLBACK;DECLARE @ErrorMessage NVARCHAR(4000);DECLARE @ErrorSeverity INT;DECLARE @ErrorState INT;SELECT @ErrorMessage = ERROR_MESSAGE(), @ErrorSeverity = ERROR_SEVERITY(), @ErrorState = ERROR_STATE(); RAISERROR (@ErrorMessage, @ErrorSeverity,@ErrorState ); END CATCH;"; } else { instr = "Update StateMovementOrder Set IsCancelled='Y', CancelledIP='" + GetIp + "',CancelledDate=GETDATE(),Cancelled_EmpID='" + hdfEmpID.Value + "',Cancelled_MobileNo='" + hdfMobileNo.Value + "',Cancelled_OTP='" + hdfOTP.Value + "' where MoveOrdernum='" + ddlMvmtNo.SelectedItem.ToString() + "'"; } cmd = new SqlCommand(instr, con); int count = cmd.ExecuteNonQuery(); if (count > 0) { btnCancel.Enabled = ddlMvmtNo.Enabled = ddlCropYear.Enabled = ddlCommodity.Enabled = ddlComdtyMode.Enabled = ddlFrmDist.Enabled = ddlMobileNo.Enabled = false; btnPrint.Enabled = true; Session["MovmtOrderNo"] = ddlMvmtNo.SelectedItem.ToString(); Page.RegisterClientScriptBlock("mymsg1", "<script language=javascript> alert('Movement Order Is Cancelled Successfully'); </script> "); Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString()); string strSMS = ""; //Code For SMS if (ViewState["hdfModeofDist"].ToString() == "Other") { strSMS = "'" + ddlMvmtNo.SelectedItem.ToString() + "' Movement Order Is Cancelled By Head Office Bhopal. Movement Order Issued Date On '" + txtMODate.Text + "' For '" + ddlCommodity.SelectedItem.ToString() + "', '" + ddlComdtyMode.SelectedItem.ToString() + "' From '" + ViewState["hdfFromDist"].ToString() + "' To (" + smsToDist + ")MT With End Date'" + ViewState["hdfEndDate"].ToString() + "'. Please Stop All Transportation Against This Movement Order"; } else if (ViewState["hdfModeofDist"].ToString() == "Both") { strSMS = "'" + ddlMvmtNo.SelectedItem.ToString() + "' Movement Order Is Cancelled By Head Office Bhopal. Movement Order Issued Date On '" + txtMODate.Text + "' For '" + ddlCommodity.SelectedItem.ToString() + "', '" + ddlComdtyMode.SelectedItem.ToString() + "' From '" + ViewState["hdfFromDist"].ToString() + "' To (" + smsToDist + ")MT With End Date'" + ViewState["hdfEndDate"].ToString() + "'. Please Stop All Transportation Against This Movement Order"; } else { strSMS = "'" + ddlMvmtNo.SelectedItem.ToString() + "' Movement Order Is Cancelled By Head Office Bhopal. Movement Order Issued Date On '" + txtMODate.Text + "' For '" + ddlCommodity.SelectedItem.ToString() + "', '" + ddlComdtyMode.SelectedItem.ToString() + "' From '" + ViewState["hdfFromDist"].ToString() + "' To (" + smsToDist + ")MT With End Date'" + ViewState["hdfEndDate"].ToString() + "'. Please Stop All Transportation Against This Movement Order"; } SMS Message = new SMS(); smsToDistCode += ",'" + ViewState["hdfFromDistCode"].ToString() + "'"; string FindDistContactNo = "select DM_Mobile,RM_Mobile,District_code From officers_list where District_code in (" + smsToDistCode + ")"; da = new SqlDataAdapter(FindDistContactNo, con); ds = new DataSet(); da.Fill(ds); string CheckDuplicate = "", GMPDS = hdfMobileNo.Value, SharmaSir = "9479374277"; if (ds != null) { if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string checkLength = ds.Tables[0].Rows[i]["DM_Mobile"].ToString(); string checkLengthRM = ds.Tables[0].Rows[i]["RM_Mobile"].ToString(); string DistCode = ds.Tables[0].Rows[i]["District_code"].ToString(); if (i == 0) { Message.SendSMS(GMPDS, strSMS); Thread.Sleep(1000); Message.SendSMS(SharmaSir, strSMS); } if (checkLength.Length == 10) { Message.SendSMS(checkLength, strSMS); } if (checkLengthRM.Length == 10) { if (checkLength != checkLengthRM) { if (checkLengthRM != CheckDuplicate) { Message.SendSMS(checkLengthRM, strSMS); CheckDuplicate = checkLengthRM; Thread.Sleep(1000); } } } } } } if (ViewState["hdfModeofDist"].ToString() == "Other" || ViewState["hdfModeofDist"].ToString() == "Both") { SMS Message1 = new SMS(); if (ds != null) { if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string GMPDS1 = hdfMobileNo.Value, SharmaSir1 = "9479374277"; string checkLength = ds.Tables[0].Rows[i]["DM_Mobile"].ToString(); string DistCode = ds.Tables[0].Rows[i]["District_code"].ToString(); if (i == 0) { Message1.SendSMS(GMPDS1, strSMS1); Thread.Sleep(1000); Message1.SendSMS(SharmaSir1, strSMS1); } if (DistCode != ViewState["hdfFromDistCode"].ToString()) { if (checkLength.Length == 10) { Message1.SendSMS(checkLength, strSMS1); } } } } } string FindDistContactNo1 = "select DM_Mobile,District_code From officers_list where District_code in (" + smsToDistCode1 + ")"; da1 = new SqlDataAdapter(FindDistContactNo1, con); ds1 = new DataSet(); da1.Fill(ds1); if (ds1 != null) { if (ds1.Tables.Count > 0 && ds1.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { string checkLength = ds1.Tables[0].Rows[i]["DM_Mobile"].ToString(); string DistCode = ds1.Tables[0].Rows[i]["District_code"].ToString(); if (checkLength.Length == 10) { Message1.SendSMS(checkLength, strSMS1); } } } } } } else { Page.RegisterClientScriptBlock("mymsg1", "<script language=javascript> alert('!!!!Failed'); </script> "); } } catch (Exception ex) { Page.RegisterClientScriptBlock("mymsg1", "<script language=javascript> alert('" + ex.Message + "'); </script> "); } finally { if (con.State != ConnectionState.Closed) { con.Close(); } txtMODate.Text = ""; } } } else { Response.Redirect(Request.Url.AbsoluteUri); } } else { Page.RegisterClientScriptBlock("mymsg1", "<script language=javascript> alert('Please Enter Commodity & Mode of Dispatch'); </script> "); return; } } }
/// <summary> /// 发送邮件。 /// </summary> /// <param name="sms"></param> public void SendMail(SMS sms) { #region 发送邮件. if (string.IsNullOrEmpty(sms.Email)) { BP.WF.Port.WFEmp emp = new BP.WF.Port.WFEmp(sms.SendToEmpNo); sms.Email = emp.Email; } System.Net.Mail.MailMessage myEmail = new System.Net.Mail.MailMessage(); myEmail.From = new MailAddress("*****@*****.**", "ccbpm123", System.Text.Encoding.UTF8); myEmail.To.Add(sms.Email); myEmail.Subject = sms.Title; myEmail.SubjectEncoding = System.Text.Encoding.UTF8;//邮件标题编码 myEmail.Body = sms.DocOfEmail; myEmail.BodyEncoding = System.Text.Encoding.UTF8; //邮件内容编码 myEmail.IsBodyHtml = true; //是否是HTML邮件 myEmail.Priority = MailPriority.High; //邮件优先级 SmtpClient client = new SmtpClient(); //邮件地址. string emailAddr = SystemConfig.GetValByKey("SendEmailAddress", null); if (emailAddr == null) { emailAddr = "*****@*****.**"; } string emailPassword = SystemConfig.GetValByKey("SendEmailPass", null); if (emailPassword == null) { emailPassword = "******"; } //是否启用ssl? bool isEnableSSL = false; string emailEnableSSL = SystemConfig.GetValByKey("SendEmailEnableSsl", null); if (emailEnableSSL == null || emailEnableSSL == "0") { isEnableSSL = false; } else { isEnableSSL = true; } client.Credentials = new System.Net.NetworkCredential(emailAddr, emailPassword); //上述写你的邮箱和密码 client.Port = SystemConfig.GetValByKeyInt("SendEmailPort", 25); //使用的端口 client.Host = SystemConfig.GetValByKey("SendEmailHost", "smtp.tom.com"); //是否启用加密,有的邮件服务器发送配置不成功就是因为此参数的错误。 client.EnableSsl = SystemConfig.GetValByKeyBoolen("SendEmailEnableSsl", isEnableSSL); object userState = myEmail; try { client.SendAsync(myEmail, userState); sms.HisEmailSta = MsgSta.RunOK; sms.Update(); } catch (System.Net.Mail.SmtpException ex) { throw ex; } #endregion 发送邮件. }
private void FormGSMModemEmulator_Load(object sender, EventArgs e) { Logger.Init("activity.log"); try { string[] sp = SerialPort.GetPortNames(); foreach (string port in sp) comboCOMPort.Items.Add(port); comboCOMPort.Sorted = true; grpAutomatic.Enabled = true; grpManual.Enabled = false; mnuAutomate_Click(null, null); for (int index = 1; index <= INBOX_CAPACITY; ++index) Inbox[index] = new SMS(EmptySMS); btnReload_Click(null, null); DequeueTimer.Enabled = true; DequeueTimer.AutoReset = true; DequeueTimer.Elapsed += new System.Timers.ElapsedEventHandler(DequeueTimer_Elapsed); DequeueTimer.Start(); AutomatedRXTimer.Enabled = true; AutomatedRXTimer.AutoReset = true; AutomatedRXTimer.Elapsed += new System.Timers.ElapsedEventHandler(AutomatedRXTimer_Elapsed); AutomatedRXTimer.Start(); SPortEventHandler = new SerialDataReceivedEventHandler(SPort_DataReceived); comboCOMPort.SelectedIndex = comboCOMPort.Items.IndexOf(configXML.Settings["COMPort"].Value); comboBaud.SelectedIndex = comboBaud.Items.IndexOf(configXML.Settings["Baud"].Value); btnConnect_Click(null, null); } catch { // Do nothing } }
/// <summary> /// 解析数据 /// </summary> /// <param name="datasource"></param> public void BuildData(CallDataSource datasource) { if (!FileHelper.IsValid(MainDbPath)) { return; } string allText = System.IO.File.ReadAllText(MainDbPath); var arrData = allText.Split(new string[] { "BEGIN:VMSG", "END:VMSG" }, StringSplitOptions.RemoveEmptyEntries); foreach (var d in arrData) { var datas = d.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries).ToList(); if (datas.IsInvalid()) { continue; } SMS sms = new SMS(); sms.DataState = EnumDataState.Normal; //号码 string temp = datas.FirstOrDefault(s => s.StartsWith("TEL:")); if (temp.IsValid() && Regex.IsMatch(temp, @"\+{0,1}\d+")) { sms.Number = Regex.Match(temp, @"\+{0,1}\d+").Value; } //类型 temp = datas.FirstOrDefault(s => s.StartsWith("RECEVIE_Date:")); if (temp.Contains("Thursday, January 1, 1970 8:00:00 AM")) {//自己发送的短信,接收时间永远是这个值 sms.SmsState = EnumSMSState.SendSMS; } else { sms.SmsState = EnumSMSState.ReceiveSMS; } //时间和内容 int beginBody = datas.IndexOf("BEGIN:VBODY"); int endBody = datas.IndexOf("END:VBODY"); if (endBody - beginBody < 2) {//至少2行,第一行是发送时间,第二行开始是消息内容 continue; } sms.StartDate = GetDateTime(datas[beginBody + 1].TrimStart("Date:")); sms.Content = string.Join("\r\n", datas.Skip(beginBody + 2).Take(endBody - beginBody - 2)); //是否已读 temp = datas.FirstOrDefault(s => s.StartsWith("CP_READ:")); if (temp == "CP_READ:0") { sms.ReadState = EnumReadState.Unread; } else { sms.ReadState = EnumReadState.Read; } datasource.Items.Add(sms); } }
public bool Equals(SMS AnotherSMS) { return (this.Sender.Equals(AnotherSMS.Sender) && this.Message.Equals(AnotherSMS.Message) && this.RXTimeStamp.Equals(AnotherSMS.RXTimeStamp)); }
public virtual void SMSValidation(HttpContext context) { YZRequest request = new YZRequest(context); string validateItemGUID = request.GetString("validateItemGUID"); string validateCode = request.GetString("validateCode"); string action = request.GetString("action", null); string uid = YZAuthHelper.LoginUserAccount; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { SMS sms = SMSManager.TryGetSMS(provider, cn, validateItemGUID); if (sms == null) { throw new Exception(Resources.YZMobile.Aspx_Auth_GetValidationCodeAgain); } if (sms.ValidationCode != validateCode) { throw new Exception(Resources.YZMobile.Aspx_Auth_IncorrectValidationCode); } if (sms.ExpireDate < DateTime.Now) { throw new Exception(Resources.YZMobile.Aspx_Auth_GetValidationCodeAgain); } SMSManager.DeleteSMS(provider, cn, validateItemGUID); } } if (NameCompare.EquName(action, "bindandprotect")) { string iddcode = request.GetString("iddcode"); string phoneNumber = request.GetString("phoneNumber"); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); User.SetAppLoginProtect(cn, uid, true); User.BindPhone(cn, uid, iddcode, phoneNumber); User user = User.TryGetUser(cn, uid); if (user != null) { if ((user.Permision & BPMObjectPermision.Edit) == BPMObjectPermision.Edit) { user.Mobile = phoneNumber; User.Update(cn, uid, user); } } } } if (NameCompare.EquName(action, "changebind")) { string iddcode = request.GetString("iddcode"); string phoneNumber = request.GetString("phoneNumber"); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); User.BindPhone(cn, uid, iddcode, phoneNumber); User user = User.TryGetUser(cn, uid); if (user != null) { if ((user.Permision & BPMObjectPermision.Edit) == BPMObjectPermision.Edit) { user.Mobile = phoneNumber; User.Update(cn, uid, user); } } } } }
protected void btnGetCode_Click(object sender, EventArgs e) { string code = verificationCode.Text.Trim().ToUpper(); if (code == HttpContext.Current.Session["verificationCode"].ToString()) { SMS sms = new SMS(); sms.SendCode(phone); Tick = 120; if (sms.ErrorMessage == "成功") lbSMS.Text = "短信验证已发送(2分钟内有效)。"; else lbSMS.Text = sms.ErrorMessage; } else lbSMS.Text = "图片验证码不正确"; }
public bool SendSMS(string senderPhone, string message) { mutex.WaitOne(); if (message.Length > 140) message = message.Substring(0, 140); bool result = false; if (port.IsOpen) { port.Close(); } try { port.Open(); } catch (Exception e) { logger.Error("Ошибка соединения с модемом " + (this.ModemName ?? "") + ". Не удалось подключится к порту " + (this.PortName ?? "") + ". \r\nТекст ошибки:" ,e); } if (port.IsOpen) { ExecCommand("AT", 300, "Не удалось подключиться к модему"); ExecCommand("AT+CMGF=0", 300, "Не удалось установить цифровой режим передачи."); ExecCommand("AT+CSCS=\"UCS2\"", 300, "Не удалось установить формат UCS2."); string pduData; SMS sms = new SMS(); sms.Direction = SMSDirection.Submited; sms.PhoneNumber = senderPhone; sms.ValidityPeriod = new TimeSpan(4, 0, 0, 0); sms.Message = message; pduData = sms.Compose(SMS.SMSEncoding.UCS2); ExecCommand("AT+CMGS=" + (pduData.Length / 2 - 1), 300, "Не удалось передать номер"); string recievedData = ExecCommand(pduData + "\x1A", 500, "Не удалось отправить сообщение"); //3 seconds if (recievedData.EndsWith("\r\nOK\r\n")) result = true; else if (recievedData.Contains("ERROR")) { logger.Warn("Не удалоcь отправить сообщение с модема " + (this.ModemName ?? "") + ", подключенного к порту " + (this.PortName?? "") + "\r\nОтвет модема:" + (recievedData ?? "")+"\r\nСовет: Проверте наличие денежнех средств на сим-карте"); result = false; } if (port.IsOpen) { port.Close(); } } mutex.ReleaseMutex(); return result; }
public ActionResult ScheduleSMS(SMS smsInput) { return(View()); }
public override bool IsPlatformMatch(byte[] rom) { return(SMS.VerifyMagicNumber(rom, SmsHeader.HeaderOffset)); }
protected void Page_Load(object sender, EventArgs e) { // Enter the value from the 'App Key' field obtained at developer.att.com in your // app account. string clientId = ""; // Enter the value from the 'App Secret' field obtained at developer.att.com // in your app account. string secretKey = ""; // Set the fully-qualified domain name to: https://api.att.com string fqdn = "https://api.att.com"; //Set the scope to AAB string scope = "SMS"; //Create the service for requesting an OAuth access token. var oauth = new OAuth(fqdn, clientId, secretKey, scope); //Get the OAuth access token using the Client Credentials. if (oauth.GetAccessToken(OAuth.AccessTokenType.ClientCredentials)) { // Get access token OAuthToken at = new OAuthToken(); string accessToken = at.getAccessToken(oauth.accessTokenJson); // Create the service for making the method request. var sms = new SMS(fqdn, accessToken); //************************************************************************* // Operation: Send SMS // Set params: string address = "tel:+10000000000"; string message = "<Enter message>"; string messageId = String.Empty; try { // Make an Make a method call to the SMS API. // Method takes: // param 1: address // param 1: message OutboundSMSResponseObj.RootObject sendSMSresponseObj = sms.sendSMS(address, message); messageId = sendSMSresponseObj.outboundSMSResponse.messageId; } catch (Exception respex) { string error = respex.StackTrace; } //************************************************************************* // Operation: Get SMS string RegistrationID = "00000000"; try { // Make an Make a method call to the SMS API. // Method takes: // param 1: RegistrationID InboundSmsMessageObj.RootObject getSMSresponseObj = sms.getSMS(RegistrationID); } catch (Exception respex) { string error = respex.StackTrace; } //************************************************************************* // Operation: Get SMS Delivery Status try { // Make an Make a method call to the SMS API. // Method takes: // param 1: messageID DeliveryInfoObj.RootObject deliveryStatusResponse = sms.getSMSDeliveryStatus(messageId); } catch (Exception respex) { string error = respex.StackTrace; } } }
public Tweeter(TweetFactory tw, SMS sms, [Parameter(Value = typeof(PhoneNumber))] long phoneNumber) { this.tw = tw; this.sms = sms; this.phoneNumber = phoneNumber; }
protected void Button2_Click(object sender, EventArgs e) { if (Session["username"] == null) { Function.CheckIstimeout(); } else { UsersManage umg = new UsersManage(); int sucess = 0; int faild = 0; SMS sms = new SMS(); SendSMS ssm = GetSMSConf(); sms.Number = ""; string recivers = ""; string recivername = ""; if (phonebooklist.SelectedValue.ToString() != "") { DataTable dt = umg.getalluser(Convert.ToInt32(phonebooklist.SelectedValue)); if (dt.Rows.Count > 0) { if (dt.Rows.Count == 1) { sms.Number = dt.Rows[0]["phone"].ToString(); recivers = dt.Rows[0]["TrueName"].ToString().Trim(); recivername += dt.Rows[0]["UserName"].ToString().Trim(); } else { for (int i = 0; i < dt.Rows.Count; i++) { sms.Number += dt.Rows[i]["phone"].ToString().Trim() + "|"; recivers += dt.Rows[i]["TrueName"].ToString().Trim() + "、"; recivername += dt.Rows[i]["UserName"].ToString().Trim() + "+"; } } } } else { if (CheckBoxList1.Items.Count == 1) { sms.Number = umg.Getuser(CheckBoxList1.Items[0].Value.ToString().Trim()).Phone; } else { for (int i = 0; i < CheckBoxList1.Items.Count; i++) { if (CheckBoxList1.Items[i].Selected) { sms.Number += umg.Getuser(CheckBoxList1.Items[i].Value.ToString().Trim()).Phone + "|"; recivers += CheckBoxList1.Items[i].Text.ToString().Trim() + "、"; recivername += CheckBoxList1.Items[i].Value.ToString().Trim() + "+"; } } } } if (sms.Number.ToString().Trim() != "") { sms.Scon = SMSContent.Text.ToString(); Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint Ipe = new IPEndPoint(IPAddress.Parse(ssm.Ip), int.Parse(ssm.Port)); try { socket.Connect(Ipe); if (socket.Connected) { MemoryStream stream = new MemoryStream(); IFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, sms); stream.Flush(); byte[] smsbyte = stream.ToArray(); socket.Send(smsbyte); byte[] reciver = new byte[128]; socket.Receive(reciver); string reciverstring = Encoding.Default.GetString(reciver).ToString().Trim(); if (Convert.ToBoolean(reciverstring)) { sucess++; } else { faild++; } } if (sucess > 0) { NoticesManager nmg = new NoticesManager(); nmg.AddNotices("", Session["username"].ToString(), recivers.Substring(0, recivers.Length - 1), SMSContent.Text.ToString(), DateTime.Now, "短信", 0, recivername.Substring(0, recivername.Length - 1)); ScriptManager.RegisterClientScriptBlock(this.UpdatePanel2, UpdatePanel2.GetType(), "", "alert('短信接发送成功')", true); SMSContent.Text = ""; for (int i = 0; i < CheckBoxList1.Items.Count; i++) { CheckBoxList1.Items[i].Selected = false; } } } catch (Exception ex) { throw ex; } } else { ScriptManager.RegisterClientScriptBlock(this.UpdatePanel2, UpdatePanel2.GetType(), "", "alert('短信接收者为空')", true); } } }
public override async Task DeleteAsync(SMS entity) { _context.SMS.Remove(entity); await _context.SaveChangesAsync(); }