    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 = SqlHelper.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;
            }
        }
    }