public string Determine() { MongoLib.MongoUtil MU = new MongoLib.MongoUtil(); List <MetricGroup> L = MU.WeeklyDetermine(); return(BuildGraph(L)); }
public string Actions() { MongoLib.MongoUtil MU = new MongoLib.MongoUtil(); List <MetricGroup> L = MU.WeeklyActions(); return(BuildHarizontalPie(L)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/xml"; string metric = context.Request.Form["m"]; string ticks = context.Request.Form["t"]; string identifier = context.Request.Form["i"]; string score = context.Request.Form["s"]; string clientIp = ""; int iTicks = 0; int iScore = 0; try { identifier = identifier ?? ""; iTicks = Convert.ToInt32(ticks); iScore = Convert.ToInt32(score); clientIp = (context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] ?? context.Request.ServerVariables["REMOTE_ADDR"]).Split(',')[0].Trim(); clientIp = (clientIp.Length < 4) ? "" : clientIp; } catch { } Metric Metric = new Metric(); Metric.Name = metric; Metric.Identifier = identifier; Metric.Time = iTicks; Metric.Date = Convert.ToInt32(DateTime.Now.ToString("yyyyMMdd")); Metric.Hours = Convert.ToInt32(DateTime.Now.ToString("HHmmss")); Metric.Host = context.Request.Url.Host; Metric.IP = clientIp; Metric.Score = iScore; Metric2 Metric2 = new Metric2 { Name = Metric.Name, Identifier = Metric.Identifier, Count = 1, Total = Metric.Time }; MongoLib.MongoUtil M = new MongoLib.MongoUtil(); if (M.Exists(metric, identifier)) { M.Update(Metric2); } else { M.Add(Metric2); } M.Add(Metric); context.Response.Write("<ok />"); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; int y = 10000; try { MongoLib.MongoUtil MU = new MongoLib.MongoUtil(); y = MU.Sum(); } catch { } context.Response.Write(y + "+"); }
private void DumpMetrics2() { string toFile = root + "Metrics2.txt"; MongoLib.MongoUtil M = new MongoLib.MongoUtil(); MongoCursor <Metric2> List = M.Metrics2(); StreamWriter sw = new StreamWriter(toFile); sw.WriteLine("Printed on " + DateTime.Now.ToString("yyyyMMdd HH:mm:ss")); { string x = MakeRecord(new object[] { "Name", "Total", "Count", "Id", "CreationTime" }); sw.WriteLine(x); } foreach (Metric2 S in List) { string x = MakeRecord(new object[] { S.Name, S.Total, S.Count, S.Id, S.Id.CreationTime.ToString("yyyyMMdd HH:mm:ss") }); sw.WriteLine(x); } sw.Close(); }
private void Subscribers() { string toFile = root + "Subscribers.txt"; MongoLib.MongoUtil M = new MongoLib.MongoUtil(); List <Subscription> List = M.Subscribers(); StreamWriter sw = new StreamWriter(toFile); sw.WriteLine("Printed on " + DateTime.Now.ToString("yyyyMMdd HH:mm:ss")); { string x = MakeRecord(new object[] { "EmailId", "Allow", "CreationTime", "Id" }); sw.WriteLine(x); } foreach (Subscription S in List) { string x = MakeRecord(new object[] { S.EmailId, S.Allow, S.Id.CreationTime.ToString("yyyyMMdd"), S.Id }); sw.WriteLine(x); } sw.Close(); }
public void ProcessRequest(HttpContext context) { string email = context.Request.Form["e"]; string go = context.Request.Form["g"]; context.Response.ContentType = "text/html"; try { MongoLib.MongoUtil MU = new MongoLib.MongoUtil(); MongoLib.MongoUtil M = new MongoLib.MongoUtil(); if (M.EmailExists(email)) { M.UpdateSubsription(new Subscription { EmailId = email, Allow = (go == "1") }); } else { M.AddSubscription(new Subscription { EmailId = email, Allow = (go == "1") }); } context.Response.Write(""); } catch { context.Response.Write(""); return; } }
private void DumpMetrics() { string toFile = root + "Metrics.txt"; MongoLib.MongoUtil M = new MongoLib.MongoUtil(); MongoCursor <Metric> List = M.Metrics(); StreamWriter sw = new StreamWriter(toFile); sw.WriteLine("Printed on " + DateTime.Now.ToString("yyyyMMdd HH:mm:ss")); { string x = MakeRecord(new object[] { "Date", "Time", "Hours", "Host", "IP", "Name", "Identifier", "Score", "Id", "CreationTime" }); sw.WriteLine(x); } foreach (Metric S in List) { string x = MakeRecord(new object[] { S.Date, S.Time, S.Hours, S.Host, S.IP, S.Name, S.Identifier, S.Score, S.Id, S.Id.CreationTime.ToString("yyyyMMdd HH:mm:ss") }); sw.WriteLine(x); } sw.Close(); }