Click here to Skip to main content
15,892,517 members
Articles / Web Development / ASP.NET

Race to Linux - Race 2: Time Tracker Starter Kit

Rate me:
Please Sign up or sign in to vote.
4.25/5 (5 votes)
26 Sep 20051 min read 40.4K   274   16  
Time Tracker Starter Kit port to Linux using Mono and FireBird
using System;
using System.Configuration;
using System.Data;
using ASPNET.StarterKit.TimeTracker.DataAccessLayer;

namespace ASPNET.StarterKit.TimeTracker.BusinessLogicLayer
{
	//*********************************************************************
	//
	//	ProjectReportEntryLog Class
	//
	//	This class represents entry log item in Project Report page
	//
	//*********************************************************************

	public class ProjectReportEntryLog
	{
		private decimal		_duration;
		private string		_fullName;
		private DateTime	_maxEntryDate, _minEntryDate;	
		private int			_userID;
		private string		_userName;

		public ProjectReportEntryLog()
		{
			_userName = string.Empty;
			_duration = 0M;
			_userID = 0;
			_minEntryDate = DateTime.MinValue;
			_maxEntryDate = DateTime.MinValue;
			_fullName = string.Empty;
		}

		public decimal Duration 
		{
			get { return _duration; }
			set { _duration = value; }
		}

		public string FullName
		{
			get { return _fullName; }
			set { _fullName = value; }
		}
		
		public int UserID
		{
			get { return _userID; }
			set { _userID = value; }
		}

		public string UserName
		{
			get { return _userName; }
			set { _userName = value; }
		}

		public DateTime MaxEntryDate 
		{
			get { return _maxEntryDate; }
			set { _maxEntryDate = value; }
		}

		public DateTime MinEntryDate 
		{
			get { return _minEntryDate; }
			set { _minEntryDate = value; }
		}

		//*********************************************************************
		//
		//	GetEntrySummary returns summary of each user's time entries based on category
		//
		//*********************************************************************

		public static ProjectReportEntryLogCollection GetEntrySummary(int categoryID)
		{
			DataSet dsData = DatabaseHelper.ExecuteDataset(ConfigurationSettings.AppSettings[Web.Global.CfgKeyConnString], 
				"TT_ListTimeEntriesByCategory", categoryID);
			ProjectReportEntryLogCollection entryList = new ProjectReportEntryLogCollection();

			// Separate Data into a collection of ProjectReportEntryLog.
			foreach(DataRow row in dsData.Tables[0].Rows)
			{
				ProjectReportEntryLog entry = new ProjectReportEntryLog();
				string firstName = string.Empty;
				string lastName = string.Empty;

				entry.UserName = row["UserName"].ToString();
				entry.Duration = Convert.ToDecimal(row["Duration"]);
				entry.UserID = Convert.ToInt32(row["UserID"]);
				entry.MinEntryDate = Convert.ToDateTime(row["MinEntryDate"]);	
				entry.MaxEntryDate = Convert.ToDateTime(row["MaxEntryDate"]);
				entry.FullName = TTUser.GetDisplayName(entry.UserName, ref firstName, ref lastName);

				entryList.Add(entry);
			}

			return entryList;
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Uruguay Uruguay
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions