public string[] GetAllLogNames() { System.Collections.Generic.IList <string> allLogs = new System.Collections.Generic.List <string>(); using (EventLogSession logSession = new EventLogSession()) { IEnumerable <string> logNames = logSession.GetLogNames(); foreach (string logName in logNames) { using (EventLogConfiguration logConfig = new EventLogConfiguration(logName)) { if (logConfig.IsEnabled) { allLogs.Add(logName); } } } } return(allLogs.Cast <string>().ToArray()); }
public ActionResult loadGrid(String Uni, int Year, String Location, String Type, String SubType) { SearchViewModel model = new SearchViewModel(); model.PageSize = 25; int columns = 0; String sql = "Select "; if (SubType.Equals("All")) { sql = sql + "*"; } else { sql = sql + SubType; } int flag = 0; Type = (Type == "Criminal Offense") ? "Criminal_Offense" : Type; sql = sql + " from " + Type + " where id in (select id from locationyear where name = '" + Uni + "' AND year = " + Year + " AND location = '" + Location + "')"; //var temp; //Console.WriteLine(sql); List <string> tempList = new List <string>(); if (Type == "Discipline") { flag = 1; var temp = new System.Collections.Generic.List <Discipline>(); tempList.Add("id"); tempList.Add("drug"); tempList.Add("weapon"); tempList.Add("liquor"); model.generalList = temp.Cast <object>().ToList(); } else if (Type == "Arrests") { flag = 2; tempList.Add("id"); tempList.Add("drug"); tempList.Add("weapon"); tempList.Add("liquor"); var temp = new System.Collections.Generic.List <Arrests>(); model.generalList = temp.Cast <object>().ToList(); } else if (Type == "Criminal_Offense") { flag = 3; tempList.Add("id"); tempList.Add("burgla"); tempList.Add("murd"); tempList.Add("vehic"); tempList.Add("neg_m"); tempList.Add("robbe"); tempList.Add("forcib"); tempList.Add("nonfor"); tempList.Add("agg_a"); tempList.Add("arson"); var temp = new System.Collections.Generic.List <Criminal_Offense>(); model.generalList = temp.Cast <object>().ToList(); } else if (Type == ("VAWA")) { flag = 4; tempList.Add("id"); tempList.Add("stalk"); tempList.Add("dating"); tempList.Add("domest"); var temp = new System.Collections.Generic.List <VAWA>(); model.generalList = temp.Cast <object>().ToList(); } //new System.Collections.Generic.List<Discipline>(); //model.Location.Add(new LocYear(2014, "UF", "FL", "Campus")); model.PageSize = 25; int class_type = 0; using (connection) { connection.Open(); //string sql = "Select NAME, STATE, YEAR, LOCATION FROM LOCATIONYEAR WHERE STATE = 'FL'"; OracleCommand cmd = new OracleCommand(sql, connection); cmd.CommandType = System.Data.CommandType.Text; OracleDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { switch (flag) { case 1: Discipline di = new Discipline(reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2), reader.GetInt32(3)); class_type = 1; columns = 4; model.generalList.Add(di); break; case 2: Arrests ar = new Arrests(reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2), reader.GetInt32(3)); columns = 4; class_type = 2; model.generalList.Add(ar); break; case 3: Criminal_Offense co = new Criminal_Offense(reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2), reader.GetInt32(3), reader.GetInt32(4), reader.GetInt32(5), reader.GetInt32(6), reader.GetInt32(7), reader.GetInt32(8), reader.GetInt32(9)); columns = 10; class_type = 3; model.generalList.Add(co); break; case 4: VAWA va = new VAWA(reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2), reader.GetInt32(3)); columns = 4; class_type = 4; model.generalList.Add(va); break; } //; } connection.Close(); } ViewBag.NbColumns = columns; ViewBag.Tlist = tempList; ViewBag.Class_Type = class_type; return(View("loadGrid", new Tuple <SearchViewModel, Discipline>(model, null))); //return Json(model); }
public string[] GetAllLogNames() { System.Collections.Generic.IList<string> allLogs = new System.Collections.Generic.List<string>(); using (EventLogSession logSession = new EventLogSession()) { IEnumerable<string> logNames = logSession.GetLogNames(); foreach (string logName in logNames) { using (EventLogConfiguration logConfig = new EventLogConfiguration(logName)) { if (logConfig.IsEnabled) { allLogs.Add(logName); } } } } return allLogs.Cast<string>().ToArray(); }