示例#1
0
        public Voting(pspScraper.pspPrintHistory printHistory)
        {
            creationTime = DateTime.Now;
            scrapedPrint = printHistory;

            EntityRepository.StoreToDB(this);
        }
示例#2
0
        static void Main(string[] args)
        {
            //var aMeetingProtocol = new pspMeetingProtocol("http://www.psp.cz/eknih/2010ps/stenprot/047schuz/index.htm");
            //var aTerm = new pspTerm("http://www.psp.cz/eknih/2010ps/index.htm");
            //var aPrint = new pspPrintHistory("http://www.psp.cz/sqw/historie.sqw?t=834");

            //GetAllTerms();
            DocumentStore docDB = new DocumentStore {
                Url = "http://*****:*****@"http://www.psp.cz/sqw/hlasy.sqw?g=55431");

            docDB.Initialize();
            uint lastScrapedHistoryNum = 0;

            using (var session = docDB.OpenSession())
            {
                foreach (var history in session.Query <pspPrintHistory>().ToList())
                {
                    allPrintHistories.Add(history);
                    if (history.number > lastScrapedHistoryNum)
                    {
                        lastScrapedHistoryNum = history.number;
                    }
                }
                //foreach (var member in session.Query<parliamentMember>().ToList())
                //{
                //    parliamentMembers.Add(member);
                //}
                //session.Store(voting);
                // var entity = session.Load<Company>(companyId);
                //session.SaveChanges();
            }
            TimeSpan threeMinutes = new TimeSpan(0, 0, 3, 0, 0);

            timer = new System.Threading.Timer((cs) =>
            {
                var newScrapeTry = new pspPrintHistory(@"http://www.psp.cz/sqw/historie.sqw?t=" + (lastScrapedHistoryNum + 1));
                Console.WriteLine("Tried scarping print history number {0}.", lastScrapedHistoryNum);
                timer.Dispose();
            }, null, threeMinutes, threeMinutes);


            Console.ReadLine();
        }
示例#3
0
        static void Main(string[] args)
        {
            //var aMeetingProtocol = new pspMeetingProtocol("http://www.psp.cz/eknih/2010ps/stenprot/047schuz/index.htm");
            //var aTerm = new pspTerm("http://www.psp.cz/eknih/2010ps/index.htm");
            //var aPrint = new pspPrintHistory("http://www.psp.cz/sqw/historie.sqw?t=834");

            //GetAllTerms();
            DocumentStore docDB = new DocumentStore { Url = "http://*****:*****@"http://www.psp.cz/sqw/hlasy.sqw?g=55431");
            docDB.Initialize();
            uint lastScrapedHistoryNum = 0;
            using (var session = docDB.OpenSession())
            {


                foreach (var history in session.Query<pspPrintHistory>().ToList())
                {
                    allPrintHistories.Add(history);
                    if (history.number > lastScrapedHistoryNum)
                    {
                        lastScrapedHistoryNum = history.number;
                    }
                }
                //foreach (var member in session.Query<parliamentMember>().ToList())
                //{
                //    parliamentMembers.Add(member);
                //}
                //session.Store(voting);
                // var entity = session.Load<Company>(companyId);
                //session.SaveChanges();
            }
            TimeSpan threeMinutes = new TimeSpan(0, 0, 3, 0, 0);
            timer = new System.Threading.Timer((cs) =>
            {
                var newScrapeTry = new pspPrintHistory(@"http://www.psp.cz/sqw/historie.sqw?t="+(lastScrapedHistoryNum+1));
                Console.WriteLine("Tried scarping print history number {0}.", lastScrapedHistoryNum);
                timer.Dispose();
            }, null, threeMinutes, threeMinutes);
            

            Console.ReadLine();
        }