public ActionResult Login2()
        {
            int    st         = 0;
            string tid        = this.Request.QueryString["ticketid"];
            string ttype      = this.Request.QueryString["ttype"];
            string assignedto = this.Request.QueryString["assignedto"];
            string tdetails   = this.Request.QueryString["tdetails"];
            string tweeid     = this.Request.QueryString["tweetid"];
            string status     = this.Request.QueryString["status"];
            int    tickid     = Int32.Parse(tid);
            string tdate      = DateTime.Now.Date.ToString();//this.Request.QueryString["tdate"];


            if (!String.IsNullOrEmpty(ttype))
            {
                st = MySqlDatabase.InsertTicket(tickid, ttype, tweeid, tdetails, tdate, assignedto, status);
            }

            if (st == 1)
            {
                NoSqlDatabase.UpdateResponseStatus(Decimal.Parse(tweeid), status);
            }

            ViewBag.Tweetid = tweeid;

            List <Tweets> myTweets = NoSqlDatabase.GetAllTweets(DateTime.MinValue, DateTime.MinValue, null);

            ViewBag.MyTweets = myTweets;


            return(View("Tweets"));
        }
        public ActionResult HelloWorld()
        {
            List <Tweets> tweetList = TwitterAPI.GetTweetList();

            foreach (Tweets tweet in tweetList)
            {
                NoSqlDatabase.InsertSingleTweet(tweet);
            }
            ViewBag.status = "Success";
            return(View("Contact"));
        }
예제 #3
0
        public static List <Tweets> GetTweetList()
        {
            LastTweetInfo lastTweetInfo = NoSqlDatabase.GetLastTweetId();

            decimal TweetIdBefore = lastTweetInfo.TweetId;
            decimal TweetIdAfter  = 0;


            OAuthTokens tokens = new OAuthTokens();

            tokens.ConsumerKey       = Constants.TwitterOAuthConsumerKey;
            tokens.ConsumerSecret    = Constants.TwitterOAuthConsumerSecret;
            tokens.AccessToken       = Constants.TwitterOAuthAccessToken;
            tokens.AccessTokenSecret = Constants.TwitterOAuthAccessTokenSecret;

            SearchOptions options = new SearchOptions();

            options.SinceId = TweetIdBefore;
            //options.SinceId = 932808858153639937;

            options.ResultType = SearchOptionsResultType.Recent;

            TwitterResponse <TwitterSearchResultCollection> result = TwitterSearch.Search(tokens, Constants.TwitterSearchQuery, options);


            decimal       userid       = 0;
            List <Tweets> resultTweets = new List <Tweets>();

            foreach (var myresult in result.ResponseObject)
            {
                userid = myresult.User.Id;
                double sentimentScore = AzureAPI.getSentimentScore(myresult.Text);

                string tweetLink = string.Format(Constants.TwitterMessageLink, myresult.User.ScreenName, myresult.StringId);

                resultTweets.Add(TwitterAPI.BuildTweet(myresult.Id, tweetLink, myresult.CreatedDate, myresult.Text, sentimentScore, Constants.DefaultTweetStatus));
            }

            //TweetIdAfter = result.ResponseObject.OrderByDescending(tweets => tweets.Id).First().Id;
            TweetIdAfter = resultTweets.Count == 0 ? 0 : resultTweets.OrderByDescending(tweets => tweets.TweetId).First().TweetId;

            if (TweetIdAfter != 0)
            {
                NoSqlDatabase.UpdateLastTweetId(lastTweetInfo.Id, TweetIdAfter);
            }

            return(resultTweets);
        }
        public ActionResult Tweets()
        {
            string fromDateParam = this.Request.QueryString["startdate"];
            string toDateParam   = this.Request.QueryString["enddate"];
            string sentTypeParam = this.Request.QueryString["sentitype"];

            DateTime fromDate = string.IsNullOrEmpty(fromDateParam) ? DateTime.MinValue : Convert.ToDateTime(string.Format("{0} 12:00:00 AM", fromDateParam));
            DateTime toDate   = string.IsNullOrEmpty(toDateParam) ? DateTime.MinValue : Convert.ToDateTime(string.Format("{0} 11:59:59 PM", toDateParam));

            List <Tweets> myTweets = NoSqlDatabase.GetAllTweets(fromDate, toDate, sentTypeParam);

            ViewBag.MyTweets = myTweets;



            ViewBag.Message = "Jithin";

            return(View());
        }
        public ActionResult Welcomee()
        {
            string param1 = this.Request.QueryString["username"];
            string param2 = this.Request.QueryString["password"];

            if (param1 == "admin" && param2 == "admin")
            {
                List <Tweets> myTweets = NoSqlDatabase.GetAllTweets(DateTime.MinValue, DateTime.MinValue, null);

                ViewBag.MyTweets = myTweets;



                return(View("Tweets"));
            }
            else
            {
                ViewBag.Message = "wrong password";
                return(View("login1"));
            }
        }