コード例 #1
0
        private DateTime?getMinDate(String[] ids, DemoI nn)
        {
            bool     first = true;
            DateTime?dt    = null;

            for (int i = 8; (Double)i <= (Double)(ids.Count()) / 2 + 3; i++)
            {
                int            Id         = Convert.ToInt32(ids[(i - 4) * 2]); //get searchIds
                TwitterSearchI tempSearch = nn.getSearch(Id);

                if (tempSearch != null)
                {
                    DateTime temp = (DateTime)(tempSearch.searchInfomation.finishedLastTwitterDate);
                    if (first)
                    {
                        dt    = temp;
                        first = false;
                    }
                    else if (temp < dt)
                    {
                        dt = temp;
                    }
                }
            }
            return(dt);
        }
コード例 #2
0
        public ActionResult ViewSearch()
        {
            int searchId = 0;

            try
            {
                searchId = Convert.ToInt32(Request.Form["searchSelector"]);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                Response.Redirect("/search/demo");
            }
            var            mm = System.Web.HttpContext.Current.Application["demo"];
            DemoI          nn = (DemoI)mm;
            TwitterSearchI ts = nn.getSearch(searchId);

            if (ts == null)
            {
                Response.Redirect("/Search/demo");
                return(View("Demo"));
            }
            ViewBag.ts = ts;
            return(View());
        }
コード例 #3
0
        public ActionResult NewSearch()
        {
            var   mm = System.Web.HttpContext.Current.Application["demo"];
            DemoI nn = (DemoI)mm;

            if (Request.Form["back"] != null)
            {
                String         title   = Request.Unvalidated.Form["searchTitle"];
                String         include = Request.Unvalidated.Form["include"];
                String         exclude = Request.Unvalidated.Form["exclude"];
                TwitterSearchI s       = nn.createSearch(include, exclude, title);
                if (nn.addSearch(s))
                {
                    Response.Redirect("/Search/demo");
                    return(View("Demo"));
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                return(View());
            }
        }
コード例 #4
0
        public ActionResult Delete()
        {
            if (Request.Form["searchSelector"] == null)
            {
                Response.Redirect("/Search/demo");
                return(View("Demo"));
            }
            int   searchId = Convert.ToInt32(Request.Form["searchSelector"]);
            var   mm       = System.Web.HttpContext.Current.Application["demo"];
            DemoI nn       = (DemoI)mm;

            nn.deleteSearchById(searchId);
            Response.Redirect("/Search/demo");
            return(View("Demo"));
        }
コード例 #5
0
        public ActionResult ajaxTweets(List <String> ids)
        {
            if (ids == null && ids.Count <= 8)
            {
                return(null);
            }
            var           mm  = System.Web.HttpContext.Current.Application["demo"];
            DemoI         nn  = (DemoI)mm;
            List <object> tts = nn.loadTweetsForAnalyze(ids.ToArray());

            if (tts == null)
            {
                return(null);
            }
            return(Json(tts, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
        public ActionResult ViewSelectAnalyze()
        {
            var dates      = Request.Form["dates"];
            var searchList = Request.Form["searchList"];
            var laLos      = Request.Form["lalos"];

            if (dates == null || searchList == null || laLos == null)
            {
                Response.Redirect("/Search/demo");
                System.Diagnostics.Debug.WriteLine("warning check at ViewSelectAnalyze()");
                return(View("Demo"));
            }
            var   mm = System.Web.HttpContext.Current.Application["demo"];
            DemoI nn = (DemoI)mm;
            // return View("Demo");

            List <List <String> > data = nn.loadTweetsForAnalyzeSelection(dates, searchList, laLos);

            ViewBag.data = data;
            return(View());
        }
コード例 #7
0
        /*
         * based on each search's first tweet's date;
         **/
        private DateTime?getMaxDate(String[] ids, DemoI nn)
        {
            bool     first = true;
            DateTime?dt    = null;

            for (int i = 8; i <= (Double)(ids.Count()) / 2 + 3; i++)
            {
                TwitterSearchI tempSearch = nn.getSearch(Convert.ToInt32(ids[(i - 4) * 2]));
                if (tempSearch != null)
                {
                    DateTime temp = (DateTime)tempSearch.searchInfomation.firstTwitterDate;
                    if (first)
                    {
                        dt    = temp;
                        first = false;
                    }
                    else if (temp > dt)
                    {
                        dt = temp;
                    }
                }
            }
            return(dt);
        }