Example #1
0
        public override void TimerTick()
        {
            var db = YandexParser.GetYandexCompetitorDB();

            if (db.Items.Count > 0 && db.Items.First().Date == DateTime.Today)
            {
                return;
            }
            Task.Factory.StartNew(() => {
                for (int i = 0; i < Phrases.YandexCompetitors.Count; i++)
                {
                    var competitor = YandexParser.GetYandexCompetitors(i);
                    db.Add(competitor);
                    Thread.Sleep(60000);
                }
                db.Save();
            });
        }
Example #2
0
        public ActionResult SeCompetitors()
        {
            var db    = YandexParser.GetYandexCompetitorDB();
            var model = new JsTableVM {
                Columns = { { "Дата",    "date-rus" },
                            { "Фраза",   null       },
                            { "Директ",  null       },
                            { "Яндекс",  null       },
                            { "AdWords", null       },
                            { "Google",  null       } },
                Title = "Конкуренты",
                Rows  = db.Items.Select(x => _.List <object>(
                                            x.Date.ToString("dd.MM.yy"),
                                            Phrases.YandexCompetitors[x.PhraseId],
                                            x.Direct.JoinWith("<br/>"),
                                            GetList(x.YandexSearch),
                                            x.AdWords.JoinWith("<br/>"),
                                            GetList(x.GoogleSearch)
                                            ))
            };

            return(View(ViewNames.JsTable, model));
        }