← Back to all blogs

Posts tagged with 'adventureworks'

What's New in WPF and Silverlight 2013 v3

Studio Enterprise 2013 v3 is now available just one day after the release of Visual Studio 2013. Normally each release I post about what's new in all of the ComponentOne XAML studios in one post but this time i'm splitting out WinRT XAML from Silverlight and WPF because there's too much to mention for each studio. Studio for WinRT XAML continues to expand greatly (see my next post about that), while WPF and Silverlight have some exciting new stuff that's exclusive to these platforms such as themes and 3D charts. Let's run through what you'll find new inside Studio for WPF and Silverlight this release.

Epic AdventureWorks Part 4 - The Style

This article is (finally) the fourth of a four part series: Epic AdventureWorks Part 1 - The Blueprints Epic AdventureWorks Part 2 - The Model Epic AdventureWorks Part 3 - The Web App Epic AdventureWorks Part 4 - The Style Check out the AdventureWorks ASP.NET Sample ASP.NET app online. And now, I introduce to you, Jon "Jebro" Coulter. This is the CSS ninja that styled the entire app. This entire article was written by him so kick back, relax and listen to how he styled AdventureWorks. There are a few VisualStyles that make up the controls in this page, the majority of them being custom or based on Windows7 BonusVisualStyle. Let's start with the menu. This is a hierarchical tab control used as a menu. The styling for this is very simple; it is a custom visual style with minimal styling added. Hierarchical tabs work by using levels, so here you can see 'level0' is styled as a dark bar, and 'level1' is styled as a brighter blue as it is going to represent where you are. The benefit of hierarchical tabs is that it can also function similar to a breadcrumb, as you can see the page you are currently on is in bold as well as the category you are in. #hd .menu {background:none repeat scroll 0 0 #333333;clear:both;display:block;margin:0;padding:0;width:100%;}#hd .level0 {border-bottom:3px solid #0099CC;}#hd .level1 {background:none repeat scroll 0 0 #007399;clear:both;color:#FFFFFF;display:block;margin:0;outline:medium none;padding:0 2%;width:96%;}#hd .menu .C1Selected {-moz-border-radius:3px 3px 0 0;background:none repeat scroll 0 0 #0099CC;color:#FFFFFF;font-weight:700;}

Epic AdventureWorks Part 3 - The Web App

This article is the third of a four part series: Epic AdventureWorks Part 1 - The Blueprints Epic AdventureWorks Part 2 - The Model Epic AdventureWorks Part 3 - The Web App Epic AdventureWorks Part 4 - The Style Check out the AdventureWorks ASP.NET Sample ASP.NET app online. Now that we designed the blueprints and built an object model, its time to start to develop a website. I am going to create an ASP.NET 3.5 website project. I want to take advantage of the model I built with the Entity Framework and use LINQ to easily query the model. These two technologies will help me rapidly develop against this otherwise daunting database. To build a website I usually start with the most critical piece first and work down the chain from there. So in my opinion the most important part of a retail company's website is the product catalog. Some people might argue that it is the shopping cart, but the way I see it, no one is going to buy until they know what the product is. So we will assume there is a direct sales team to take orders until our shopping cart is launched. General practices Before we dig into code, here are a few of general practices I use when doing ASP.NET web development. Follow MVC Patterns (even in WebForms) I have been following this pattern subconsciously for years of WebForms development. It just makes sense. So how do I follow the pattern in WebForms? In a nutshell: loosely. I like to seperate all of my UI "chunks" or "modules" into UserControls and create Classes for them to inherit. I usually make the Classes more general like "ProductModule" and many UserControls inherit from it to take advantage of common data models and params. I then organize my UserControls into folders that group them logically. For this project I create "Products" and "Order" to section the modules into product catalog UI and shopping cart UI. In the root UserControls folder I add common UI elements like Header and Footer. Take Advantage of ASP.NET UI Features I like to utilize App_Themes, Skins and MasterPages to make UI development faster and more efficient. App_Themes are a nice way to stay organized and adding Skins to them helps to apply theme and behavior settings across the entire app. MasterPages are probably my favorite feature added in ASP.NET 2.0 and have saved me countless hours of work. I am also a fan of using nested MasterPages to really build rich UI templates across a large web app, but we will just use on in this project. Import a CSS Layout Framework Once of the biggest frustrations in web design is layout. I consider myself a CSS guru and still get stumped on some complex layout issues. If you want to spend your time actually styling things with CSS and not trying to hack your layout to work in all browsers then this practice is for you. In this app (and all my work) I chose to use YUI stylesheets including reset, base and grids. Reset will basically reset style on every html element to create a clean pallete across all browsers. Base (which requires reset) will give consistent styling to all html elements. Grids (which requires reset and base) creates a layout framework for you to build pretty much any type of column layout you need. It gets a little crazy when writing the markup, so they also provide a grid builder to make things easier. I can't recommend this practice enough. It has saved me so much time and prevented so many headaches. Use 3rd Party Controls As much as I would love to think I can build every aspect of my projects alone, it just isn't reality. I know it sounds like hot air coming from me, but using 3rd party controls is a great way to shift focus from the tedious code to the fun stuff. I have already wasted too many precious keystrokes writing sort algorithms and browser hacks. I had to draw the line and let the pro's do it for me. One of the most productive things you can do as a developer is know when to delegate work. For me, that delegation includes using custom controls that usually have more functionality than I would ever care to write for myself. Seriously, who really wants to sit down and write a PDF writer? No offense if that kind of programming is your cup of tea, but it sure isn't mine. I want to build the app, get it out the door and watch people use it. Then I can spend my time refining the UX and not trying to fix bugs in the chart control I was to stubborn to purchase. That's right, you need to think of how much effort you are going to spend supporting the custom controls you build on your own, not just how long it would take to develop. The next time you go to develop some controls I would ponder how valuable your time is and whether it's worth your keystrokes. I'm sure you get the picture, so I will stop with the C1 fanboy stuff. Let's Dev! Build the Navigation The AdventureWorks database products are organized by Category and SubCategory. So the first thing to do is make a few methods to build these lists.  Let's start with one we need to make the main menu. For the menu we will need a list of the the base categories in the database. So here is what that method would look like using LINQ against my Entity Model. public static List GetMainCategories(){ var cats = from cat in Common.DataEntities.ProductCategory select cat; return cats.ToList();}

Epic AdventureWorks Part 2 - The Model

This article is the second of a four part series: Epic AdventureWorks Part 1 - The Blueprints Epic AdventureWorks Part 2 - The Model Epic AdventureWorks Part 3 - The Web App Epic AdventureWorks Part 4 - The Style Check out the AdventureWorks ASP.NET Sample ASP.NET app online. If you haven't already figured it out, we are going to use the AdventureWorks 2008 sample database from codeplex to build against. We wanted to use something that was: A relational database model A full scale database with real world data Familiar to most developers We also made sure not to build anything that required changes to the database schema or data in order to work. The purpose of this goal is that developers can plug this app into the AdventureWorks database they might already have installed. About the AdventureWorks database The AdventureWorks OLTP database supports standard online transaction processing scenarios for a fictitious bicycle manufacturer (Adventure Works Cycles). Scenarios include Manufacturing, Sales, Purchasing, Product Management, Contact Management, and Human Resources. AdventureWorks is used in code examples in SQL Server Books Online and in companion samples that can be downloaded from the Microsoft SQL Server Samples and Community Projects home page. The database schema is designed to showcase SQL Server features. The AdventureWorks data model is relational and uses alot of good practices in doing so. For this reason, the database might be someone cumbersome to those of you used to more flattened samples from Microsoft. Luckily, they published some helpful articles that map AdventureWorks to the older and flatter sample databases. If you are a hardcore Northwind fanboy then you might enjoy this AdventureWorks to Northwind Table Comparison. And if you are really old school then you should check out this AdventureWorks to pubs Table Comparison. The entire data model is well-documented and can be seen on this AdventureWorks Data Dictionary and this SQL Server Objects in AdventureWorks. Here is a great diagram depicting the whole database model and its entities. Check out the complete data model: AdventureWorks2008.pdf Building the Model Since AdventureWorks is a large and fairly complex database, I did not want to write an entire business model for it. I chose to use Entity Framework to generate a model for me. AdventureWorks is well-structured so I figured Visual Studio would do a good job of auto-generating the model from the database schema. Let's look at how we can easily generate a Entity Framework model from an existing database. First we need to "Add New Item" to the project and select "ADO.NET Entity Data Model". Next we will choose to "Generate from database". We are choosing this option since the database is already well-structured and matches the model we want to work with. For highly normalized databases it is sometimes better to start with an empty model and add model views that merge tables to build useful objects. For this application I have embedded the database inside the App_Data folder so we will choose to generate our model from the MDF file itself. I only chose this option because we will be making this application available for download and I did not want to require you all to install a separate instance of AdventureWorks on a SQL Server. Next I will select which object in the database we want to add to the entity model. I am choosing all since I want to be able to work with Tables, Views and Stored Procedures included in the database. This dialog allows you to drill down to specific data objects in case you want to explicitly include or exclude objects (like a legacy Table).   Click finish and BOOM, we have a full object model to work with including methods for Updates, Inserts and Deletes. Below is the model we generated in minutes. As you can see, it is quite substantial and would take a long time to develop manually! Thank you ADO.NET Entity Framework for making my life easier. Wow, that was easy. Extending the Model Now that we have a fairly complete object model, I want to extend it to make it more usable. The first thing I want to do is expose the data through a Web Service so we can work with the model on the client-side. I don't know what is easier: generating an ADO.NET Entity Data Model or exposing an entire ADO.NET Entity Data Model as a Web Service. To start, I "Add New Item" and select "WCF Data Service" Visual Studio will generate the following code for the code behind the Web Service. using System;using System.Data.Services;using System.Data.Services.Common;using System.Collections.Generic;using System.Linq;using System.ServiceModel.Web;public class DataService : DataService< /* TODO: put your data source class name here */ >{ // This method is called only once to initialize service-wide policies. public static void InitializeService(IDataServiceConfiguration config) { // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc. // Examples: // config.SetEntitySetAccessRule("MyEntityset", EntitySetRights.AllRead); // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All); }}

What's New: RDL Reporting Definition Support

In 2010 v1, ComponentOne added preliminary support for the Microsoft Reporting Services (RDL) to the C1PrintDocument component. Now it's so easy to display your RDL reports in your WinForms applications and get all of the extra features that come with ComponentOne Reports for WinForms, as well as other development platforms which support ComponentOne reports such as ASP.NET, WPF and soon Silverlight!