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 = "S" + TBoxMID; AddMessage.Sender = TBoxSender; AddMessage.Body = TBoxBody; } ListMessage.Add(AddMessage); SaveToFile save = new SaveToFile(); if (!save.WriteToCSV(ListMessage, MessageType)) { MessageBox.Show("Error while saving\n" + save.ErrorCode); } else { save = null; } MessageBox.Show("Order saved"); }
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"); }