blog.mha.dk
The on-line blog of Michael Holm Andersen

LINQtoSQL – Grouping and selecting

Wednesday, 21 April 2010 15:00 by mha

I have a Order->OrderLine table setup where I need to check if any “duplicate” orders exists. In order to check this I need to be able to select select various columns *not* contained in the group (key) – playing around in LinqPad I quickly came up with this query:

from line in AxSaleLines
where line.QuantityRemaining > 0
group line by new {line.AxSale.AccountNumber, line.ItemNumber, 
ProdName = line.Product.Name, ProdFormat = line.Product.ProductFormat.Name}
into myGroup
where myGroup.Count() > 1
from s in AxSaleLines
where s.ItemNumber == myGroup.Key.ItemNumber && 
      s.AxSale.AccountNumber == myGroup.Key.AccountNumber
select new { s.AxSale.SalesId, s.AxSale.AccountNumber, 
             CustomerName = s.AxSale.Customer.Name, s.ItemNumber, 
             ProductName = s.Product.Name, s.Product.ProductFormatName, 
             s.Quantity, s.AxSale.SalesOrigin}
 


When bound to a grid, I can then show this to the user:

groupedgrid

Categories:   LINQ | ASP.NET
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Register Custom Controls In Web.config

Thursday, 15 April 2010 15:43 by mha

If you’re using a lot of UserControls or a control package, you’re probably finding yourself adding tons of <%@ Register… %> tags to your .aspx pages.

Phil Haack has an excellent post about how to avoid all this mess and put your assembly references into the Web.Config file. Go check it out!

Categories:   ASP.NET
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Slide Screen for Android

Wednesday, 7 April 2010 13:44 by mha
slidescreenui If you’re an Android fan (as I am) and thinks the stock homescreen is really not that great/usable, you should take a look at SlideScreen

SlideScreen is a homescreen replacement, which totally changes how you use your phone.

The cool thing about SlideScreen is that it integrates information from various sources—Google Reader, Twitter, Facebook, email, text messages, calendar appointments and stocks—right onto the homescreen

If you’re a proud Android user, be sure to check it out!
Tags:  
Categories:   Mobile | Tools
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed