SalesAnalysis
--------------------------------------------------------------------------------------------
Demonstrates using a C1FlexGrid in a Silverlight RIA Services Business Application.

This project shows how the C1FlexGrid can be used in typical Silverlight business 
applications with ADO.NET Entity Framework data access, Domain Data Services, and a 
DomainDataSource control.

Here is a brief summary of the elements in the data layer:
- ADO.NET Entity framework (access to data store)
- Domain Service (data bridge between server and client)
- DomainDataSource (encapsulate domain services to provide smart ICollectionView implementation)

For details on how to add these elements to your applications, please refer to the 
following links:

- http://msdn.microsoft.com/en-us/library/ee796239(v=VS.91).aspx
- http://www.aspfree.com/c/a/Silverlight/Silverlight-40-DomainDataSource/

This data layer provides applications with access to strongly-typed data stored on the 
server and several easy-to-use options to customize how the data is retrieved.

In this sample, the DomainDataSource control is configured to retrieve data in small 
batches, so the application remains responsive while loading a little over 2000 records 
from the server. This is done by setting the DomainDataSource.Load property, which
can be done in XAML:

       <riaControls:DomainDataSource 
            x:Name="_ddsInvoices" 
            LoadSize="200" 
            AutoLoad="True"
            QueryName="GetInvoicesQuery"
            LoadingData="_ddsInvoices_LoadingData"
            LoadedData="_ddsInvoices_LoadedData" >
 
Binding the C1FlexGrid to a DomainDataSource control is no different than binding it
to a list of objects. You simply assign the data source to the C1FlexGrid's ItemsSource
property. The grid gradually shows the new data items as they become available 
from the DomainDataSource.

When you run the application, notice the great performance, familiar selection and 
grouping behavior, and the following unique features:

1 - Dynamic subtotals: The group headers shown in the sample contain subtotals for
    the invoices in the group. The subtotals are automatically updated as the data
	is loaded or edited. These are implemented simply by setting the GroupAggregate 
	property on the extended price column to Aggregate.Sum.

2 - Advanced Grouping: Hold down the control key to collapse or expand the entire
    grid at once to any desired outline level. This simple feature, along with the
	dynamic subtotals, allows you to use the grid to create quick summary reports 
	(sales by country or customer for example).

3 - Printing: Once you have created an interesting quick summary report, you can
	print it by clicking a button. The C1FlexGrid provides high quality printing
	support with control over content scaling, margins, and repeating column and
	rows headers on every page.

4 - Saving: You can also click a button to save your quick reports to CSV, plain 
	text, or Html.

Note: If you want to run this sample in VS2013, you should do either in the following.
1) Install Microsoft SQL Server 2012 Express from the following link:
     http://www.microsoft.com/en-us/download/details.aspx?id=29062

2) Make two small changes to the ConnectString in the Web.config as the following:
     - Use “(LocalDB)\v11.0” instead of “.\SQLEXPRESS” as data source
     - Remove User Instance=true
    e.g.:
		<connectionStrings>
			<add name="ApplicationServices" connectionString="Data Source=(LocalDB)\v11.0;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;" providerName="System.Data.SqlClient" />
			<add name="NORTHWNDEntities" connectionString="metadata=res://*/NorthwindModel.csdl|res://*/NorthwindModel.ssdl|res://*/NorthwindModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
		</connectionStrings>
Plus, you should change northwnd.MDF/northwnd_log.ldf under App_Data folder not to be read-only before you run this sample.