web.config: Set database timeout to 5 minutes.

Overview.aspx, Overview.aspx.cs: Implement most recent 20 report, and most needed API queries.

Add DbLinq to implement those queries.


svn path=/trunk/moma-tool/; revision=112585
This commit is contained in:
Dick Porter 2008-09-09 13:29:15 +00:00
Родитель 6ab607eb4d
Коммит 90b62ab69f
10 изменённых файлов: 1300 добавлений и 65 удалений

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

@ -0,0 +1,966 @@
#region Auto-generated classes for nhibernate database on 2008-09-03 16:20:12Z
//
// ____ _ __ __ _ _
// | _ \| |__ | \/ | ___| |_ __ _| |
// | | | | '_ \| |\/| |/ _ \ __/ _` | |
// | |_| | |_) | | | | __/ || (_| | |
// |____/|_.__/|_| |_|\___|\__\__,_|_|
//
// Auto-generated from nhibernate on 2008-09-03 16:20:12Z
// Please visit http://linq.to/db for more information
#endregion
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Linq.Mapping;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using DbLinq.Linq;
using DbLinq.Linq.Mapping;
namespace MomaTool.Database.Linq
{
public partial class MoMADB : DbLinq.Linq.DataContext
{
public MoMADB(System.Data.IDbConnection connection)
: base(connection, new DbLinq.PostgreSql.PgsqlVendor())
{
}
public MoMADB(System.Data.IDbConnection connection, DbLinq.Vendor.IVendor vendor)
: base(connection, vendor)
{
}
public Table<Issue> Issue { get { return GetTable<Issue>(); } }
public Table<IssueType> IssueType { get { return GetTable<IssueType>(); } }
public Table<MomADefinition> MomADefinition { get { return GetTable<MomADefinition>(); } }
public Table<Report> Report { get { return GetTable<Report>(); } }
}
[Table(Name = "public.issue")]
public partial class Issue : INotifyPropertyChanged
{
#region INotifyPropertyChanged handling
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
#region int ID
[AutoGenId]
private int id;
[DebuggerNonUserCode]
[Column(Storage = "id", Name = "id", DbType = "integer(32,0)", IsDbGenerated = true, CanBeNull = false, Expression = "nextval('issue_id_seq')")]
public int ID
{
get
{
return id;
}
set
{
if (value != id)
{
id = value;
OnPropertyChanged("ID");
}
}
}
#endregion
#region int IssueTypeID
private int issueTypeID;
[DebuggerNonUserCode]
[Column(Storage = "issueTypeID", Name = "issue_type_id", DbType = "integer(32,0)", CanBeNull = false, Expression = null)]
public int IssueTypeID
{
get
{
return issueTypeID;
}
set
{
if (value != issueTypeID)
{
issueTypeID = value;
OnPropertyChanged("IssueTypeID");
}
}
}
#endregion
#region string MethodClass
private string methodClass;
[DebuggerNonUserCode]
[Column(Storage = "methodClass", Name = "method_class", DbType = "character varying(200)", Expression = null)]
public string MethodClass
{
get
{
return methodClass;
}
set
{
if (value != methodClass)
{
methodClass = value;
OnPropertyChanged("MethodClass");
}
}
}
#endregion
#region string MethodLibrary
private string methodLibrary;
[DebuggerNonUserCode]
[Column(Storage = "methodLibrary", Name = "method_library", DbType = "character varying(500)", Expression = null)]
public string MethodLibrary
{
get
{
return methodLibrary;
}
set
{
if (value != methodLibrary)
{
methodLibrary = value;
OnPropertyChanged("MethodLibrary");
}
}
}
#endregion
#region string MethodName
private string methodName;
[DebuggerNonUserCode]
[Column(Storage = "methodName", Name = "method_name", DbType = "character varying(1000)", Expression = null)]
public string MethodName
{
get
{
return methodName;
}
set
{
if (value != methodName)
{
methodName = value;
OnPropertyChanged("MethodName");
}
}
}
#endregion
#region string MethodNamesPace
private string methodNamesPace;
[DebuggerNonUserCode]
[Column(Storage = "methodNamesPace", Name = "method_namespace", DbType = "character varying(200)", Expression = null)]
public string MethodNamesPace
{
get
{
return methodNamesPace;
}
set
{
if (value != methodNamesPace)
{
methodNamesPace = value;
OnPropertyChanged("MethodNamesPace");
}
}
}
#endregion
#region string MethodReturnType
private string methodReturnType;
[DebuggerNonUserCode]
[Column(Storage = "methodReturnType", Name = "method_return_type", DbType = "character varying(200)", Expression = null)]
public string MethodReturnType
{
get
{
return methodReturnType;
}
set
{
if (value != methodReturnType)
{
methodReturnType = value;
OnPropertyChanged("MethodReturnType");
}
}
}
#endregion
#region int ReportID
private int reportID;
[DebuggerNonUserCode]
[Column(Storage = "reportID", Name = "report_id", DbType = "integer(32,0)", CanBeNull = false, Expression = null)]
public int ReportID
{
get
{
return reportID;
}
set
{
if (value != reportID)
{
reportID = value;
OnPropertyChanged("ReportID");
}
}
}
#endregion
#region Parents
private System.Data.Linq.EntityRef<IssueType> issueType;
[Association(Storage = "issueType", ThisKey = "IssueTypeID", Name = "fk_issue_issue_type")]
[DebuggerNonUserCode]
public IssueType IssueType
{
get
{
return issueType.Entity;
}
set
{
issueType.Entity = value;
}
}
private System.Data.Linq.EntityRef<Report> report;
[Association(Storage = "report", ThisKey = "ReportID", Name = "fk_issue_report")]
[DebuggerNonUserCode]
public Report Report
{
get
{
return report.Entity;
}
set
{
report.Entity = value;
}
}
#endregion
}
[Table(Name = "public.issue_type")]
public partial class IssueType : INotifyPropertyChanged
{
#region INotifyPropertyChanged handling
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
#region string Description
private string description;
[DebuggerNonUserCode]
[Column(Storage = "description", Name = "description", DbType = "text", CanBeNull = false, Expression = null)]
public string Description
{
get
{
return description;
}
set
{
if (value != description)
{
description = value;
OnPropertyChanged("Description");
}
}
}
#endregion
#region string DisplayName
private string displayName;
[DebuggerNonUserCode]
[Column(Storage = "displayName", Name = "display_name", DbType = "character varying(100)", CanBeNull = false, Expression = null)]
public string DisplayName
{
get
{
return displayName;
}
set
{
if (value != displayName)
{
displayName = value;
OnPropertyChanged("DisplayName");
}
}
}
#endregion
#region int ID
[AutoGenId]
private int id;
[DebuggerNonUserCode]
[Column(Storage = "id", Name = "id", DbType = "integer(32,0)", IsDbGenerated = true, CanBeNull = false, Expression = "nextval('issue_type_id_seq')")]
public int ID
{
get
{
return id;
}
set
{
if (value != id)
{
id = value;
OnPropertyChanged("ID");
}
}
}
#endregion
#region bool IsActive
private bool isActive;
[DebuggerNonUserCode]
[Column(Storage = "isActive", Name = "is_active", DbType = "boolean", CanBeNull = false, Expression = null)]
public bool IsActive
{
get
{
return isActive;
}
set
{
if (value != isActive)
{
isActive = value;
OnPropertyChanged("IsActive");
}
}
}
#endregion
#region string LookupName
private string lookupName;
[DebuggerNonUserCode]
[Column(Storage = "lookupName", Name = "lookup_name", DbType = "character varying(10)", CanBeNull = false, Expression = null)]
public string LookupName
{
get
{
return lookupName;
}
set
{
if (value != lookupName)
{
lookupName = value;
OnPropertyChanged("LookupName");
}
}
}
#endregion
#region Children
[Association(Storage = null, OtherKey = "IssueTypeID", Name = "fk_issue_issue_type")]
[DebuggerNonUserCode]
public EntityMSet<Issue> Issue
{
get
{
// L212 - child data available only when part of query
return null;
}
}
#endregion
}
[Table(Name = "public.moma_definition")]
public partial class MomADefinition : INotifyPropertyChanged
{
#region INotifyPropertyChanged handling
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
#region System.DateTime CreateDate
private System.DateTime createDate;
[DebuggerNonUserCode]
[Column(Storage = "createDate", Name = "create_date", DbType = "timestamp without time zone", CanBeNull = false, Expression = null)]
public System.DateTime CreateDate
{
get
{
return createDate;
}
set
{
if (value != createDate)
{
createDate = value;
OnPropertyChanged("CreateDate");
}
}
}
#endregion
#region string Description
private string description;
[DebuggerNonUserCode]
[Column(Storage = "description", Name = "description", DbType = "text", CanBeNull = false, Expression = null)]
public string Description
{
get
{
return description;
}
set
{
if (value != description)
{
description = value;
OnPropertyChanged("Description");
}
}
}
#endregion
#region string DisplayName
private string displayName;
[DebuggerNonUserCode]
[Column(Storage = "displayName", Name = "display_name", DbType = "character varying(100)", CanBeNull = false, Expression = null)]
public string DisplayName
{
get
{
return displayName;
}
set
{
if (value != displayName)
{
displayName = value;
OnPropertyChanged("DisplayName");
}
}
}
#endregion
#region int ID
[AutoGenId]
private int id;
[DebuggerNonUserCode]
[Column(Storage = "id", Name = "id", DbType = "integer(32,0)", IsDbGenerated = true, CanBeNull = false, Expression = "nextval('moma_definition_id_seq')")]
public int ID
{
get
{
return id;
}
set
{
if (value != id)
{
id = value;
OnPropertyChanged("ID");
}
}
}
#endregion
#region bool IsActive
private bool isActive;
[DebuggerNonUserCode]
[Column(Storage = "isActive", Name = "is_active", DbType = "boolean", CanBeNull = false, Expression = null)]
public bool IsActive
{
get
{
return isActive;
}
set
{
if (value != isActive)
{
isActive = value;
OnPropertyChanged("IsActive");
}
}
}
#endregion
#region string LookupName
private string lookupName;
[DebuggerNonUserCode]
[Column(Storage = "lookupName", Name = "lookup_name", DbType = "character varying(100)", CanBeNull = false, Expression = null)]
public string LookupName
{
get
{
return lookupName;
}
set
{
if (value != lookupName)
{
lookupName = value;
OnPropertyChanged("LookupName");
}
}
}
#endregion
#region Children
[Association(Storage = null, OtherKey = "MomADefinitionID", Name = "fk_report_moma_definition")]
[DebuggerNonUserCode]
public EntityMSet<Report> Report
{
get
{
// L212 - child data available only when part of query
return null;
}
}
#endregion
}
[Table(Name = "public.report")]
public partial class Report : INotifyPropertyChanged
{
#region INotifyPropertyChanged handling
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
#region System.DateTime CreateDate
private System.DateTime createDate;
[DebuggerNonUserCode]
[Column(Storage = "createDate", Name = "create_date", DbType = "timestamp without time zone", CanBeNull = false, Expression = null)]
public System.DateTime CreateDate
{
get
{
return createDate;
}
set
{
if (value != createDate)
{
createDate = value;
OnPropertyChanged("CreateDate");
}
}
}
#endregion
#region int ID
[AutoGenId]
private int id;
[DebuggerNonUserCode]
[Column(Storage = "id", Name = "id", DbType = "integer(32,0)", IsDbGenerated = true, CanBeNull = false, Expression = "nextval('report_id_seq')")]
public int ID
{
get
{
return id;
}
set
{
if (value != id)
{
id = value;
OnPropertyChanged("ID");
}
}
}
#endregion
#region bool IsActive
private bool isActive;
[DebuggerNonUserCode]
[Column(Storage = "isActive", Name = "is_active", DbType = "boolean", CanBeNull = false, Expression = null)]
public bool IsActive
{
get
{
return isActive;
}
set
{
if (value != isActive)
{
isActive = value;
OnPropertyChanged("IsActive");
}
}
}
#endregion
#region System.DateTime LastUpdateDate
private System.DateTime lastUpdateDate;
[DebuggerNonUserCode]
[Column(Storage = "lastUpdateDate", Name = "last_update_date", DbType = "timestamp without time zone", CanBeNull = false, Expression = null)]
public System.DateTime LastUpdateDate
{
get
{
return lastUpdateDate;
}
set
{
if (value != lastUpdateDate)
{
lastUpdateDate = value;
OnPropertyChanged("LastUpdateDate");
}
}
}
#endregion
#region int? MomADefinitionID
private int? momAdEfinitionID;
[DebuggerNonUserCode]
[Column(Storage = "momAdEfinitionID", Name = "moma_definition_id", DbType = "integer(32,0)", Expression = null)]
public int? MomADefinitionID
{
get
{
return momAdEfinitionID;
}
set
{
if (value != momAdEfinitionID)
{
momAdEfinitionID = value;
OnPropertyChanged("MomADefinitionID");
}
}
}
#endregion
#region System.DateTime ReportDate
private System.DateTime reportDate;
[DebuggerNonUserCode]
[Column(Storage = "reportDate", Name = "report_date", DbType = "timestamp without time zone", CanBeNull = false, Expression = null)]
public System.DateTime ReportDate
{
get
{
return reportDate;
}
set
{
if (value != reportDate)
{
reportDate = value;
OnPropertyChanged("ReportDate");
}
}
}
#endregion
#region string ReporterComments
private string reporterComments;
[DebuggerNonUserCode]
[Column(Storage = "reporterComments", Name = "reporter_comments", DbType = "text", Expression = null)]
public string ReporterComments
{
get
{
return reporterComments;
}
set
{
if (value != reporterComments)
{
reporterComments = value;
OnPropertyChanged("ReporterComments");
}
}
}
#endregion
#region string ReporterEmail
private string reporterEmail;
[DebuggerNonUserCode]
[Column(Storage = "reporterEmail", Name = "reporter_email", DbType = "character varying(500)", Expression = null)]
public string ReporterEmail
{
get
{
return reporterEmail;
}
set
{
if (value != reporterEmail)
{
reporterEmail = value;
OnPropertyChanged("ReporterEmail");
}
}
}
#endregion
#region string ReporterHomepage
private string reporterHomepage;
[DebuggerNonUserCode]
[Column(Storage = "reporterHomepage", Name = "reporter_homepage", DbType = "character varying(500)", Expression = null)]
public string ReporterHomepage
{
get
{
return reporterHomepage;
}
set
{
if (value != reporterHomepage)
{
reporterHomepage = value;
OnPropertyChanged("ReporterHomepage");
}
}
}
#endregion
#region string ReporterIP
private string reporterIp;
[DebuggerNonUserCode]
[Column(Storage = "reporterIp", Name = "reporter_ip", DbType = "character varying(50)", Expression = null)]
public string ReporterIP
{
get
{
return reporterIp;
}
set
{
if (value != reporterIp)
{
reporterIp = value;
OnPropertyChanged("ReporterIP");
}
}
}
#endregion
#region string ReporterName
private string reporterName;
[DebuggerNonUserCode]
[Column(Storage = "reporterName", Name = "reporter_name", DbType = "character varying(500)", Expression = null)]
public string ReporterName
{
get
{
return reporterName;
}
set
{
if (value != reporterName)
{
reporterName = value;
OnPropertyChanged("ReporterName");
}
}
}
#endregion
#region string ReporterOrganization
private string reporterOrganization;
[DebuggerNonUserCode]
[Column(Storage = "reporterOrganization", Name = "reporter_organization", DbType = "character varying(500)", Expression = null)]
public string ReporterOrganization
{
get
{
return reporterOrganization;
}
set
{
if (value != reporterOrganization)
{
reporterOrganization = value;
OnPropertyChanged("ReporterOrganization");
}
}
}
#endregion
#region string ReportFilename
private string reportFilename;
[DebuggerNonUserCode]
[Column(Storage = "reportFilename", Name = "report_filename", DbType = "character varying(50)", CanBeNull = false, Expression = null)]
public string ReportFilename
{
get
{
return reportFilename;
}
set
{
if (value != reportFilename)
{
reportFilename = value;
OnPropertyChanged("ReportFilename");
}
}
}
#endregion
#region Children
[Association(Storage = null, OtherKey = "ReportID", Name = "fk_issue_report")]
[DebuggerNonUserCode]
public EntityMSet<Issue> Issue
{
get
{
// L212 - child data available only when part of query
return null;
}
}
#endregion
#region Parents
private System.Data.Linq.EntityRef<MomADefinition> momAdEfinition;
[Association(Storage = "momAdEfinition", ThisKey = "MomADefinitionID", Name = "fk_report_moma_definition")]
[DebuggerNonUserCode]
public MomADefinition MomADefinition
{
get
{
return momAdEfinition.Entity;
}
set
{
momAdEfinition.Entity = value;
}
}
#endregion
}
}

Двоичные данные
web_service/Bin/DbLinq.PostgreSql.dll Normal file

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

Двоичные данные
web_service/Bin/DbLinq.PostgreSql.dll.refresh Normal file

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

Двоичные данные
web_service/Bin/DbLinq.PostgreSql.pdb Normal file

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

Двоичные данные
web_service/Bin/DbLinq.dll Normal file

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

Двоичные данные
web_service/Bin/DbLinq.dll.refresh Normal file

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

Двоичные данные
web_service/Bin/DbLinq.pdb Normal file

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

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

@ -10,12 +10,28 @@
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="ID"
DataNavigateUrlFormatString="~/ReportView.aspx?ReportID={0}"
<asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="~/ReportView.aspx?ReportID={0}"
HeaderText="Details" Text="View" />
<asp:BoundField DataField="CreateDate" HeaderText="Date" />
<asp:BoundField DataField="ID" HeaderText="ID" />
<asp:BoundField DataField="ReporterName" HeaderText="Name" />
<asp:BoundField DataField="CreateDate" HeaderText="Date" />
<asp:BoundField DataField="Profile" HeaderText="Profile" />
<asp:BoundField DataField="Miss" HeaderText="MISS" />
<asp:BoundField DataField="Niex" HeaderText="NIEX" />
<asp:BoundField DataField="Pinv" HeaderText="PINV" />
<asp:BoundField DataField="Todo" HeaderText="TODO" />
<asp:BoundField DataField="Total" HeaderText="Total" />
</Columns>
</asp:GridView>
<asp:Label ID="Label2" runat="server" Text="Most needed API:"></asp:Label>
<br />
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="Namespace" HeaderText="Namespace" />
<asp:BoundField DataField="Class" HeaderText="Class" />
<asp:BoundField DataField="Method" HeaderText="Method" />
<asp:BoundField DataField="Type" HeaderText="Type" />
<asp:BoundField DataField="Apps" HeaderText="Apps" />
</Columns>
</asp:GridView>
</LoggedInTemplate>

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

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
@ -11,17 +12,286 @@ using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MomaTool.Database.Linq;
using Npgsql;
public partial class Overview : System.Web.UI.Page
{
public class OverviewData
{
public OverviewData(int id, DateTime create_date, string reporter_name, string profile,
int miss, int niex, int pinv, int todo, int total)
{
this._ID = id;
this._CreateDate = create_date;
this._ReporterName = reporter_name;
this._Profile = profile;
this._Miss = miss;
this._Niex = niex;
this._Pinv = pinv;
this._Todo = todo;
this._Total = total;
}
/* For some barking reason, DataSource requires this to be a property not a field,
* even though the exception states "A field or property with the name 'foo' was
* not found on the selected data source.
*/
private int _ID;
public int ID
{
get
{
return _ID;
}
set
{
_ID = value;
}
}
private DateTime _CreateDate;
public DateTime CreateDate
{
get
{
return _CreateDate;
}
set
{
_CreateDate = value;
}
}
private string _ReporterName;
public string ReporterName
{
get
{
return _ReporterName;
}
set
{
_ReporterName = value;
}
}
private string _Profile;
public string Profile
{
get
{
return _Profile;
}
set
{
_Profile = value;
}
}
private int _Miss;
public int Miss
{
get
{
return _Miss;
}
set
{
_Miss = value;
}
}
private int _Niex;
public int Niex
{
get
{
return _Niex;
}
set
{
_Niex = value;
}
}
private int _Pinv;
public int Pinv
{
get
{
return _Pinv;
}
set
{
_Pinv = value;
}
}
private int _Todo;
public int Todo
{
get
{
return _Todo;
}
set
{
_Todo = value;
}
}
private int _Total;
public int Total
{
get
{
return _Total;
}
set
{
_Total = value;
}
}
}
public class OverviewMostNeeded
{
public OverviewMostNeeded()
{
this._Namespace = "unknown namespace";
this._Class = "unknown class";
this._Method = "unknown method";
this._Type = "unknown type";
this._Apps = 0;
}
public OverviewMostNeeded(string ns, string cls, string meth, string type, int apps)
{
this._Namespace = ns;
this._Class = cls;
this._Method = meth;
this._Type = type;
this._Apps = apps;
}
private string _Namespace;
public string Namespace
{
get
{
return _Namespace;
}
set
{
_Namespace = value;
}
}
private string _Class;
public string Class
{
get
{
return _Class;
}
set
{
_Class = value;
}
}
private string _Method;
public string Method
{
get
{
return _Method;
}
set
{
_Method = value;
}
}
private string _Type;
public string Type
{
get
{
return _Type;
}
set
{
_Type = value;
}
}
private int _Apps;
public int Apps
{
get
{
return _Apps;
}
set
{
_Apps = value;
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
// GridView1 only available to logged-in users
if (Page.User.Identity.IsAuthenticated)
{
// ... and we need to find it from inside the LoginView
GridView grid = (GridView)LoginView1.FindControl("GridView1");
grid.DataSource = MomaTool.Database.Report.FindMostRecent(20);
grid.DataBind();
GridView grid1 = (GridView)LoginView1.FindControl("GridView1");
string connstr = ConfigurationManager.ConnectionStrings["MomaDB"].ConnectionString;
NpgsqlConnection conn = new NpgsqlConnection(connstr);
MoMADB db = new MoMADB(conn);
//NpgsqlEventLog.Level = LogLevel.Debug;
//NpgsqlEventLog.LogName = "c:\\cygwin\\tmp\\npgsql-debug-logx";
int miss_id = (from type in db.IssueType where type.LookupName == "MISS" select type.ID).ToList()[0];
int niex_id = (from type in db.IssueType where type.LookupName == "NIEX" select type.ID).ToList()[0];
int pinv_id = (from type in db.IssueType where type.LookupName == "PINV" select type.ID).ToList()[0];
int todo_id = (from type in db.IssueType where type.LookupName == "TODO" select type.ID).ToList()[0];
List<OverviewData> grid1_q = (from rep in db.Report
from prof in db.MomADefinition
where rep.MomADefinitionID == prof.ID
orderby rep.CreateDate descending
select new OverviewData(rep.ID, rep.CreateDate,
rep.ReporterName, prof.DisplayName,
0, 0, 0, 0, 0)
).Take(20).ToList();
/* This ought to be incorporated into the select above, but I can't seem to make
* that work with dblinq (not sure whether the problem is dblinq itself, npgsql, or just
* me.)
*/
foreach (OverviewData ov in grid1_q)
{
ov.Miss = (from issue in db.Issue where issue.ReportID == ov.ID && issue.IssueTypeID == miss_id select issue.ID).ToList().Count;
ov.Niex = (from issue in db.Issue where issue.ReportID == ov.ID && issue.IssueTypeID == niex_id select issue.ID).ToList().Count;
ov.Pinv = (from issue in db.Issue where issue.ReportID == ov.ID && issue.IssueTypeID == pinv_id select issue.ID).ToList().Count;
ov.Todo = (from issue in db.Issue where issue.ReportID == ov.ID && issue.IssueTypeID == todo_id select issue.ID).ToList().Count;
ov.Total = ov.Miss + ov.Niex + ov.Pinv + ov.Todo;
}
grid1.DataSource = grid1_q;
grid1.DataBind();
GridView grid2 = (GridView)LoginView1.FindControl("GridView2");
/* FIXME: figure out the LINQ version of the count(distinct)... */
var grid2_q = db.ExecuteQuery<OverviewMostNeeded>(@"select count(distinct(issue.report_id)) as Apps, issue.method_namespace as Namespace, issue.method_class as Class, issue.method_name as Method, issue_type.display_name as Type from issue, issue_type where issue_type.id = issue.issue_type_id group by method_namespace, method_class, method_name, display_name order by Apps desc limit 20;");
grid2.DataSource = grid2_q;
grid2.DataBind();
}
}
}

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

@ -24,8 +24,8 @@
</configSections>
<appSettings/>
<connectionStrings>
<add name="MomaDB" connectionString="Server=hagbard.apathetic.discordia.org.uk;Database=nhibernate;User ID=dick;Password=test"/>
<add name="AspSQLProvider" connectionString="Server=hagbard.apathetic.discordia.org.uk;Database=nhibernate_users;User ID=dick;Password=test"/>
<add name="MomaDB" connectionString="Server=hagbard.apathetic.discordia.org.uk;Database=nhibernate;User ID=dick;Password=test;CommandTimeout=600"/>
<add name="AspSQLProvider" connectionString="Server=hagbard.apathetic.discordia.org.uk;Database=nhibernate_users;User ID=dick;Password=test"/>
</connectionStrings>
<activerecord isWeb="true">
<config>
@ -48,62 +48,45 @@
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms">
<forms name=".AspNetAuth" protection="All" defaultUrl="~/Overview.aspx"
loginUrl="~/Login.aspx" timeout="30" path="/" requireSSL="false"
slidingExpiration="true" enableCrossAppRedirects="false" />
</authentication>
<machineKey validationKey='046E0312E8BEFA5B52967B82C9A8D017D3492E758311A2D118DEE6BEE6F2194BEEEB5BBE420BB09A69C3F575D1ECF29A25EC0693354A2CF3EBF1B3AE0AB7D075'
decryptionKey='023880913EDBDB165D2B66E226146DCD'
validation='SHA1' decryption='AES' />
<membership defaultProvider="PgMembershipProvider">
<providers>
<clear/>
<add name="PgMembershipProvider" type="NauckIT.PostgreSQLProvider.PgMembershipProvider"
connectionStringName="AspSQLProvider" enablePasswordRetrieval="false" enablePasswordReset="true"
requiresQuestionAndAnswer="true" passwordFormat="Hashed" applicationName="MoMAStudio"/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider="PgRoleProvider" cacheRolesInCookie="true" cookieName=".AspNetRoles"
cookiePath="/" cookieProtection="All" cookieRequireSSL="false" cookieSlidingExpiration="true"
createPersistentCookie="false" cookieTimeout="30" maxCachedResults="25">
<providers>
<clear/>
<add name="PgRoleProvider" type="NauckIT.PostgreSQLProvider.PgRoleProvider" connectionStringName="AspSQLProvider"
applicationName="MoMAStudio"/>
</providers>
</roleManager>
<profile enabled="true" defaultProvider="PgProfileProvider">
<providers>
<clear/>
<add name="PgProfileProvider" type="NauckIT.PostgreSQLProvider.PgProfileProvider"
connectionStringName="AspSQLProvider" applicationName="MoMAStudio"/>
</providers>
<properties>
<add name="FirstName"/>
<add name="LastName"/>
</properties>
</profile>
<sessionState mode="Custom" customProvider="PgSessionStateStoreProvider">
<providers>
<clear/>
<add name="PgSessionStateStoreProvider" type="NauckIT.PostgreSQLProvider.PgSessionStateStoreProvider"
connectionStringName="AspSQLProvider" applicationName="MoMAStudio"/>
</providers>
</sessionState>
<authentication mode="Forms">
<forms name=".AspNetAuth" protection="All" defaultUrl="~/Overview.aspx" loginUrl="~/Login.aspx" timeout="30" path="/" requireSSL="false" slidingExpiration="true" enableCrossAppRedirects="false"/>
</authentication>
<machineKey validationKey="046E0312E8BEFA5B52967B82C9A8D017D3492E758311A2D118DEE6BEE6F2194BEEEB5BBE420BB09A69C3F575D1ECF29A25EC0693354A2CF3EBF1B3AE0AB7D075" decryptionKey="023880913EDBDB165D2B66E226146DCD" validation="SHA1" decryption="AES"/>
<membership defaultProvider="PgMembershipProvider">
<providers>
<clear/>
<add name="PgMembershipProvider" type="NauckIT.PostgreSQLProvider.PgMembershipProvider" connectionStringName="AspSQLProvider" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordFormat="Hashed" applicationName="MoMAStudio"/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider="PgRoleProvider" cacheRolesInCookie="true" cookieName=".AspNetRoles" cookiePath="/" cookieProtection="All" cookieRequireSSL="false" cookieSlidingExpiration="true" createPersistentCookie="false" cookieTimeout="30" maxCachedResults="25">
<providers>
<clear/>
<add name="PgRoleProvider" type="NauckIT.PostgreSQLProvider.PgRoleProvider" connectionStringName="AspSQLProvider" applicationName="MoMAStudio"/>
</providers>
</roleManager>
<profile enabled="true" defaultProvider="PgProfileProvider">
<providers>
<clear/>
<add name="PgProfileProvider" type="NauckIT.PostgreSQLProvider.PgProfileProvider" connectionStringName="AspSQLProvider" applicationName="MoMAStudio"/>
</providers>
<properties>
<add name="FirstName"/>
<add name="LastName"/>
</properties>
</profile>
<sessionState mode="Custom" customProvider="PgSessionStateStoreProvider">
<providers>
<clear/>
<add name="PgSessionStateStoreProvider" type="NauckIT.PostgreSQLProvider.PgSessionStateStoreProvider" connectionStringName="AspSQLProvider" applicationName="MoMAStudio"/>
</providers>
</sessionState>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
@ -177,11 +160,11 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.net>
<mailSettings>
<smtp from="moma@ximian.com">
<network host="reordberend.ecgtheow.com" password="" userName="" />
</smtp>
</mailSettings>
</system.net>
<system.net>
<mailSettings>
<smtp from="moma@ximian.com">
<network host="reordberend.ecgtheow.com" password="" userName=""/>
</smtp>
</mailSettings>
</system.net>
</configuration>