Export (0) Print
Expand All
17 out of 22 rated this helpful - Rate this topic

Introduction to the Time Tracker Starter Kit

 

By Bill Evjen
Reuters

August 2005

Applies to:
   Microsoft ASP.NET 2.0
   Microsoft Visual Studio 2005
   Microsoft Visual Web Developer 2005 Express Edition

Summary: Learn about the new Time Tracker Starter Kit, which is a downloadable project type for Microsoft Visual Studio 2005 and Microsoft Visual Web Developer 2005 Express Edition. (27 printed pages)

Contents

Introduction
Initial Setup of the Time Tracker Starter Kit
Creating Application Roles
Creating Users
Changing Registration Details
The Master Page-MasterPage.master
Creating Projects-Project_Details.aspx
Listing Projects-Project_List.aspx
Entering Time-TimeEntry.aspx
Viewing Project Reports-Report_Project.aspx
Viewing Project Resource details-Report_Resources.aspx
Conclusion

Introduction

The Time Tracker Starter Kit enables you to easily create an application that helps present and manage a system that keeps track of time allocated to specified projects. The idea of the Time Tracker Starter Kit is to provide you with a framework that you can use to quickly organize a worthwhile Web site that is focused on a project and time management system. This starter kit provides you with a series of pages that easily allow you to present and manage time dedicated to multiple projects. Starting pages for this starter kit include a home page that provides logs of time individual users allocate to specific projects. Also included in the starter kit are pages that allow you to view projects, resources dedicated to projects, as well as reports based either on projects or resources.

From this brief description, you can see that there is a lot of functionality provided in this framework application. When compiling and running the Time Tracker Starter Kit for the first time and filling in some of the information, you will have something similar to what is shown in Figure 1.

Click here for larger image.

Figure 1. The Log page for the starter kit (click the image for a larger picture)

Each of the pages in the Time Tracker Starter Kit is ready for you to make your own by simply changing the code which is provided. Doing this will start you on the personalization process for your time tracker Web site.

The Time Tracker Starter Kit is also a great learning tool. You can view the code that produces each page of the application, and you will find that it uses some of the strongest features from the latest release of Microsoft ASP.NET. Even if you are not interested in using this starter kit for an actual production Web site, it is still a valuable resource for learning how to create an application using ASP.NET 2.0.

Before we look at working with this application though, let's first start by taking a look at the installation and startup of this starter kit.

Initial Setup of the Time Tracker Starter Kit

The Time Tracker Starter Kit can be downloaded from MSDN and comes as a Microsoft Visual Studio Installer file—TimeTracker.vsi. Double-clicking this file will launch a process to install the starter kit so that it is an available project to you from Visual Studio. From the first screen in the installation wizard (Figure 2), you will notice that, at present, the Time Tracker Starter Kit only is available in C#.

ms972955.ttintro_fig02(en-us,MSDN.10).gif

Figure 2. Installing the Time Tracker Starter Kit

Once you have completed the installation process, you can open up Visual Studio 2005 and create a new instance of this Web site by clicking File and then New Web Site from the Visual Studio application's menu. In the New Web Site dialog box, select Visual C# as the language you are going to use, and then you will see the Time Tracker Starter Kit as one of the available choices. This is illustrated in Figure 3.

ms972955.ttintro_fig03s(en-us,MSDN.10).gif

Figure 3. Selecting the Time Tracker Starter Kit from the New Web Site dialog box (click the image for a larger picture)

Once the Time Tracker Starter Kit option is selected, name the project as you wish and click the OK button to proceed. Visual Studio will then create an instance of this application, which includes a number of folders and files. You can view all of these created items in Visual Studio's Solution Explorer, as illustrated in Figure 4.

ms972955.ttintro_fig04(en-us,MSDN.10).gif

Figure 4. The Time Tracker solution

Looking at Figure 4, you can see that there is a lot to this starter kit. It is really divided into four main parts:

  • The root files, which include the Default.aspx, Global.asax, web.config, and the web.sitemap files. The new addition to this list for ASP.NET 2.0 is the web.sitemap file, which is an XML-based definition of the Web site's navigation structure.
  • The App_Code folder, which contains classes that deal with both the business logic layer and the data access layer. In ASP.NET 1.0/1.1, it was required to compile your .NET components down to DLLs which would then be placed in the application's Bin folder. With ASP.NET 2.0, you can now perform dynamic compilation by placing your .NET components (the actual .vb or .cs files) in the App_Code folder. ASP.NET will then take care of compiling these objects down on your behalf.
  • The App_Data folder, which contains a Microsoft SQL Server Express Edition file (ASPNETDB.mdf). This file stores all the membership and role management information that is used by the application. Also contained in this folder is a SQL script which can be used to create the necessary tables in Microsoft SQL Server 2005 or SQL Server 2000.
  • A folder named TimeTracker, which contains the bulk of the application that is reviewed in this article.

Creating Application Roles

The first thing you should do when you create an instance of the Time Tracker Starter Kit in Visual Studio is to compile and run the application. Doing this will launch a page that contains a login form. This is shown in Figure 5.

Click here for larger image.

Figure 5. The initial login form to access the application (click the image for a larger picture)

When you start up the application for the first time, you are also creating a set of roles that you can then map users to. How are these roles created? They are created in the application's Global.asax file. Taking a look at this file, you will notice that on the Application_Start event, there is the following code as shown here in Listing 1.

Listing 1. Creating roles in the Application_Start event in the Global.asax file

    void Application_Start(Object sender, EventArgs e) {
        // Code that runs on application startup
        if (Roles.Enabled)
        {
            if (!Roles.RoleExists("ProjectAdministrator"))
            {
                Roles.CreateRole("ProjectAdministrator");
            }
            if (!Roles.RoleExists("ProjectManager"))
            {
                Roles.CreateRole("ProjectManager");
            }

            if (!Roles.RoleExists("Consultant"))
            {
                Roles.CreateRole("Consultant");
            }
        }
    }

From this bit of code you can see that a couple of if statements first check to see whether the role management system is even enabled, and if it is, checks are made to see whether the roles of the ProjectAdministrator, ProjectManager, and Consultant exist in the system. This is done using the Roles class's RoleExists() method. If this check is found to be false, then the roles are created using the CreateRole() method.

The differences in these roles are this:

  • Project Administrator—A person in this role has full access to the application. Project Administrators can navigate to each and every page the application offers. They have the ability to create projects, project categories, and users. They can view reports for all resources and projects that are contained in the system.
  • Project Manager—A person in this role has full access to the projects for which he or she is assigned. The big difference between the Project Manager role and the Project Administrator role is that Project Managers cannot list the users contained in the system and they cannot see or work with projects which are not assigned to them.
  • Consultant—A consultant has the least amount of privileges in this application. Consultants can only enter time in the time sheet for projects they are working with and no more.

Now that the roles are created for the Time Tracker Starter Kit, you can shut down the application by closing the browser instance. Then, open up the ASP.NET Website Administration Tool for this application by clicking Website and then ASP.NET Configuration from the Visual Studio application's menu. You will then be presented with a Web-based GUI that allows you to set specific configuration settings for your application. After clicking the Security tab, you will see that there are indeed three roles configured for the application. This is illustrated in Figure 6.

ms972955.ttintro_fig06(en-us,MSDN.10).gif

Figure 6. Checking to see that three roles are created for the Time Tracker application

Now that the roles are created, let's next take a look at creating some users.

Creating Users

There are a couple of ways in which you can create users for the Time Tracker Starter Kit. Each method works, but there are some differences, which will be explained. The three methods include:

  • Navigating to the User_Create.aspx page. The link for this page can be found directly below the login form, as shown in Figure 5.
  • Creating users directly from the ASP.NET Web Site Administration Tool.
  • Creating users from the Administration tab in the Time Tracker application. You can only get to this point in the application if you are already a logged-in user, but this page allows you to create additional users as required. You can also assign a particular role to a user at this point.

Let's focus on using the User_Create.aspx page to create our first user. Any person that browses to the Time Tracker application will be able to get to this login form, and will also be able to click the link to create a user. This means that, by default, the application is open to all users. Anyone can set up himself or herself as a user, and then log in to the application.

Clicking the Create new user link pulls up a page that allows you to enter in the user's username, password, and e-mail address. It is important to note that, by default, ASP.NET 2.0 requires a strong password containing at least eight characters, including a combination of uppercase and lowercase characters, numbers, and special characters (for example, !, #, $, %).

Once this information is entered into the form, click OK, and you will then be set up to then log in to the application. However, clicking the Finish button shown with the confirmation message at the end of the registration process will automatically log the user in to the application. This is because the CreateUserWizard server control (this is the control that supplied the form for the registration process) automatically logs in the users that register for the site, through the user of the LoginCreatedUser attribute, which is set to True by default. Once logged in to the application, the user is then directed to another page through the use of the ContinueDestinationPageUrl attribute. This is illustrated in Listing 2.

Listing 2. Enabling page forwarding after a user is registered

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" 
 OnFinishButtonClick="Wizard_FinishButton_Click"
 ContinueDestinationPageUrl="TimeEntry.aspx" 
 OnCreatedUser="CreateUserWizard1_CreatedUser">
   <!-- Content removed for clarity -->
</asp:CreateUserWizard>

From this bit of code, you can see that the ContinueDestinationPageUrl attribute points to the page that the user will be directed to after the registration process.

Changing Registration Details

As stated earlier, by default, any anonymous user can come to the application and register himself or herself as an administrator of the application, without any problems. This is a behavior that can be easily changed through some application configuration settings. Looking at the files contained in the solution, you will see that there are two web.config files. There is one that is contained in the application's root directory, and another that is contained in the TimeTracker folder. The web.config file in the root of the application provides settings that are applied to the entire application, whereas the web.config file in the TimeTracker folder is for files contained only in this folder. It is important to note that, even if there are duplicate configuration settings found in each of the web.config files, the one in the TimeTracker folder supersedes the one contained in the root directory.

Looking at the web.config file in the TimeTracker folder, you will see the content illustrated in Listing 3.

Listing 3. Configuration settings in the TimeTracker folder's web.config file

<?xml version="1.0"?>
<configuration 
 xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <appSettings>
    <!-- Some items removed for clarity -->

    <!-- Set the Default Role for New Users
        0 = Project Administrator
        1 = Project Manager
        2 = Consultant
      -->
    <add key="DefaultRoleForNewUser" value="0"/>

    <!-- Define if an anonymousUser is allow to create new users
        0 = false
        1 = true
      -->
    <add key="AllowUserCreationForAnonymousUsers" value="1"/>
  </appSettings>
</configuration>

There are a few good settings to pay attention to. The first is the DefaultRoleForNewUser setting. By default, when you go to the User_Create.aspx page to create a user, the newly created users are all given the role of Project Administrator by default. This might not always be a good thing. So, once you do have a Project Administrator in place, it might be beneficial to change this setting. You have the option of giving the DefaultRoleForNewUser setting a value of either 0, 1, or 2. The definitions of these values are provided in the comments of the listing.

This information about the roles to assign to users is then read in the code-behind file of the User_Create.aspx page, as shown in Listing 4.

Listing 4. Grabbing the DefaultRoleForNewUser value

private string GetDefaultRoleForNewUser() {
    if (ConfigurationManager.AppSettings["DefaultRoleForNewUser"] == null)  
    {
      throw (new Exception("DefaultRoleForNewUser was not " + 
               "been defined in the appsettings section of config"));
    }
    else {
      string defaultRole = 
         ConfigurationManager.AppSettings["DefaultRoleForNewUser"];
      if (string.IsNullOrEmpty(defaultRole)) {
        throw (new Exception("DefaultRoleForNewUser does not " +
           "contain a default value"));
      }
      else {
        if (string.Compare(defaultRole, "3") < 0 && 
           string.Compare(defaultRole, "0") >= 0) {
          return 
             (ConfigurationManager.AppSettings["DefaultRoleForNewUser"]);
        }
        else {
          throw (new ArgumentException("DefaultRoleForNewUser " +
             "defined in the appsettings has to be between 0 and 2"));
        }
      }
    }
  }

Then, later in the CreateUserWizard1_CreatedUser event, the value returned from the GetDefaultRoleForNewUser() method is used.

  AddUserToRole(CreateUserWizard1.UserName, GetDefaultRoleForNewUser());

The other setting to pay attention to from the web.config file shown in Listing 3 is the AllowUserCreationForAnonymousUsers setting. This setting specifies whether or not anonymous users coming to your application can register themselves and log in to the application. By default, this is set to 1 (meaning true). When set in this manner, anonymous users can see the link on the login form page to the User_Create.aspx page. When this setting is set to 0 (meaning false), this link will not be present when the user encounters the login form. This is illustrated in Figure 7.

Click here for larger image.

Figure 7. The anonymous user's view of the login form (click the image for a larger picture)

Even if the anonymous user knows the URL location of the registration form (in this case, User_Create.aspx) and typed this page into the browser, he or she still would not be allowed to register himself or herself for the site, and instead would see the message shown in Figure 8.

Click here for larger image.

Figure 8. The error message an anonymous user receives when attempting registration (click the image for a larger picture)

The Master Page—MasterPage.master

In working with the layout of the Time Tracker Starter Kit, you will notice that most of the pages are missing a good part of the page's layout that is carried throughout the application. This is because the Time Tracker Starter Kit is utilizing a brand new feature of ASP.NET 2.0 called master pages.

Master pages provide a new way in which you can build templated pages. This means that you can build a master template or a master page that can then be applied to each and every page you designate. As you will see, the Time Tracker Starter Kit makes strong use of master pages.

The MasterPage.master page for this starter kit is purely a presentation template that can then be used by any content page contained in the application (content pages are discussed shortly).

The navigation system used in this starter kit is constructed and presented through the master page. The construction of the navigation system is presented through a menu that is laid out horizontally. The data for this navigation system is retrieved from the application's web.sitemap file.

The web.sitemap file is an XML file which allows you to define the navigational structure of your entire application. The web.sitemap file can be found in the root directory of the application, and it contains a series of <siteMapNode> links which define a single navigational point. A single <siteMapNode> is illustrated in Listing 5.

Listing 5. A single <siteMapNode> element found in the web.sitemap file

<siteMapNode title="Log"
 url="~/TimeTracker/TimeEntry.aspx"
 description="Log a time entry"
 roles="Consultant,ProjectManager,ProjectAdministrator" />

As you can see, not only can you define the URL destination of the link that will be created from the reading of this XML element, but you can also define the text used in the ToolTip (through the use of the description attribute), and the roles which are allowed to view the link.

Having your application's page structure defined in a web.sitemap file allows you to then interact with your defined navigation structure through the new Sitemap class or through the new SiteMapDataSource control. Using the SiteMapDataSource control, you can bind to the contents of the navigational structure in the web.sitemap file, using either data-binding expressions or server controls that have been built to work with the SiteMapDataSource control (such as the TreeView or Menu server controls).

In the case of the Time Tracker Starter Kit, the MasterPage.master page utilizes a menu control to get at the information that is provided from the SiteMapDataSource control. Listing 6 shows the SiteMapDataSource control that is used in the master page.

Listing 6. The SiteMapDataSource control from the master page

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" 
 ShowStartingNode="false" />

Then, directly below the SiteMapDataSource control's markup, you will find a Menu server control. The Menu control binds itself to the SiteMapDataSource control through the use of the DataSourceID attribute used in the control. This is illustrated in Listing 7.

Listing 7. The Menu server control bound to the SiteMapDataSource1 control

<asp:Menu ID="MainMenu" runat="server" Orientation="Horizontal" 
 MaximumDynamicDisplayLevels="2" DataSourceID="SiteMapDataSource1" 
 DynamicEnableDefaultPopOutImage="False" 
 StaticEnableDefaultPopOutImage="False">
   <StaticMenuStyle CssClass="menu" />
   <StaticMenuItemStyle CssClass="menuItem" />
   <StaticSelectedStyle CssClass="menuSelectedItem" />
   <DynamicMenuStyle CssClass="menuPopup" />
   <DynamicMenuItemStyle CssClass="menuPopupItem" 
    Font-Strikeout="False" />
   <DynamicHoverStyle CssClass="menuPopupItem" />
   <StaticHoverStyle CssClass="menuItemHover" />
</asp:Menu>

This system produces the results shown in Figure 9.

ms972955.ttintro_fig09(en-us,MSDN.10).gif

Figure 9. The Menu server control at work.

Notice that the menu item also pops out submenu items—all based on information that is coming from the web.sitemap file.

Probably the most interesting server control on the master page that is new to ASP.NET 2.0 is the ContentPlaceHolder control. The ContentPlaceHolder control is a defined area that allows any content page that is using this particular master page to interject content into it. Basically, when you construct your master pages, you are allowing content pages to use specified sections of the page. A content page will not be able to work outside the bounds of this content area. Though it is possible to include multiple content areas through the use of multiple ContentPlaceHolder controls placed on the master page, this example (our MasterPage.master page) uses only one of these controls.

<asp:ContentPlaceHolder ID="maincontent" runat="server">
</asp:ContentPlaceHolder>

Next, we will take a look at a content page that is utilizing this master page.

Creating Projects—Project_Details.aspx

After you have created a user that is contained in the Project Administrator role, you can click the Administrator tab in the application and add additional users which will be held in the Project Manager role. Doing this will allow you later to assign specific projects to specific project managers, if you desire.

After all the users you want are held in the system, the next step is to create your first project. To do this, click Projects and then Create New Project from the Time Tracker application's menu.

This will give you a page as shown in Figure 10.

Click here for larger image.

Figure 10. Creating a new project (click the image for a larger picture)

To create your first project will take a couple of steps. Follow the steps detailed here:

  1. First, give your project a name. I'll use Company Intranet as an example.
  2. Next, assign a project manager. It can be anyone in the Project Administrator or Project Manager roles.
  3. Click the Calendar icon to select a date which is the estimated completion date of the project.
  4. Input the number of hours the project will need. If you enter a decimal—for instance 2.5—then the Time Tracker Starter Kit will round the decimal up to the next whole number.
  5. Enter a description of the project.
  6. Select all the resources that will be working on this project. Every user that is contained in the membership system for the application (regardless of their role) will be shown in this text box. To select multiple users, hold down the CTRL key as you use your mouse to make selections. You can also hold down the SHIFT key instead, to make a range of selections.
  7. Click the Save button.

Once you click the Save button, the project will be created. The next step will be to create categories for the project. These categories are used in assigning time by the individuals who are working on the project. Figure 11 shows the project after a couple of categories have been entered into the system.

Click here for larger image.

Figure 11. Assigning categories to the new project (click the image for a larger picture)

From this page, you can also edit or delete the categories, by selecting the appropriate icon button next to the category. When you have more than one project, it is also possible to assign all the categories that are contained in one project so that they appear in another. This is done through the drop-down list and the Copy button at the bottom of the form (Figure 11).

The Project_Details.aspx page is the first content page that we have looked at. You can tell that it is not your standard ASP.NET page, but instead a content page which is getting a lot of page structure defined from a master page, by looking at the @Page directive of the page.

<%@ Page Language="C#" MasterPageFile="~/TimeTracker/MasterPage.master" 
    CodeFile="Project_Details.aspx.cs" Inherits="Project_Details_aspx" 
    Title="My Company - Time Tracker - Manage Projects" 
    Culture="auto" UICulture="auto" %>

Through the use of the MasterPageFile attribute in the @Page directive, this ASP.NET page declares that it is a content page and that the template to use is the MasterPage.master page that we covered earlier. Because this is a content page that is using a master page as a template, you are not to include any of the HTML tags that are used as a framework for the page (such as the <html>, <body>, and <form> tags). The reason for this is that these items are already included in the MasterPage.master page.

If you look back in the master page, you will remember that there was a single location on the page that was allotted for a content page to place items. This was done through the use of the ContentPlaceHolder server control. When working with a content page, you make an association to this instance of the ContentPlaceHolder control on the master page, through the use of a Content server control. Looking through the Project_Details.aspx page, you will notice that there is a single Content control.

<asp:Content ID="Content1" 
 ContentPlaceHolderID="maincontent" runat="Server">
   <!-- Content removed for clarity -->
</asp:Content>

Looking at the Content control, you will be able to notice that the association to the ContentPlaceHolder control is done through the use of the ContentPlaceHolderID attribute that uses as a value the ID attribute of the ContentPlaceHolder control that is used on the master page. Any content placed inside the Content control will then appear on the merged page.

Listing Projects—Project_List.aspx

Clicking Projects and then List Projects from the Time Tracker application's menu pulls up a page that lists projects which you are allowed to view. Projects are displayed in a GridView server control, but without automatically binding all the columns from the database to the columns in the GridView—this automatic feature is turned off by setting the AutoGenerateColumns attribute to False. Instead, this GridView control builds its own columns, and maps these columns to columns in the database through the use of either <asp:BoundField>, <asp:HyperLinkField>, or <asp:CommandField> controls. An example of what this GridView control produces is displayed in Figure 12.

Click here for larger image.

Figure 12. A listing of projects shown on the Project List page (click the image for a larger picture) (click the image for a larger picture)

From Figure 12, you can see that it is also possible to edit or delete projects that are contained in the GridView control. These buttons are placed in the GridView using both the <asp:HyperLinkField> and the <asp:CommandField> controls shown in Listing 8.

Listing 8: Placing command buttons in the GridView control

<asp:HyperLinkField HeaderText="Edit Project" DataNavigateUrlFields="Id" 
 DataNavigateUrlFormatString="Project_Details.aspx?ProjectId={0}"
 Text="Edit..." />
<asp:CommandField ShowDeleteButton="True" HeaderText="Delete" 
 DeleteImageUrl="images/icon-delete.gif"
 ButtonType="Image" />

There are two different types of buttons in use here. The first is the Edit button. This button is simply a hyperlink that points to the Project_Details.aspx page and includes a query string with the ID of the project. The actual ID of the project is assigned to the URL through the use of the DataNavigateUrlFields attribute. In this case, it uses the value of Id, which is retrieved from the underlying data store.

The second type of button is a Delete button that is actually an image. In this case, we are using the <asp:CommandField> control to place a button in the column. This control allows the buttons to be either hyperlinks, regular gray buttons, or even image buttons. For this example, the button is actually an image button, and the image is assigned through the use of the DeleteImageUrl attribute which points to the location of the image. However, if you are going to have this be an image, you also need to use the ButtonType attribute and give this a value of Image, as is done in the example in Listing 8.

What projects are actually shown in this GridView control? Well, that depends on which role you are in. The logic behind which projects to present are contained in the Project_List.aspx page's code-behind file (Project_List.aspx.cs), shown in Listing 9.

Listing 9. Deciding what projects to present in the Page_Load event

  void Page_Load(object sender, EventArgs e) {
    if (!Page.IsPostBack) {
      if (Page.User.IsInRole("ProjectAdministrator")) {
        ProjectData.SortParameterName = "sortParameter";
        ProjectData.SelectMethod = "GetAllProjects";
      }
      else {
        ProjectData.SelectParameters.Add(new Parameter("userName", 
           TypeCode.String, Page.User.Identity.Name));
        ProjectData.SortParameterName = "sortParameter";
        ProjectData.SelectMethod = "GetProjectsByManagerUserName";
      }
    }
  }

From this bit of code, you can see that first a check is done to see if this request is not a postback. Then, a check is made to see if the user is in the role of ProjectAdministrator. This role check is done using the Page.User.IsInRole() method. If they are found to be in the ProjectAdministrator role, then the GetAllProjects() method is retrieved, using the ObjectDataSource server control found on the Project_List.aspx page. Otherwise, the same ObjectDataSource control is used, but instead of GetAllProjects() being called, the GetProjectsByManagerUserName() is invoked. These methods are located in the business logic layer (BLL folder in the App_Code folder) in the Project.cs class file.

Entering Time—TimeEntry.aspx

Once a project is in place, people that are assigned to work on that project can then start entering time against it. This is done on the TimeEntry.aspx page. Directly after a user logs in to the Time Tracker Starter Kit application, they will be directed to this page. Another method of getting to this page is by clicking the Log button in the Time Tracker site navigation. This page is shown in Figure 13.

Click here for larger image.

Figure 13. Logging hours to a project on the TimeEntry.aspx page (click the image for a larger picture)

Through this page, you can select a project in the page's form to log hours. This project selection will drive what is shown in the drop-down list which shows categories of the project. The selection of a project in the project drop-down list will also drive the entries which are displayed in the right-hand portion of the page. In the example shown in Figure 13, the Company Intranet project has been selected, and this in turn shows the time that has been entered to this project by the user evjen. Being a Project Manager or Administrator also mean that you can use the drop-down list of names which are assigned to a project and look at time entries for each of these users.

The entries which are displayed by another GridView control on this page can also be controlled through the editing and deleting capabilities which are provided. This GridView is very much like the GridView which was built on the previous page we looked at—Project_List.aspx.

Viewing Project Reports—Report_Project.aspx

Now that time has been entered into the system and assigned to particular projects, you can take it one step further and look at an online report for the project. Figure 14 shows a simple look at the Company Intranet project and the online report that is generated from just a couple of entries.

Click here for larger image.

Figure 14. Viewing an online report for the Company Intranet project (click the image for a larger picture)

You can display a report like the one shown in Figure 14 by clicking Reports and then Project Reports from the Time Tracker Starter Kit application's menu. This will then give you a page which lists all the projects which are available to you as a user to view. From this page, select the projects you are interested in seeing a report for, and then click the Generate Report button found at the bottom of the page. This is shown in Figure 15.

Click here for larger image.

Figure 15. Selecting a project report to view (click the image for a larger picture)

It is possible to select multiple reports by holding down the CTRL key and using your mouse or space bar to make the selections.

Viewing Project Resource Details—Report_Resources.aspx

Just as it is possible to view a report on the projects that are contained in the system, you can also view reports based on the individuals who are working on these projects. To get to the page which shows reports on the resources found in the system, click Reports and then Resources Report from the application's menu.

You will then be presented with a page which has three steps:

  • STEP 1: Select the project you are interested in viewing. You can select multiple projects if you wish.
  • STEP 2: Select the resources you are interested in viewing. You can also select multiple resources if you wish.
  • STEP 3: Select the date range you are interested in viewing.

Once these items are selected, you can press the Generate Report button at the bottom of the page. You will then be given a report, as shown in Figure 16.

Click here for larger image.

Figure 16. Looking at a resource report in the Time Tracker Starter Kit (click the image for a larger picture)

Conclusion

The Time Tracker Starter Kit is both valuable and fun for several reasons. First, it allows you to quickly and easily create a Web site that you can use within your organization today. Second, and more importantly, like the other starter kits available from MSDN, this starter kit shows off some of the new capabilities found in ASP.NET 2.0, as well as some new features provided by the underlying .NET Framework 2.0.

From generics to new controls, there is a lot to learn from this application. Some of the more important items to pay attention to are the new membership and role management systems that ASP.NET 2.0 provides. These new security systems allow you to easily manage access to your application, and to not only authenticate users in a general fashion, but to also place the authenticated user in a particular role that will have different access rights.

The idea of this starter kit is not to use it as is, but instead to customize it heavily. You needn't limit yourself to simply changing the text; instead, you should look at how to add additional roles, privileges, new pages, and new capabilities.

Have fun, and happy coding!

 

About the author

Bill Evjen is an active proponent of .NET technologies and community-based learning initiatives for .NET. He has been actively involved with .NET since the first bits were released in 2000. In the same year, Bill founded the St. Louis .NET User Group (http://www.stlnet.org), one of the world's first .NET user groups. Bill is also the founder of the International .NET Association (http://www.ineta.org), which represents more than 375,000 members worldwide.

Based in St. Louis, Missouri, USA, Bill is an acclaimed author and speaker on ASP.NET and XML Web services. He has written or coauthored Professional C#, 4th Edition and Professional VB 2005, 4th Edition (Wrox); XML Web Services for ASP.NET; Web Services Enhancements: Understanding the WSE for Enterprise Applications; Visual Basic .NET Bible; and ASP.NET Professional Secrets (all published by Wiley). In addition to writing, Bill is a speaker at numerous conferences, including DevConnections, VSLive, and TechEd.

Bill is a Technical Director for Reuters, the international news and financial services company, and he travels the world speaking to major financial institutions about the future of the IT industry. He graduated from Western Washington University in Bellingham, Washington, with a Russian language degree. When he isn't tinkering on the computer, he can usually be found at his summer house in Toivakka, Finland. You can reach Bill at evjen@yahoo.com. He presently keeps his weblog at http://www.geekswithblogs.net/evjen.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.