コード例 #1
0
        public string GetQuickbooksTimesheet(DateTime fromDate, DateTime toDate, string username)
        {
            // Get the data
            var timeEntries = _db.GetQuickbooksTimeEntries(fromDate, toDate);

            // Build the file
            var sb = new StringBuilder();

            sb.AppendLine("!TIMEACT	DATE	JOB	EMP	ITEM	DURATION	NOTE	BILLINGSTATUS");
            foreach (var entry in timeEntries)
            {
                // Get the data for the actual user entering in the data
                var userInformation = _db.GetUser(entry.CreatedBy);

                // Just move to the next record, if there isn't a name for export
                if (userInformation.Profile == null)
                {
                    continue;
                }

                // Set the name to use for the export
                var userQuickbooksName = userInformation.Profile.FullName;

                // Add an entry
                sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\r\n",
                                "TIMEACT", entry.DateWorked.ToString("MM/dd/yyyy"), entry.Project.QuickbooksProjectId, userQuickbooksName, "Programming - Standard", entry.TotalTime.ToString(), entry.Description, entry.IsBillable ? "1" : "0");
            }

            return(sb.ToString());
        }
コード例 #2
0
        public string GetQuickbooksTimesheet(DateTime fromDate, DateTime toDate, string username)
        {
            // Get the data
            IList <TimeEntry> timeEntries = _db.GetQuickbooksTimeEntries(fromDate, toDate);

            // Build the file
            var sb = new StringBuilder();

            sb.AppendLine("!TIMEACT	DATE	JOB	EMP	ITEM	DURATION	NOTE	BILLINGSTATUS");
            foreach (var entry in timeEntries)
            {
                sb.AppendFormat("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\r\n",
                                "TIMEACT", entry.DateWorked.ToString("MM/dd/yyyy"), entry.Project.QuickbooksProjectId, "Darren Boss", "Programming - Standard", entry.TotalTime.ToString(), entry.Description, entry.IsBillable ? "1" : "0");
            }

            return(sb.ToString());
        }