Friday, February 26, 2010

NCharlie Task Board – Webforms version

…in which the task board UI comes alive.

I’ve got my domain objects and simple persistence finished.  Now I will implement the user interface first using ASP.Net Webforms.  I created screen mockups in an earlier post, and this view model class is a representation of that screen:

public class BoardViewModel
{
public string Name { get; set; }
public int CommunityId { get; set; }
public int PageId { get; set; }

public ColumnViewModel[] Columns { get; set; }
public class ColumnViewModel
{
public string Id { get; set; }
public string Name { get; set; }

public TaskViewModel[] Tasks { get; set; }
public class TaskViewModel
{
public string Id { get; set; }
public string Name { get; set; }
public bool InFirstColumn { get; set; }
public bool InLastColumn { get; set; }
}
}
}



The user interface for this model is a “board” with a variable number of columns, each of which has a variable number of tasks in it that can jump forward or back to other columns.  For the Webforms version I use nested Repeater controls to accomplish this.  This is how it turned out:



TaskBoard-Webform01



I’m keeping this post short, but there is actually plenty to talk about behind the scenes that I may cover in more detail in later posts.  For now, here’s a list of elements that in my opinion made this little project fun to work on:




  • Uses a master page, NCharlie.master


  • Uses jQuery for showing/hiding textboxes for user input


  • Uses Automapper to simplify mapping entities retrieved from the database to the view model for display


  • Uses the StructureMap IoC container for injection of IBoardRepository into the page constructor


  • Web.config modification: added HttpModule reference for the TransactionBoundaryModule class (implements the Unit of Work pattern using one NHibernate Session Per Http Request)



There are some things I need to improve… for example, I don’t have StructureMap configured to automatically inject the repository class.  Rather, I’m asking StructureMap for it explicitly in the constructor… simply because I’m still weak in that area and need to learn how.  Also, I skipped writing tests for this bit of code… mainly because I find it hard to write tests for Webform controller classes.  Hopefully I will be able to fix that when I implement the MVC version.



Check it out in the Webform branch of the NCharlie source.

No comments:

Post a Comment