Example #1
0
        private void doQueryPage()
        {
            int page = int.Parse(Req.Params["page"]);
            List <SqlDict.ChangeItem> changes;
            DateTime dtStart = DateTime.UtcNow;

            using (SqlDict.History hist = new SqlDict.History())
            {
                changes = hist.GetChangePage(page * 100, 100);
            }
            TimeSpan     ts  = DateTime.UtcNow.Subtract(dtStart);
            QueryPageRes res = new QueryPageRes();

            res.Summary = "Query executed in " + ((int)ts.TotalMilliseconds) + " msec; " + changes.Count + " results.";
            foreach (SqlDict.ChangeItem ci in changes)
            {
                res.Items.Add(new HistoryItem
                {
                    When = ci.When.ToShortDateString() + " " + ci.When.ToLongTimeString(),
                    Head = ci.EntryHead,
                    Note = ci.Note,
                    Code = (int)ci.ChangeType,
                });
            }

            // Tell our caller
            Res = res;
        }
Example #2
0
        private void loadHistory(string rel)
        {
            // Page size: from private config
            AppSettingsReader asr = new AppSettingsReader();

            histPageSize = (int)asr.GetValue("historyPageSize", typeof(int));

            // Page ID from URL
            rel = rel.Replace("edit/history", "");
            if (rel.StartsWith("/"))
            {
                rel = rel.Substring(1);
            }
            rel = rel.Replace("page-", "");
            if (rel != "")
            {
                int.TryParse(rel, out histPageIX);
            }
            if (histPageIX == -1)
            {
                histPageIX = 0;
            }
            else
            {
                --histPageIX;  // Humans count from 1
            }
            // Retrieve data from DB
            using (SqlDict.History hist = new SqlDict.History())
            {
                histPageCount = hist.GetChangeCount() / histPageSize + 1;
                histChanges   = hist.GetChangePage(histPageIX * histPageSize, histPageSize);
            }
        }
Example #3
0
        private void loadData()
        {
            // Page size: from private config
            AppSettingsReader asr = new AppSettingsReader();

            pageSize = (int)asr.GetValue("historyPageSize", typeof(int));

            // Page ID from request?
            string pageId = Request.Params["page"];

            if (pageId != null)
            {
                int.TryParse(pageId, out pageIX);
            }
            if (pageIX == -1)
            {
                pageIX = 0;
            }
            else
            {
                --pageIX;  // Humans count from 1
            }
            // Retrieve data from DB
            using (SqlDict.History hist = new SqlDict.History())
            {
                pageCount = hist.GetChangeCount() / pageSize + 1;
                changes   = hist.GetChangePage(pageIX * pageSize, pageSize);
            }
        }