Ejemplo n.º 1
0
 public int GetReferrerHostsCount(string ticket, TransitReferrerHostQueryOptions options)
 {
     using (DBlog.Data.Hibernate.Session.OpenConnection(GetNewConnection()))
     {
         ISession session = DBlog.Data.Hibernate.Session.Current;
         StringCriteria criteria = new StringCriteria(session, "ReferrerHost", typeof(ReferrerHost));
         if (options != null)
         {
             options.Apply(criteria);
         }
         IQuery sqlquery = criteria.CreateQuery();
         return (int)sqlquery.List().Count;
     }
 }
Ejemplo n.º 2
0
 private TransitReferrerHostQueryOptions GetOptions()
 {
     TransitReferrerHostQueryOptions options = new TransitReferrerHostQueryOptions(grid.PageSize, grid.CurrentPageIndex);
     if (inputNewOnly.Checked) options.DateStart = DateTime.UtcNow.AddDays(-7);
     return options;
 }
Ejemplo n.º 3
0
        public List<TransitReferrerHost> GetReferrerHosts(string ticket, TransitReferrerHostQueryOptions options)
        {
            using (DBlog.Data.Hibernate.Session.OpenConnection(GetNewConnection()))
            {
                ISession session = DBlog.Data.Hibernate.Session.Current;

                ICriteria cr = session.CreateCriteria(typeof(ReferrerHost))
                    .AddOrder(Order.Desc("RequestCount"));

                if (options != null)
                {
                    options.Apply(cr);
                }

                IList<ReferrerHost> list = cr.List<ReferrerHost>();

                List<TransitReferrerHost> result = new List<TransitReferrerHost>(list.Count);

                foreach (ReferrerHost obj in list)
                {
                    result.Add(new TransitReferrerHost(obj));
                }

                return result;
            }
        }