public ActionResult SingleReport(string guid) { if (!Util.IsValidReportGuid(guid)) { return(View("NoData")); } MomaDataSet ds = db.GetReport(guid); if (ds.Applications.Count == 0) { return(View("NoData")); } SingleReportViewData model = new SingleReportViewData(); model.App = ds.Applications [0]; model.PInvokes = ds.PInvokes; model.TotalAPIs = ds.Members.Count; model.RootNode = GetNodes(ds.Members.Rows); foreach (MomaDataSet.MembersRow row in ds.Members) { model.TotalUses += row.Count; } model.TotalPInvokes = model.PInvokes.Count; foreach (MomaDataSet.PInvokesRow row in ds.PInvokes) { model.TotalPInvokeUses += row.Count; } return(View(model)); }
static void MergeRow(MomaDataSet.MembersRow row0, MomaDataSet.MembersRow other) { row0.IsFixed |= other.IsFixed; row0.IsTodo |= other.IsTodo; row0.IsMissing |= other.IsMissing; row0.IsNiex |= other.IsNiex; if (!other.IsTODOCommentNull ()) row0.TODOComment = other.TODOComment; }
public static string GetStatus(MomaDataSet.MembersRow row) { if (row.IsFixed) return "DONE"; if (row.IsTodo && row.IsNiex) return "TODO and Not Implemented"; if (row.IsTodo) return "TODO"; if (row.IsNiex) return "Not Implemented"; if (row.IsMissing) return "Missing"; throw new Exception ("This should never happen"); }
public MomaDataSet GetApiData(string apiname) { using (DbConnection cnc = GetConnection()) { DbCommand cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT m.member_id as 'MemberId' , v.version_name AS 'VersionName', m.name as 'Name', " + " CASE m.is_todo WHEN b'1' THEN TRUE ELSE FALSE END as 'IsTodo', " + " CASE m.is_missing WHEN b'1' THEN TRUE ELSE FALSE END as 'IsMissing', " + " CASE m.is_niex WHEN b'1' THEN TRUE ELSE FALSE END as 'IsNiex', " + " CASE m.is_fixed WHEN b'1' THEN TRUE ELSE FALSE END as 'IsFixed', " + " m.fixed_in_version as 'FixedInVersion', m.todo_comment as 'TodoComment' " + "FROM members m " + "INNER JOIN versions v ON v.version_id = m.version_id " + "WHERE m.name = @name"; AddParameter(cmd, "name", apiname); MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill(ds, "Members"); if (ds.Members.Rows.Count > 0) { MergeRows(ds.Members); MomaDataSet.MembersRow row = ds.Members[0]; cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT COUNT(*) AS 'TotalApps', SUM(r.count) AS 'TotalCalls' " + "FROM reports_members r " + "WHERE r.member_id = @memberid"; AddParameter(cmd, "memberid", row.MemberId); adapter = GetDataAdapter(cmd); adapter.Fill(ds, "ApiUse"); if (ds.ApiUse [0].IsTotalCallsNull()) { ds.ApiUse [0].TotalCalls = 0; } cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT r.report_id as 'ReportId', r.guid, r.submit_date as 'SubmitDate', " + " rc.totaltodo, rc.totalmissing, rc.totalniex, rc.totalpinvoke "+ "FROM reports_master r " + "INNER JOIN reports_counts rc ON rc.report_id = r.report_id " + "INNER JOIN reports_members rm ON r.report_id = rm.report_id AND rm.member_id = @member_id " + "ORDER BY submitdate DESC"; AddParameter(cmd, "member_id", row.MemberId); adapter = GetDataAdapter(cmd); adapter.Fill(ds, "Applications"); } return(ds); } }
public MomaDataSet GetApiData(string apiname) { using (DbConnection cnc = GetConnection ()) { DbCommand cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT m.member_id as 'MemberId' , v.version_name AS 'VersionName', m.name as 'Name', " + " CASE m.is_todo WHEN b'1' THEN TRUE ELSE FALSE END as 'IsTodo', " + " CASE m.is_missing WHEN b'1' THEN TRUE ELSE FALSE END as 'IsMissing', " + " CASE m.is_niex WHEN b'1' THEN TRUE ELSE FALSE END as 'IsNiex', " + " CASE m.is_fixed WHEN b'1' THEN TRUE ELSE FALSE END as 'IsFixed', " + " m.fixed_in_version as 'FixedInVersion', m.todo_comment as 'TodoComment' " + "FROM members m " + "INNER JOIN versions v ON v.version_id = m.version_id " + "WHERE m.name = @name"; AddParameter (cmd, "name", apiname); MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill (ds, "Members"); if (ds.Members.Rows.Count > 0) { MergeRows (ds.Members); MomaDataSet.MembersRow row = ds.Members[0]; cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT COUNT(*) AS 'TotalApps', SUM(r.count) AS 'TotalCalls' " + "FROM reports_members r " + "WHERE r.member_id = @memberid"; AddParameter (cmd, "memberid", row.MemberId); adapter = GetDataAdapter(cmd); adapter.Fill (ds, "ApiUse"); if (ds.ApiUse [0].IsTotalCallsNull ()) ds.ApiUse [0].TotalCalls = 0; cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT r.report_id as 'ReportId', r.guid, r.submit_date as 'SubmitDate', " + " rc.totaltodo, rc.totalmissing, rc.totalniex, rc.totalpinvoke " + "FROM reports_master r " + "INNER JOIN reports_counts rc ON rc.report_id = r.report_id " + "INNER JOIN reports_members rm ON r.report_id = rm.report_id AND rm.member_id = @member_id " + "ORDER BY submitdate DESC"; AddParameter (cmd, "member_id", row.MemberId); adapter = GetDataAdapter(cmd); adapter.Fill (ds, "Applications"); } return ds; } }
public MomaDataSet GetReport(string guid) { using (DbConnection cnc = GetConnection()) { DbCommand cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT report_id AS 'ReportId', submit_date AS 'SubmitDate', " + " ip, definitions, reported_by AS 'ReportedBy', email, "+ " organization, homepage, comment, guid "+ "FROM reports_master " + "WHERE guid = @guid"; AddParameter(cmd, "guid", guid); MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill(ds, "Applications"); if (ds.Applications.Count == 1) { cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT r.name, r.count, " + " CASE r.is_todo WHEN b'1' THEN TRUE ELSE FALSE END as 'IsTodo', " + " CASE r.is_missing WHEN b'1' THEN TRUE ELSE FALSE END as 'IsMissing', " + " CASE r.is_niex WHEN b'1' THEN TRUE ELSE FALSE END as 'IsNiex', " + " CASE r.is_fixed WHEN b'1' THEN TRUE ELSE FALSE END as 'IsFixed' " + "FROM reports_view r " + "WHERE r.report_id = @report_id AND r.is_fixed = FALSE " + "ORDER BY r.count DESC"; AddParameter(cmd, "report_id", ds.Applications [0].ReportId); adapter = GetDataAdapter(cmd); adapter.Fill(ds, "Members"); cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT library_name as 'Library', function_name as 'Function', count " + "FROM reports_pinvoke " + "WHERE report_id = @report_id " + "ORDER BY count DESC,library_name"; AddParameter(cmd, "report_id", ds.Applications [0].ReportId); adapter = GetDataAdapter(cmd); adapter.Fill(ds, "PInvokes"); } return(ds); } }
public MomaDataSet GetPagedReports(int page) { using (DbConnection cnc = GetConnection()) { DbCommand cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT rm.report_id AS 'ReportId', rm.submit_date as 'SubmitDate', rm.definitions, rm.guid, " + "rc.TotalMissing, rc.TotalTodo, rc.TotalNiex, rc.TotalPInvoke " + "FROM reports_master rm " + "INNER JOIN reports_counts rc ON rc.report_id = rm.report_id " + "ORDER BY submit_date DESC " + "LIMIT @offset,@pagesize"; AddParameter (cmd, "offset", (page - 1) * PageSize); AddParameter (cmd, "pagesize", PageSize); MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill (ds, "Applications"); return ds; } }
public MomaDataSet GetPagedReports(int page) { using (DbConnection cnc = GetConnection()) { DbCommand cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT rm.report_id AS 'ReportId', rm.submit_date as 'SubmitDate', rm.definitions, rm.guid, " + "rc.TotalMissing, rc.TotalTodo, rc.TotalNiex, rc.TotalPInvoke " + "FROM reports_master rm " + "INNER JOIN reports_counts rc ON rc.report_id = rm.report_id " + "ORDER BY submit_date DESC " + "LIMIT @offset,@pagesize"; AddParameter(cmd, "offset", (page - 1) * PageSize); AddParameter(cmd, "pagesize", PageSize); MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill(ds, "Applications"); return(ds); } }
static void MergeRows(MomaDataSet.MembersDataTable tbl) { int count = tbl.Count; if (count == 1) return; if (count > 4 || count <= 0) throw new Exception ("This should not happen"); MomaDataSet.MembersRow row0 = tbl [0]; MergeRow (row0, tbl [1]); if (count > 2) MergeRow (row0, tbl [2]); if (count > 3) MergeRow (row0, tbl [3]); while (count > 1) { tbl.Rows.RemoveAt (1); count--; } }
public MomaDataSet GetTree() { using (DbConnection cnc = GetConnection()) { DbCommand cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT r.name, " + " CASE r.is_todo WHEN b'1' THEN TRUE ELSE FALSE END AS 'IsTodo', " + " CASE r.is_missing WHEN b'1' THEN TRUE ELSE FALSE END AS 'IsMissing', " + " CASE r.is_niex WHEN b'1' THEN TRUE ELSE FALSE END AS 'IsNiex', " + " 0 AS 'Count' " + "FROM reports_view r " + "WHERE r.is_fixed = 0 " + "GROUP BY r.member_id " + "ORDER BY r.name "; MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill(ds, "Members"); return(ds); } }
// // GET: /Applications/ public ActionResult Index(int?page) { if (page == null) { return(View("NoData")); } MomaDataSet ds = db.GetPagedReports((int)page); if (ds.Applications.Count == 0) { return(View("NoData")); } ReportsViewData model = new ReportsViewData(); int total = db.GetCountTotal(); model.Title = "Report List"; model.Data = ds; model.Pager = new Pager(ds.Applications.Rows, (int)page, db.PageSize, total); return(View(model)); }
public MomaDataSet GetTree() { using (DbConnection cnc = GetConnection ()) { DbCommand cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT r.name, " + " CASE r.is_todo WHEN b'1' THEN TRUE ELSE FALSE END AS 'IsTodo', " + " CASE r.is_missing WHEN b'1' THEN TRUE ELSE FALSE END AS 'IsMissing', " + " CASE r.is_niex WHEN b'1' THEN TRUE ELSE FALSE END AS 'IsNiex', " + " 0 AS 'Count' " + "FROM reports_view r " + "WHERE r.is_fixed = 0 " + "GROUP BY r.member_id " + "ORDER BY r.name "; MomaDataSet ds = new MomaDataSet (); DbDataAdapter adapter = GetDataAdapter (cmd); adapter.Fill (ds, "Members"); return ds; } }
MomaDataSet GetPInvoke(int page, bool sort_by_use) { string sort_clause = (sort_by_use) ? "ORDER BY 2 DESC, 1 DESC " : "ORDER BY 1 DESC, 2 DESC "; using (DbConnection cnc = GetConnection()) { DbCommand cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT COUNT(DISTINCT(r.report_id)) AS 'PerAppCount', SUM(r.count) AS 'TotalCount', " + "r.library_name as 'Library', r.function_name AS 'Function' " + "FROM reports_pinvoke r " + "GROUP BY r.function_name,r.library_name " + sort_clause + "LIMIT @offset,@pagesize"; AddParameter(cmd, "offset", (page - 1) * PageSize); AddParameter(cmd, "pagesize", PageSize); MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill(ds, "Report"); return(ds); } }
MomaDataSet GetTODO(int page, bool sort_by_use) { string sort_clause = (sort_by_use) ? "ORDER BY 2 DESC, 1 DESC " : "ORDER BY 1 DESC, 2 DESC "; using (DbConnection cnc = GetConnection()) { DbCommand cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT COUNT(DISTINCT(r.report_id)) AS 'PerAppCount', SUM(r.count) AS 'TotalCount', " + "r.name AS 'APIName' " + "FROM reports_view r " + "WHERE r.is_todo = TRUE AND r.is_fixed = FALSE " + "GROUP BY r.member_id " + sort_clause + "LIMIT @offset,@pagesize"; AddParameter(cmd, "offset", (page - 1) * PageSize); AddParameter(cmd, "pagesize", PageSize); MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill(ds, "Report"); return(ds); } }
MomaDataSet GetPInvoke(int page, bool sort_by_use) { string sort_clause = (sort_by_use) ? "ORDER BY 2 DESC, 1 DESC " : "ORDER BY 1 DESC, 2 DESC "; using (DbConnection cnc = GetConnection()) { DbCommand cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT COUNT(DISTINCT(r.report_id)) AS 'PerAppCount', SUM(r.count) AS 'TotalCount', " + "r.library_name as 'Library', r.function_name AS 'Function' " + "FROM reports_pinvoke r " + "GROUP BY r.function_name,r.library_name " + sort_clause + "LIMIT @offset,@pagesize"; AddParameter (cmd, "offset", (page - 1) * PageSize); AddParameter (cmd, "pagesize", PageSize); MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill (ds, "Report"); return ds; } }
public MomaDataSet GetHomeData() { using (DbConnection cnc = GetConnection()) { DbCommand cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT 'No issues' AS 'Title', COUNT(*) as 'Apps' " + "FROM reports_counts " + "WHERE TotalProblems = 0 " + "UNION " + "SELECT 'Between 1 and 3', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems >= 1 AND TotalProblems <= 3 " + "UNION " + "SELECT 'Between 4 and 10', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems >= 4 AND TotalProblems <= 10 " + "UNION " + "SELECT 'Between 11 and 30', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems >= 11 AND TotalProblems <= 30 " + "UNION " + "SELECT 'Between 31 and 50', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems >= 31 AND TotalProblems <= 50 " + "UNION " + "SELECT 'More than 50', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems > 50"; MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill(ds, "ByIssue"); foreach (MomaDataSet.ByIssueRow row in ds.ByIssue.Rows) { row.Title = String.Format("{0} ({1})", row.Title, row.Apps); } cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT 'No issues' AS 'Title', COUNT(*) as 'Apps' " + "FROM reports_counts " + "WHERE TotalProblems - TotalPInvoke = 0 " + "UNION " + "SELECT 'Between 1 and 3', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalPInvoke >= 1 AND TotalProblems - TotalPInvoke <= 3 " + "UNION " + "SELECT 'Between 4 and 10', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalPInvoke >= 4 AND TotalProblems - TotalPInvoke <= 10 " + "UNION " + "SELECT 'Between 11 and 30', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalPInvoke >= 11 AND TotalProblems - TotalPInvoke <= 30 " + "UNION " + "SELECT 'Between 31 and 50', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalPInvoke >= 31 AND TotalProblems - TotalPInvoke <= 50 " + "UNION " + "SELECT 'More than 50', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalPInvoke > 50"; adapter = GetDataAdapter(cmd); adapter.Fill(ds, "ByIssueNoPInvoke"); foreach (MomaDataSet.ByIssueNoPInvokeRow row in ds.ByIssueNoPInvoke.Rows) { row.Title = String.Format("{0} ({1})", row.Title, row.Apps); } cmd = cnc.CreateCommand(); cmd.CommandText = "SELECT 'No issues' AS 'Title', COUNT(*) as 'Apps' " + "FROM reports_counts " + "WHERE TotalProblems - TotalTodo = 0 " + "UNION " + "SELECT 'Between 1 and 3', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalTodo >= 1 AND TotalProblems - TotalTodo <= 3 " + "UNION " + "SELECT 'Between 4 and 10', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalTodo >= 4 AND TotalProblems - TotalTodo <= 10 " + "UNION " + "SELECT 'Between 11 and 30', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalTodo >= 11 AND TotalProblems - TotalTodo <= 30 " + "UNION " + "SELECT 'Between 31 and 50', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalTodo >= 31 AND TotalProblems - TotalTodo <= 50 " + "UNION " + "SELECT 'More than 50', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalTodo > 50"; adapter = GetDataAdapter(cmd); adapter.Fill(ds, "ByIssueNoTodo"); foreach (MomaDataSet.ByIssueNoTodoRow row in ds.ByIssueNoTodo.Rows) { row.Title = String.Format("{0} ({1})", row.Title, row.Apps); } return(ds); } }
public MomaDataSet GetHomeData() { using (DbConnection cnc = GetConnection ()) { DbCommand cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT 'No issues' AS 'Title', COUNT(*) as 'Apps' " + "FROM reports_counts " + "WHERE TotalProblems = 0 " + "UNION " + "SELECT 'Between 1 and 3', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems >= 1 AND TotalProblems <= 3 " + "UNION " + "SELECT 'Between 4 and 10', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems >= 4 AND TotalProblems <= 10 " + "UNION " + "SELECT 'Between 11 and 30', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems >= 11 AND TotalProblems <= 30 " + "UNION " + "SELECT 'Between 31 and 50', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems >= 31 AND TotalProblems <= 50 " + "UNION " + "SELECT 'More than 50', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems > 50"; MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill (ds, "ByIssue"); foreach (MomaDataSet.ByIssueRow row in ds.ByIssue.Rows) row.Title = String.Format ("{0} ({1})", row.Title, row.Apps); cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT 'No issues' AS 'Title', COUNT(*) as 'Apps' " + "FROM reports_counts " + "WHERE TotalProblems - TotalPInvoke = 0 " + "UNION " + "SELECT 'Between 1 and 3', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalPInvoke >= 1 AND TotalProblems - TotalPInvoke <= 3 " + "UNION " + "SELECT 'Between 4 and 10', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalPInvoke >= 4 AND TotalProblems - TotalPInvoke <= 10 " + "UNION " + "SELECT 'Between 11 and 30', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalPInvoke >= 11 AND TotalProblems - TotalPInvoke <= 30 " + "UNION " + "SELECT 'Between 31 and 50', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalPInvoke >= 31 AND TotalProblems - TotalPInvoke <= 50 " + "UNION " + "SELECT 'More than 50', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalPInvoke > 50"; adapter = GetDataAdapter(cmd); adapter.Fill (ds, "ByIssueNoPInvoke"); foreach (MomaDataSet.ByIssueNoPInvokeRow row in ds.ByIssueNoPInvoke.Rows) row.Title = String.Format ("{0} ({1})", row.Title, row.Apps); cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT 'No issues' AS 'Title', COUNT(*) as 'Apps' " + "FROM reports_counts " + "WHERE TotalProblems - TotalTodo = 0 " + "UNION " + "SELECT 'Between 1 and 3', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalTodo >= 1 AND TotalProblems - TotalTodo <= 3 " + "UNION " + "SELECT 'Between 4 and 10', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalTodo >= 4 AND TotalProblems - TotalTodo <= 10 " + "UNION " + "SELECT 'Between 11 and 30', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalTodo >= 11 AND TotalProblems - TotalTodo <= 30 " + "UNION " + "SELECT 'Between 31 and 50', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalTodo >= 31 AND TotalProblems - TotalTodo <= 50 " + "UNION " + "SELECT 'More than 50', COUNT(*) " + "FROM reports_counts " + "WHERE TotalProblems - TotalTodo > 50"; adapter = GetDataAdapter(cmd); adapter.Fill (ds, "ByIssueNoTodo"); foreach (MomaDataSet.ByIssueNoTodoRow row in ds.ByIssueNoTodo.Rows) row.Title = String.Format ("{0} ({1})", row.Title, row.Apps); return ds; } }
public MomaDataSet GetReport(string guid) { using (DbConnection cnc = GetConnection()) { DbCommand cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT report_id AS 'ReportId', submit_date AS 'SubmitDate', " + " ip, definitions, reported_by AS 'ReportedBy', email, " + " organization, homepage, comment, guid " + "FROM reports_master " + "WHERE guid = @guid"; AddParameter (cmd, "guid", guid); MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill (ds, "Applications"); if (ds.Applications.Count == 1) { cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT r.name, r.count, " + " CASE r.is_todo WHEN b'1' THEN TRUE ELSE FALSE END as 'IsTodo', " + " CASE r.is_missing WHEN b'1' THEN TRUE ELSE FALSE END as 'IsMissing', " + " CASE r.is_niex WHEN b'1' THEN TRUE ELSE FALSE END as 'IsNiex', " + " CASE r.is_fixed WHEN b'1' THEN TRUE ELSE FALSE END as 'IsFixed' " + "FROM reports_view r " + "WHERE r.report_id = @report_id AND r.is_fixed = FALSE " + "ORDER BY r.count DESC"; AddParameter (cmd, "report_id", ds.Applications [0].ReportId); adapter = GetDataAdapter (cmd); adapter.Fill (ds, "Members"); cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT library_name as 'Library', function_name as 'Function', count " + "FROM reports_pinvoke " + "WHERE report_id = @report_id " + "ORDER BY count DESC,library_name"; AddParameter (cmd, "report_id", ds.Applications [0].ReportId); adapter = GetDataAdapter (cmd); adapter.Fill (ds, "PInvokes"); } return ds; } }
public ActionResult Index() { MomaDataSet ds = db.GetHomeData(); return(View(ds)); }
SummaryViewData GetModel(string report_name, string type, int pageno) { string title = GetTitleFromType(type); if (title == null) { return(null); } int total; SummaryViewData model = new SummaryViewData(); model.ApiLinkColumn = 2; model.Title = title; model.Columns = new int [] { 0, 1, 2 }; MomaDataSet ds = null; string val = report_name + "-" + type; switch (val) { case "byapp-missing": total = db.GetCountMissingMembers(); ds = db.GetMissingByApplication(pageno); model.Pager = new Pager(ds.Report.Rows, pageno, db.PageSize, total); model.Data = ds; break; case "byuse-missing": total = db.GetCountMissingMembers(); ds = db.GetMissingByUse(pageno); model.Columns = new int [] { 1, 0, 2 }; model.Pager = new Pager(ds.Report.Rows, pageno, db.PageSize, total); model.Data = ds; break; case "byapp-todo": total = db.GetCountTODOMembers(); ds = db.GetTODOByApplication(pageno); model.Pager = new Pager(ds.Report.Rows, pageno, db.PageSize, total); model.Data = ds; break; case "byuse-todo": total = db.GetCountTODOMembers(); ds = db.GetTODOByUse(pageno); model.Columns = new int [] { 1, 0, 2 }; model.Pager = new Pager(ds.Report.Rows, pageno, db.PageSize, total); model.Data = ds; break; case "byapp-niex": total = db.GetCountNIEXMembers(); ds = db.GetNIEXByApplication(pageno); model.Pager = new Pager(ds.Report.Rows, pageno, db.PageSize, total); model.Data = ds; break; case "byuse-niex": total = db.GetCountNIEXMembers(); ds = db.GetNIEXByUse(pageno); model.Columns = new int [] { 1, 0, 2 }; model.Pager = new Pager(ds.Report.Rows, pageno, db.PageSize, total); model.Data = ds; break; case "byapp-pinvoke": total = db.GetCountApplicationsWithPInvoke(); ds = db.GetPInvokeByApplication(pageno); model.Pager = new Pager(ds.Report.Rows, pageno, db.PageSize, total); model.Data = ds; model.ApiLinkColumn = -1; break; case "byuse-pinvoke": total = db.GetCountApplicationsWithPInvoke(); ds = db.GetPInvokeByUse(pageno); model.Columns = new int [] { 1, 0, 2 }; model.Pager = new Pager(ds.Report.Rows, pageno, db.PageSize, total); model.Data = ds; model.ApiLinkColumn = -1; break; default: return(null); } if (model.Pager.PageIndex > model.Pager.TotalPages) { return(null); } return(model); }
MomaDataSet GetTODO(int page, bool sort_by_use) { string sort_clause = (sort_by_use) ? "ORDER BY 2 DESC, 1 DESC " : "ORDER BY 1 DESC, 2 DESC "; using (DbConnection cnc = GetConnection()) { DbCommand cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT COUNT(DISTINCT(r.report_id)) AS 'PerAppCount', SUM(r.count) AS 'TotalCount', " + "r.name AS 'APIName' " + "FROM reports_view r " + "WHERE r.is_todo = TRUE AND r.is_fixed = FALSE " + "GROUP BY r.member_id " + sort_clause + "LIMIT @offset,@pagesize"; AddParameter (cmd, "offset", (page - 1) * PageSize); AddParameter (cmd, "pagesize", PageSize); MomaDataSet ds = new MomaDataSet(); DbDataAdapter adapter = GetDataAdapter(cmd); adapter.Fill (ds, "Report"); return ds; } }