private void InsertSMSClick() { var email = new EmailAddressAttribute(); var website = new UrlAttribute(); if (email.IsValid(TBoxSender)) { string[] Body = TBoxBody.Split(' '); foreach (string word in Body) { WebCheck = word; if (website.IsValid(word) || word.Contains("www")) { ListAdd Quarantine = new ListAdd(); { Quarantine.ListType = word; Quarantine.Count = "1"; } ListType = "Q"; ListQuarantine.Add(Quarantine); SaveToList Q = new SaveToList(); if (!Q.WriteToCSV(ListQuarantine, ListType)) { MessageBox.Show("Error while saving\n" + Q.ErrorCode); } else { Q = null; } WebCheck = WebCheck.Replace(WebCheck, "<URL Quarantined>"); MessageBox.Show(WebCheck); for (int x = 0; x < Body.Length; x++) { if (Body[x] == word) { Body[x] = Body[x].Replace(word, WebCheck); } } } } TBoxBody = string.Join(" ", Body); MessageBox.Show(TBoxBody); EmailAdd AddEmail = new EmailAdd(); { AddEmail.MessageID = "E" + TBoxMID; AddEmail.Sender = TBoxSender; try { AddEmail.Subject = "SIR " + DPickerContent.ToString(); check = true; } catch (Exception ex) { MessageBox.Show("Please Select a date"); check = false; } AddEmail.Body = CentreCode + "" + Incident + "" + TBoxBody; } if (check == true) { ListEmail.Add(AddEmail); SaveToFile save = new SaveToFile(); if (!save.EmailToCSV(ListEmail, MessageType)) { MessageBox.Show("Error while saving\n" + save.ErrorCode); } else { save = null; } ListAdd SIRList = new ListAdd(); { SIRList.ListType = AddEmail.Subject; SIRList.Count = "66-666-99"; } ListType = "S"; ListSIR.Add(SIRList); SaveToList SIR = new SaveToList(); if (!SIR.WriteToCSV(ListSIR, ListType)) { MessageBox.Show("Error while saving\n" + SIR.ErrorCode); } else { SIR = null; } MessageBox.Show("Order saved"); } } else { MessageBox.Show("Wrong"); } }
private void InsertSMSClick() { if (string.IsNullOrWhiteSpace(TBoxMID) || string.IsNullOrWhiteSpace(TBoxSender) || string.IsNullOrWhiteSpace(TBoxBody)) { MessageBox.Show("Please fill out all boxes please"); return; } MessageAdd AddMessage = new MessageAdd(); { AddMessage.MessageID = "T" + TBoxMID; AddMessage.Sender = "@" + TBoxSender; AddMessage.Body = TBoxBody; } ListMessage.Add(AddMessage); SaveToFile File = new SaveToFile(); if (!File.WriteToCSV(ListMessage, MessageType)) { MessageBox.Show("Error while saving\n" + File.ErrorCode); } else { File = null; } ListAdd TweetMentions = new ListAdd(); { TweetMentions.ListType = "@" + TBoxSender; TweetMentions.Count = "1"; } ListType = "M"; ListMention.Add(TweetMentions); SaveToList Mention = new SaveToList(); if (!Mention.WriteToCSV(ListMention, ListType)) { MessageBox.Show("Error while saving\n" + Mention.ErrorCode); } else { Mention = null; } string[] body = AddMessage.Body.Split(' '); foreach (string wrd in body) { if (wrd.Contains("#")) { Hashtag.Add(wrd); } } if (Hashtag.Count != 0) { foreach (string Hash in Hashtag) { ListAdd TweetHashtag = new ListAdd(); { TweetHashtag.ListType = Hash; TweetHashtag.Count = "1"; } ListType = "H"; ListHashtag.Add(TweetHashtag); SaveToList TweetHash = new SaveToList(); if (!TweetHash.WriteToCSV(ListHashtag, ListType)) { MessageBox.Show("Error while saving\n" + TweetHash.ErrorCode); } else { TweetHash = null; } } } MessageBox.Show("Order saved"); }