コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         TransitCounter tc = GetCounter();
         labelCounter.Text = string.Format("{0} since {1}", tc.Total, base.Adjust(tc.Created).ToString("d"));
     }
 }
コード例 #2
0
ファイル: WebStatsService.cs プロジェクト: qwdf1615/sncore
 public int CreateOrUpdateCounter(string ticket, TransitCounter counter)
 {
     return(WebServiceImpl <TransitCounter, ManagedCounter, Counter> .CreateOrUpdate(
                ticket, counter));
 }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            // topics.TopicChanged += new ViewTopicsControl.TopicChangedHandler(topics_TopicChanged);
            searchBox.Search       += new SearchControl.SearchHandler(searchBox_Search);
            dates.DateRangeChanged += new DateRangeControl.DateRangeHandler(dates_DateRangeChanged);

            if (!IsPostBack)
            {
                panelAdmin.Visible  = SessionManager.IsAdministrator;
                linkLogout2.Visible = SessionManager.IsLoggedIn;

                if (SessionManager.LoginRecord != null)
                {
                    labelUsername.Text = string.Format("logged in as {0}", Renderer.Render(
                                                           string.IsNullOrEmpty(SessionManager.LoginRecord.Name)
                            ? SessionManager.LoginRecord.Username
                            : SessionManager.LoginRecord.Name));
                }

                if (SessionManager.PostLoginRecord != null)
                {
                    labelPostUsername.Text = string.Format("post access as {0}", Renderer.Render(
                                                               string.IsNullOrEmpty(SessionManager.PostLoginRecord.Name)
                            ? SessionManager.PostLoginRecord.Username
                            : SessionManager.PostLoginRecord.Name));
                }

                imageMain.ImageUrl = SessionManager.GetSetting("image", imageMain.ImageUrl);
                imageMain.Width    = int.Parse(SessionManager.GetSetting("imagewidth", imageMain.Width.ToString()));
                imageMain.Height   = int.Parse(SessionManager.GetSetting("imageheight", imageMain.Height.ToString()));


                if (SessionManager.CountersEnabled)
                {
                    TransitCounter c = Counter;
                    labelCounter.Text = string.Format("{0} click{1} since {2}",
                                                      c.Count, c.Count != 1 ? "s" : string.Empty, c.Created.ToString("d"));
                }

                linkAtomPost.Href = string.Format("{0}AtomSvc.aspx",
                                                  SessionManager.WebsiteUrl);
                linkAtomPost.Attributes["title"] = string.Format("{0} {1}",
                                                                 SessionManager.GetSetting("title", "Untitled"),
                                                                 linkAtom.Attributes["title"]);

                linkAtom.Href = string.Format("{0}AtomBlog.aspx",
                                              SessionManager.WebsiteUrl);
                linkAtom.Attributes["title"] = string.Format("{0} {1}",
                                                             SessionManager.GetSetting("title", "Untitled"),
                                                             linkAtom.Attributes["title"]);

                linkRss.Href = string.Format("{0}RssBlog.aspx",
                                             SessionManager.WebsiteUrl);
                linkRss.Attributes["title"] = string.Format("{0} {1}",
                                                            SessionManager.GetSetting("title", "Untitled"),
                                                            linkRss.Attributes["title"]);
            }
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
コード例 #4
0
ファイル: WebStatsService.cs プロジェクト: dblock/sncore
 public int CreateOrUpdateCounter(string ticket, TransitCounter counter)
 {
     return WebServiceImpl<TransitCounter, ManagedCounter, Counter>.CreateOrUpdate(
         ticket, counter);
 }
コード例 #5
0
ファイル: WebServices.Blog.cs プロジェクト: dblock/dblog
        public TransitCounter GetHourlyCountSum(string ticket)
        {
            using (DBlog.Data.Hibernate.Session.OpenConnection(GetNewConnection()))
            {
                ISession session = DBlog.Data.Hibernate.Session.Current;

                TransitCounter tc = new TransitCounter();

                object[] result = (object[]) session.CreateQuery(
                    "SELECT SUM(hc.RequestCount), MIN(hc.DateTime) FROM HourlyCounter hc")
                    .UniqueResult();

                if (result != null)
                {
                    tc.Count = (result[0] == null) ? 0 : (long) result[0];
                    tc.Created = (result[1] == null) ? DateTime.UtcNow : (DateTime) result[1];
                }

                return tc;
            }
        }