// GET: Product_Details/Delete/5 public ActionResult Delete(int?id) { AssessmentEntities db = new AssessmentEntities(); tweet oTwt = db.tweets.Find(id); db.tweets.Remove(oTwt); db.SaveChanges(); TweetViewModel oTwts = new TweetViewModel(); oTwts.objTweetList = GetTweetList(); oTwts.objTweet = new tweet(); oTwts.objTweet.message = string.Empty; oTwts.tweetCount = oTwts.objTweetList.Count.ToString(); string result = GetFollowingList(); oTwts.followingCount = result.Split(';')[0]; oTwts.followersCount = result.Split(';')[1]; return(View("UserDashBoard", oTwts)); }
static void Main(string[] args) { int[] h = new int[2]; string[] poc = new string [2]; string P = ""; int Mnp = 0; int Mxp = 0; tweet[] t = new tweet[10]; for (int i = 0; i < t.Length; i++) { t[i].text = "qout" + i; t[i].time = 10.0 + i / 10; } Console.WriteLine("Enter Mnp OF time && Mxp of time "); P = Console.ReadLine(); for (int i = 0; i < t.Length; i++) { ; } Mnp = Convert.ToInt32(Console.ReadLine()); Mxp = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < t.Length; i++) { if (Mnp > t[i].time && Mxp < t[i].time) { Console.WriteLine(t[i].text); } } Console.ReadKey(true); }
public void Tweet() { MainWindow mainWindow = new MainWindow(); string testHeader = "T123456789"; string testBody = "@tester This is my test body with a ROTFL textspeak example and a #testingHashtag hashtag example and a mention @steve"; mainWindow.sortMessageType(testHeader, testBody); tweet tweetAsset = new tweet(); mainWindow.assignAttributes(tweetAsset, testBody); mainWindow.removeTextspeak(tweetAsset); trendingList trending = new trendingList(); mainWindow.detectHashtags(tweetAsset, trending); mentionsList mentions = new mentionsList(); mainWindow.detectMentions(tweetAsset, mentions); Assert.AreEqual(tweetAsset.Sender, "@tester"); Assert.AreEqual(tweetAsset.Body, "This is my test body with a ROTFL <Rolling on the floor laughing> textspeak example and a #testingHashtag hashtag example and a mention @steve"); Assert.AreEqual(trending.returnValue(0), "#testingHashtag"); Assert.AreEqual(mentions.returnValue(0), "@steve"); }
static void Main(string[] args) { try { tweet a; tweet[] TW = new tweet[10]; TW = text(TW); TW = time(TW); Console.WriteLine("Введите время твита"); string[] vrema = Console.ReadLine().Split('-'); int minhours = vremya(vrema, 0, 0); int minminutes = vremya(vrema, 0, 1); int maxhours = vremya(vrema, 1, 0); int maxminutes = vremya(vrema, 1, 1); bool righttime = false; string yo = ""; for (int i = 0; i < TW.Length; i++) { if (maxhours > 24 || maxminutes > 60 || minminutes > 60 || minhours.ToString().Length != 2 || minminutes.ToString().Length != 2 || maxhours.ToString().Length != 2 || maxminutes.ToString().Length != 2) { righttime = true; break; } string[] tweettime = TW[i].time.Split(':'); int tweettimehours = Convert.ToInt32(tweettime[0]); int tweettimeminutes = Convert.ToInt32(tweettime[1]); if (minhours < tweettimehours && maxhours > tweettimehours) { yo = yo + TW[i].text; } else if ((minhours == tweettimehours && minminutes >= tweettimeminutes) || (maxhours == tweettimehours && maxminutes > tweettimeminutes)) { yo = yo + TW[i].text; } } if (righttime == false) { if (yo != "") { Console.WriteLine(yo); } else { Console.WriteLine("В данный промежуток времени твитов не было."); } } else { Console.WriteLine("Вы ошиблись при введении времени."); } } catch { Console.WriteLine("Были введены некорректные символы"); } Console.ReadKey(); }
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 void sendMessage(tweet tweet) { //Main entry point to push back data to the clients Clients.Caller.SendMessage(tweet); }