public static TransitCounter FindByUri(ISession session, string pageviewfilename, int id, ManagedSecurityContext sec) { string uri = string.Format("{0}/{1}?id={2}", ManagedConfiguration.GetValue(session, "SnCore.WebSite.Url", "http://localhost/SnCore"), pageviewfilename, id); return(ManagedCounter.FindByUri(session, uri, sec)); }
public static TransitCounter FindByUri(ISession session, string uri, ManagedSecurityContext sec) { ManagedCounter m_counter = new ManagedCounter(); Counter counter = (Counter)session.CreateCriteria(typeof(Counter)) .Add(Expression.Eq("Uri", uri)) .UniqueResult(); if (counter == null) { counter = new Counter(); counter.Uri = uri; counter.Total = 0; counter.Created = counter.Modified = DateTime.UtcNow; } m_counter.SetInstance(session, counter); return(m_counter.GetTransitInstance(sec)); }