edmx file: OrderData:
ORDERID
SHIPMENT
DRIVER_ID
RECEIVE_NAME
we need to build a table and print for each DRIVER_ID first column:DRIVER_ID second column: how many rows with this DRIVER_ID third column: how many rows with this DRIVER_ID and has RECEIVE_NAME not null
please show me how it can be done...i only managed to print a getquery:(
SERVER.CS
public class OrderDataRepository : BaseRepository<OrderData>
{
public class OrderDataResults
{
public long DriverId { get; set; }
public int OrderCount { get; set; }
public int OrderCountWhereNameIsNotNull { get; set; }
}
public class OrderViewRepository : BaseRepository<OrderData>
{
public List<OrderDataResults> GetOrderDataResults()
{
return GetQuery().
Where(x => x.SHIPMENT != null).
GroupBy(o => o.DRIVER_ID).
Select(g =>
new OrderDataResults
{
DriverId = g.Key,
OrderCount = g.Count(),
OrderCountWhereNameIsNotNull =
g.Count(o => o.RECEIVE_NAME != null)
}).ToList();
}
}
CLIENT.ASPX.CS
public partial class Control : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var rep = new OrderViewRepository();
List<OrderDataResults> results = GetOrderDataResults();
**Error 12 The name 'GetOrderDataResults' does not exist in the current context
Error 11 The type or namespace name 'OrderDataResults' could not be found (are you missing a using directive or an assembly reference?)
**
DataViewer.DataSource = results;
DataViewer.DataBind();
}
}
WEBPAGE.ASPX
<form id="Form1" runat="server">
<asp:GridView runat="server" ID="DataViewer">
</asp:GridView>
</form>