Esempio n. 1
0
 public List<APIAnalytic> GetAnalytics(int page, int perpage)
 {
     loggingDataContext db = new loggingDataContext();
     int skip = (page - 1) * perpage;
     List<APIAnalytic> analytics = db.APIAnalytics.Where(x => x.date < DateTime.Now.AddMinutes(-5)).OrderByDescending(x => x.date).Skip(skip).Take(perpage).ToList();
     return analytics;
 }
Esempio n. 2
0
 public void CheckAddresses()
 {
     loggingDataContext db = new loggingDataContext();
     List<IPtoDNS> addresses = db.IPtoDNS.Where(x => x.dnsentry == null).Take(10).ToList();
     foreach (IPtoDNS adr in addresses) {
         LookupAsync(adr.ipaddress);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Announce completion of PUT operation
 /// </summary>
 /// <param name="result"></param>
 private void LookupAsyncCompleteCallback(IAsyncResult ar)
 {
     ResolveState ioContext = (ResolveState)ar.AsyncState;
     loggingDataContext db = new loggingDataContext();
     string hostname = "unknown";
     try {
         ioContext.IPs = Dns.EndGetHostEntry(ar);
         hostname = ioContext.IPs.HostName;
     } catch { };
     IPtoDNS ip = db.IPtoDNS.Where(x => x.ipaddress.Equals(ioContext.host.Trim())).FirstOrDefault();
     if (ip != null && ip.ID > 0) {
         ip.dnsentry = hostname;
         db.SubmitChanges();
     }
     GetHostEntryFinished.Set();
 }