APIReport.aspx, APIReport.aspx.cs: Implemented the API report view, filterable on issue type.

Overview.aspx: Cache the database results.  Highlight important reports.

ReportView.aspx, ReportView.aspx.cs: Cache database results.  No need to look up some controls by name when they're in an UpdatePanel.

Submissions.aspx, Submissions.aspx.cs: Cache database results.  Enable filtering on report importance.

svn path=/trunk/moma-tool/; revision=117384
This commit is contained in:
Dick Porter 2008-10-29 17:33:26 +00:00
Родитель df15e4237c
Коммит 2c371e8757
8 изменённых файлов: 145 добавлений и 41 удалений

Просмотреть файл

@ -1,7 +1,42 @@
<%@ Page Language="C#" MasterPageFile="~/MoMA.master" AutoEventWireup="true" CodeFile="APIReport.aspx.cs" Inherits="APIReport" Title="Untitled Page" %> <%@ Page Language="C#" MasterPageFile="~/MoMA.master" AutoEventWireup="true" CodeFile="APIReport.aspx.cs" Inherits="APIReport" Title="MoMA Studio - API Report" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BodyContentPlaceHolder" Runat="Server">
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="BodyContentPlaceHolder" runat="Server">
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
This view is only available to logged-in users.
</AnonymousTemplate>
<LoggedInTemplate>
<asp:UpdatePanel ID="ReportsGridUpdatePanel" runat="server">
<ContentTemplate>
<%-- Need something in the filter here so it will actually filter at all --%>
<asp:SqlDataSource ID="IssuesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>"
ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>"
SelectCommand="SELECT c.apps, i.method_namespace, i.method_class, i.method_name, i.display_name, i.lookup_name FROM (SELECT COUNT(DISTINCT(report_id)) AS Apps, issue_id FROM issue_report GROUP BY issue_id) as c, (SELECT issue.id, issue.method_namespace, issue.method_class, issue.method_name, issue_type.display_name, issue_type.lookup_name FROM issue, issue_type WHERE issue_type.id = issue.issue_type_id) AS i WHERE c.issue_id = i.id;"
CacheDuration="300" EnableCaching="True" FilterExpression="lookup_name = 'TODO'"
OnFiltering="IssuesSqlDataSource_Filtering">
</asp:SqlDataSource>
<asp:Label ID="IssueTypeFilterLabel" runat="server" Text="Show only:"></asp:Label>
<asp:ListBox ID="IssueTypeFilterListBox" runat="server"
SelectionMode="Multiple" Rows="4">
<asp:ListItem>MISS</asp:ListItem>
<asp:ListItem>NIEX</asp:ListItem>
<asp:ListItem>PINV</asp:ListItem>
<asp:ListItem>TODO</asp:ListItem>
</asp:ListBox>
<asp:Button ID="IssueTypeFilterButton" runat="server" Text="Update" OnClick="IssueTypeFilterButton_Click" />
<asp:GridView ID="IssuesGridView" runat="server" AutoGenerateColumns="False" DataSourceID="IssuesSqlDataSource"
AllowPaging="True" AllowSorting="True" PageSize="20">
<Columns>
<asp:BoundField DataField="Apps" HeaderText="Apps" SortExpression="apps" />
<asp:BoundField DataField="method_namespace" HeaderText="Namespace" SortExpression="method_namespace" />
<asp:BoundField DataField="method_class" HeaderText="Class" SortExpression="method_class" />
<asp:BoundField DataField="method_name" HeaderText="Method" SortExpression="method_name" />
<asp:BoundField DataField="display_name" HeaderText="Type" SortExpression="display_name" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</LoggedInTemplate>
</asp:LoginView>
</asp:Content>

Просмотреть файл

@ -17,4 +17,33 @@ public partial class APIReport : System.Web.UI.Page
{ {
} }
protected void IssuesSqlDataSource_Filtering(object sender, SqlDataSourceFilteringEventArgs e)
{
if (Page.User.Identity.IsAuthenticated)
{
string filter = string.Empty;
foreach (ListItem item in IssueTypeFilterListBox.Items)
{
if (item.Selected)
{
if (filter != string.Empty)
{
filter += " OR ";
}
filter += "lookup_name='" + item.Value + "'";
}
}
// If nothing selected, the empty string will filter nothing
IssuesSqlDataSource.FilterExpression = filter;
}
}
protected void IssueTypeFilterButton_Click(object sender, EventArgs e)
{
if (Page.User.Identity.IsAuthenticated)
{
IssuesGridView.DataBind();
}
}
} }

Просмотреть файл

@ -11,7 +11,7 @@
<br /> <br />
<asp:SqlDataSource ID="Latest20SqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>" <asp:SqlDataSource ID="Latest20SqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>"
ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>"
SelectCommand="SELECT rep.id, rep.report_date, rep.reporter_name, def.display_name, miss.miss, niex.niex, pinv.pinv, todo.todo, total.total FROM moma_definition def, report rep LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS miss FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'MISS' AND issue_report.issue_id = issue.id GROUP BY report_id) AS miss ON rep.id = miss.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS niex FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'NIEX' AND issue_report.issue_id = issue.id GROUP BY report_id) AS niex ON rep.id = niex.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS pinv FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'PINV' AND issue_report.issue_id = issue.id GROUP BY report_id) AS pinv ON rep.id = pinv.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS todo FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'TODO' AND issue_report.issue_id = issue.id GROUP BY report_id) AS todo ON rep.id = todo.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS total FROM issue_report GROUP BY report_id) AS total ON rep.id = total.report_id WHERE rep.moma_definition_id = def.id ORDER BY rep.report_date DESC LIMIT 20;"> SelectCommand="SELECT rep.id, rep.report_date, rep.reporter_name, def.display_name, meta.importance, miss.miss, niex.niex, pinv.pinv, todo.todo, total.total FROM moma_definition def, report rep LEFT JOIN report_metadata meta ON rep.id = meta.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS miss FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'MISS' AND issue_report.issue_id = issue.id GROUP BY report_id) AS miss ON rep.id = miss.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS niex FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'NIEX' AND issue_report.issue_id = issue.id GROUP BY report_id) AS niex ON rep.id = niex.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS pinv FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'PINV' AND issue_report.issue_id = issue.id GROUP BY report_id) AS pinv ON rep.id = pinv.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS todo FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'TODO' AND issue_report.issue_id = issue.id GROUP BY report_id) AS todo ON rep.id = todo.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS total FROM issue_report GROUP BY report_id) AS total ON rep.id = total.report_id WHERE rep.moma_definition_id = def.id ORDER BY rep.report_date DESC LIMIT 20;" EnableCaching="True" CacheDuration="300">
</asp:SqlDataSource> </asp:SqlDataSource>
<asp:GridView ID="Latest20GridView" runat="server" AutoGenerateColumns="False" <asp:GridView ID="Latest20GridView" runat="server" AutoGenerateColumns="False"
DataSourceID="Latest20SqlDataSource"> DataSourceID="Latest20SqlDataSource">
@ -27,12 +27,17 @@
<asp:BoundField DataField="pinv" HeaderText="PINV" /> <asp:BoundField DataField="pinv" HeaderText="PINV" />
<asp:BoundField DataField="todo" HeaderText="TODO" /> <asp:BoundField DataField="todo" HeaderText="TODO" />
<asp:BoundField DataField="total" HeaderText="Total" /> <asp:BoundField DataField="total" HeaderText="Total" />
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:Image ID="ImportanceImage" runat="server" ImageUrl="~/important.png" Visible='<%# Eval("importance").ToString() == "Important" %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
<asp:Label ID="MostNeededLabel" runat="server" Text="Most needed API:"></asp:Label> <asp:Label ID="MostNeededLabel" runat="server" Text="Most needed API:"></asp:Label>
<br /> <br />
<asp:SqlDataSource ID="MostNeededSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>" <asp:SqlDataSource ID="MostNeededSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>"
ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT c.apps, i.method_namespace, i.method_class, i.method_name, i.display_name FROM (SELECT COUNT(DISTINCT(report_id)) AS Apps, issue_id FROM issue_report GROUP BY issue_id) as c, (SELECT issue.id, issue.method_namespace, issue.method_class, issue.method_name, issue_type.display_name FROM issue, issue_type WHERE issue_type.id = issue.issue_type_id) AS i WHERE c.issue_id = i.id ORDER BY Apps DESC LIMIT 20;"> ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT c.apps, i.method_namespace, i.method_class, i.method_name, i.display_name FROM (SELECT COUNT(DISTINCT(report_id)) AS Apps, issue_id FROM issue_report GROUP BY issue_id) as c, (SELECT issue.id, issue.method_namespace, issue.method_class, issue.method_name, issue_type.display_name FROM issue, issue_type WHERE issue_type.id = issue.issue_type_id) AS i WHERE c.issue_id = i.id ORDER BY Apps DESC LIMIT 20;" EnableCaching="True" CacheDuration="300">
</asp:SqlDataSource> </asp:SqlDataSource>
<asp:GridView ID="MostNeededGridView" runat="server" AutoGenerateColumns="False" DataSourceID="MostNeededSqlDataSource"> <asp:GridView ID="MostNeededGridView" runat="server" AutoGenerateColumns="False" DataSourceID="MostNeededSqlDataSource">
<Columns> <Columns>
@ -44,7 +49,7 @@
</Columns> </Columns>
</asp:GridView> </asp:GridView>
<asp:SqlDataSource ID="IssuesPerAppSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>" <asp:SqlDataSource ID="IssuesPerAppSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>"
ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT COUNT(report_id) AS Count FROM issue_report GROUP BY report_id;"> ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT COUNT(report_id) AS Count FROM issue_report GROUP BY report_id;" EnableCaching="True" CacheDuration="300">
</asp:SqlDataSource> </asp:SqlDataSource>
<asp:Label ID="IssuesPerAppLabel" runat="server" Text="Issues per Application"></asp:Label> <asp:Label ID="IssuesPerAppLabel" runat="server" Text="Issues per Application"></asp:Label>
<br /> <br />

Просмотреть файл

@ -107,7 +107,7 @@
<asp:UpdatePanel ID="IssuesUpdatePanel" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="IssuesUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<asp:SqlDataSource ID="IssuesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>" <asp:SqlDataSource ID="IssuesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>"
ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT type.lookup_name, iss.method_namespace, iss.method_class, iss.method_name FROM issue_type type, issue iss, issue_report rep WHERE rep.report_id = @id AND rep.issue_id = iss.id AND iss.issue_type_id = type.id;"> ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT type.lookup_name, iss.method_namespace, iss.method_class, iss.method_name FROM issue_type type, issue iss, issue_report rep WHERE rep.report_id = @id AND rep.issue_id = iss.id AND iss.issue_type_id = type.id;" EnableCaching="True" CacheDuration="300">
<SelectParameters> <SelectParameters>
<asp:QueryStringParameter DefaultValue="1" Name="id" QueryStringField="ReportID" <asp:QueryStringParameter DefaultValue="1" Name="id" QueryStringField="ReportID"
Type="Int32" /> Type="Int32" />

Просмотреть файл

@ -31,17 +31,16 @@ public partial class ReportView : System.Web.UI.Page
{ {
/* Need to create this metadata entry */ /* Need to create this metadata entry */
int id = this.GetID(); int id = this.GetID();
ds.InsertParameters["id"].DefaultValue = id.ToString(); MetadataSqlDataSource.InsertParameters["id"].DefaultValue = id.ToString();
ds.Insert(); MetadataSqlDataSource.Insert();
} }
if (!Page.IsPostBack) if (!Page.IsPostBack)
{ {
// Make the default text go away when the user clicks in the Comments box // Make the default text go away when the user clicks in the Comments box
// (but ensure that it won't blow away a half-entered comment!) // (but ensure that it won't blow away a half-entered comment!)
TextBox new_comment_textbox = (TextBox)LoginView1.FindControl("NewComment"); NewComment.Text = "Type your comment here...";
new_comment_textbox.Text = "Type your comment here..."; NewComment.Attributes.Add("onFocus", "if (this.value == 'Type your comment here...') this.value='';");
new_comment_textbox.Attributes.Add("onFocus", "if (this.value == 'Type your comment here...') this.value='';");
this.UpdateComments(); this.UpdateComments();
} }
@ -52,19 +51,17 @@ public partial class ReportView : System.Web.UI.Page
{ {
if (Page.User.Identity.IsAuthenticated) if (Page.User.Identity.IsAuthenticated)
{ {
SqlDataSource ds = (SqlDataSource)LoginView1.FindControl("CommentsSqlDataSource"); DataView comments_data = (DataView)CommentsSqlDataSource.Select(DataSourceSelectArguments.Empty);
DataView comments_data = (DataView)ds.Select(DataSourceSelectArguments.Empty); Comments.Text = "";
TextBox comments_textbox = (TextBox)LoginView1.FindControl("Comments");
comments_textbox.Text = "";
for (int i = 0; i < comments_data.Count; i++) for (int i = 0; i < comments_data.Count; i++)
{ {
comments_textbox.Text += comments_data[i]["comment"]; Comments.Text += comments_data[i]["comment"];
comments_textbox.Text += "\n"; Comments.Text += "\n";
comments_textbox.Text += comments_data[i]["commenter"]; Comments.Text += comments_data[i]["commenter"];
comments_textbox.Text += " @ "; Comments.Text += " @ ";
comments_textbox.Text += comments_data[i]["comment_date"]; Comments.Text += comments_data[i]["comment_date"];
comments_textbox.Text += "\n\n\n"; Comments.Text += "\n\n\n";
} }
} }
@ -93,19 +90,16 @@ public partial class ReportView : System.Web.UI.Page
if (Page.User.Identity.IsAuthenticated) if (Page.User.Identity.IsAuthenticated)
{ {
int id = this.GetID(); int id = this.GetID();
CheckBox send_comment_checkbox = (CheckBox)LoginView1.FindControl("SendCommentCheckBox");
TextBox newcomment_textbox = (TextBox)LoginView1.FindControl("NewComment");
Label email_content_label = (Label)LoginView1.FindControl("EmailContent"); Label email_content_label = (Label)LoginView1.FindControl("EmailContent");
SqlDataSource ds = (SqlDataSource)LoginView1.FindControl("CommentsSqlDataSource"); CommentsSqlDataSource.InsertParameters["id"].DefaultValue = id.ToString();
ds.InsertParameters["id"].DefaultValue = id.ToString(); CommentsSqlDataSource.InsertParameters["comment"].DefaultValue = NewComment.Text;
ds.InsertParameters["comment"].DefaultValue = newcomment_textbox.Text; CommentsSqlDataSource.InsertParameters["commenter"].DefaultValue = Page.User.Identity.Name;
ds.InsertParameters["commenter"].DefaultValue = Page.User.Identity.Name; CommentsSqlDataSource.InsertParameters["comment_date"].DefaultValue = DateTime.Now.ToString("o"); // ISO format
ds.InsertParameters["comment_date"].DefaultValue = DateTime.Now.ToString("o"); // ISO format CommentsSqlDataSource.InsertParameters["emailed"].DefaultValue = SendCommentCheckBox.Checked.ToString();
ds.InsertParameters["emailed"].DefaultValue = send_comment_checkbox.Checked.ToString(); CommentsSqlDataSource.Insert();
ds.Insert();
if (send_comment_checkbox.Checked) if (SendCommentCheckBox.Checked)
{ {
/* Email the comment (we know the address is available, as the checkbox can't be /* Email the comment (we know the address is available, as the checkbox can't be
* checked otherwise) * checked otherwise)
@ -113,7 +107,7 @@ public partial class ReportView : System.Web.UI.Page
StringBuilder email_text = new StringBuilder(); StringBuilder email_text = new StringBuilder();
email_text.AppendFormat("{0} added a comment to your MoMA report:\n\n", Page.User.Identity.Name); email_text.AppendFormat("{0} added a comment to your MoMA report:\n\n", Page.User.Identity.Name);
email_text.AppendFormat("{0}", newcomment_textbox.Text); email_text.AppendFormat("{0}", NewComment.Text);
email_text.AppendFormat("\n\nSee {0} for this report.\n", Page.Request.Url.ToString()); email_text.AppendFormat("\n\nSee {0} for this report.\n", Page.Request.Url.ToString());
string from_addr = Membership.GetUser().Email; string from_addr = Membership.GetUser().Email;
@ -149,7 +143,7 @@ public partial class ReportView : System.Web.UI.Page
* this report simultaneously * this report simultaneously
*/ */
this.UpdateComments(); this.UpdateComments();
newcomment_textbox.Text = ""; NewComment.Text = "";
} }
} }
@ -163,11 +157,9 @@ public partial class ReportView : System.Web.UI.Page
if (!email_content_label.Text.Contains("@")) if (!email_content_label.Text.Contains("@"))
{ {
CheckBox send_comment_checkbox = (CheckBox)LoginView1.FindControl("SendCommentCheckBox");
/* Hide the email checkbox, as we can't email the submitter anyway... */ /* Hide the email checkbox, as we can't email the submitter anyway... */
send_comment_checkbox.Visible = false; SendCommentCheckBox.Visible = false;
send_comment_checkbox.Checked = false; SendCommentCheckBox.Checked = false;
} }
} }
} }

Просмотреть файл

@ -8,9 +8,21 @@
<LoggedInTemplate> <LoggedInTemplate>
<asp:UpdatePanel ID="ReportsGridUpdatePanel" runat="server"> <asp:UpdatePanel ID="ReportsGridUpdatePanel" runat="server">
<ContentTemplate> <ContentTemplate>
<%-- Need something in the filter here so it will actually filter at all --%>
<asp:SqlDataSource ID="SubmissionsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>" <asp:SqlDataSource ID="SubmissionsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MomaDB %>"
ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>" SelectCommand="SELECT rep.id, rep.report_date, meta.application_name, meta.application_type, rep.reporter_name, rep.reporter_organization, def.display_name, miss.miss, niex.niex, pinv.pinv, todo.todo, total.total FROM moma_definition def, report rep LEFT JOIN report_metadata meta ON rep.id = meta.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS miss FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'MISS' AND issue_report.issue_id = issue.id GROUP BY report_id) AS miss ON rep.id = miss.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS niex FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'NIEX' AND issue_report.issue_id = issue.id GROUP BY report_id) AS niex ON rep.id = niex.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS pinv FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'PINV' AND issue_report.issue_id = issue.id GROUP BY report_id) AS pinv ON rep.id = pinv.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS todo FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'TODO' AND issue_report.issue_id = issue.id GROUP BY report_id) AS todo ON rep.id = todo.report_id LEFT JOIN (SELECT report_id, COUNT(report_id) AS total FROM issue_report GROUP BY report_id) AS total ON rep.id = total.report_id WHERE rep.moma_definition_id = def.id;"> ProviderName="<%$ ConnectionStrings:MomaDB.ProviderName %>"
SelectCommand="SELECT rep.id, rep.report_date, meta.importance, meta.application_name, meta.application_type, rep.reporter_name, rep.reporter_organization, def.display_name, miss.miss, niex.niex, pinv.pinv, todo.todo, total.total FROM moma_definition def, report rep LEFT JOIN report_metadata meta ON rep.id = meta.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS miss FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'MISS' AND issue_report.issue_id = issue.id GROUP BY report_id) AS miss ON rep.id = miss.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS niex FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'NIEX' AND issue_report.issue_id = issue.id GROUP BY report_id) AS niex ON rep.id = niex.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS pinv FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'PINV' AND issue_report.issue_id = issue.id GROUP BY report_id) AS pinv ON rep.id = pinv.report_id LEFT JOIN (SELECT issue_report.report_id, COUNT(issue_report.report_id) AS todo FROM issue_report, issue, issue_type WHERE issue.issue_type_id = issue_type.id AND issue_type.lookup_name = 'TODO' AND issue_report.issue_id = issue.id GROUP BY report_id) AS todo ON rep.id = todo.report_id LEFT JOIN (SELECT report_id, COUNT(report_id) AS total FROM issue_report GROUP BY report_id) AS total ON rep.id = total.report_id WHERE rep.moma_definition_id = def.id;"
EnableCaching="True" CacheDuration="300" FilterExpression="importance = 'Important'"
onfiltering="SubmissionsSqlDataSource_Filtering">
</asp:SqlDataSource> </asp:SqlDataSource>
<asp:Label ID="ImportanceFilterLabel" runat="server" Text="Show only:"></asp:Label>
<asp:ListBox ID="ImportanceFilterListBox" runat="server"
SelectionMode="Multiple" Rows="3">
<asp:ListItem>Important</asp:ListItem>
<asp:ListItem>Useful</asp:ListItem>
<asp:ListItem>Not useful</asp:ListItem>
</asp:ListBox>
<asp:Button ID="ImportanceFilterButton" runat="server" Text="Update" onclick="ImportanceFilterButton_Click" />
<asp:GridView ID="ReportsGridView" runat="server" DataSourceID="SubmissionsSqlDataSource" <asp:GridView ID="ReportsGridView" runat="server" DataSourceID="SubmissionsSqlDataSource"
AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"> AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False">
<Columns> <Columns>
@ -18,6 +30,8 @@
HeaderText="ID" Text="View" SortExpression="id" /> HeaderText="ID" Text="View" SortExpression="id" />
<asp:BoundField DataField="report_date" HeaderText="Date" <asp:BoundField DataField="report_date" HeaderText="Date"
SortExpression="report_date" /> SortExpression="report_date" />
<asp:BoundField DataField="importance" HeaderText="Importance"
SortExpression="importance" />
<asp:BoundField DataField="application_name" HeaderText="Application Name" <asp:BoundField DataField="application_name" HeaderText="Application Name"
SortExpression="application_name" /> SortExpression="application_name" />
<asp:BoundField DataField="application_type" HeaderText="Application Type" <asp:BoundField DataField="application_type" HeaderText="Application Type"

Просмотреть файл

@ -17,4 +17,33 @@ public partial class Submissions : System.Web.UI.Page
{ {
} }
protected void SubmissionsSqlDataSource_Filtering(object sender, SqlDataSourceFilteringEventArgs e)
{
if (Page.User.Identity.IsAuthenticated)
{
string filter = string.Empty;
foreach (ListItem item in ImportanceFilterListBox.Items)
{
if (item.Selected)
{
if (filter != string.Empty)
{
filter += " OR ";
}
filter += "importance='" + item.Value + "'";
}
}
// If nothing selected, the empty string will filter nothing
SubmissionsSqlDataSource.FilterExpression = filter;
}
}
protected void ImportanceFilterButton_Click(object sender, EventArgs e)
{
if (Page.User.Identity.IsAuthenticated)
{
ReportsGridView.DataBind();
}
}
} }

Двоичные данные
web_service/important.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 531 B