/// <summary> /// Builds this instance. /// </summary> /// <param name="filename">The filename.</param> /// <param name="staffID">The staff ID.</param> /// <param name="staffNumber">The staff number.</param> public void Build(string filename, StaffID staffID, StaffNumber staffNumber) { List <string> lines = new List <string>(); string month = filename.Split('.')[1]; int year = Timesheet.Year; foreach (int projectNumber in GetAllProjectNumbers()) { WriteProjectHeader(staffID, lines, month, year, projectNumber); foreach (Entry entry in GetAllEntriesFromProject(projectNumber)) { WriteEntry(staffNumber, lines, entry); } } lines.Add("END"); System.IO.StreamWriter file = new System.IO.StreamWriter(filename); foreach (string line in lines) { file.WriteLine(line); } file.Close(); }
/// <summary> /// Commons the constructor. /// </summary> /// <param name="staffID">The staff ID.</param> /// <param name="staffNumber">The staff number.</param> /// <param name="tCheckPath">The t check path.</param> /// <param name="timesheetPath">The timesheet path.</param> /// <param name="submitViaNotes">if set to <c>true</c> [submit via notes].</param> private void CommonConstructor(StaffID staffID, StaffNumber staffNumber, TCheckPath tCheckPath, TimesheetPath timesheetPath, bool submitViaNotes) { this.StaffID = staffID; this.StaffNumber = staffNumber; this.TCheckPath = tCheckPath; this.TimesheetPath = timesheetPath; this.SubmitViaNotes = submitViaNotes; }
/// <summary> /// Writes the entry. /// </summary> /// <param name="staffNumber">The staff number.</param> /// <param name="lines">The lines.</param> /// <param name="entry">The entry.</param> private void WriteEntry(StaffNumber staffNumber, List <string> lines, Entry entry) { string sEntry = string.Empty; if (entry.Billable == "YES") { sEntry += " "; } else { sEntry += "-"; } sEntry += entry.TaskCode; sEntry += Util.AddSpaces(entry.TaskCode, Entry.MAX_TASKCODE_LENGTH); sEntry += entry.PhaseCode; sEntry += Util.AddSpaces(entry.PhaseCode, Entry.MAX_PHASECODE_LENGTH); sEntry += entry.Date.ToString("dd-MMM-yyyy"); sEntry += Util.AddSpaces(entry.Date.ToString("dd-MMM-yyyy"), Entry.MAX_DATE_LENGTH); sEntry += staffNumber.Number; sEntry += Util.AddSpaces(staffNumber.Number.ToString(), Entry.MAX_STAFF_NUMBER_LENGTH); sEntry += entry.Time.ToString("0.0"); sEntry += Util.AddSpaces(entry.Time.ToString("0.0"), Entry.MAX_TIME_LENGTH); if (entry.Overhead == true) { sEntry += "*"; } if (entry.Billable == "ACCOUNTABLE") { sEntry += "#"; } sEntry += " " + entry.Description; lines.Add(sEntry); }
/// <summary> /// Initializes a new instance of the <see cref="Settings" /> class. /// </summary> /// <param name="staffID">The staff ID.</param> /// <param name="staffNumber">The staff number.</param> /// <param name="tCheckPath">The t check path.</param> /// <param name="timesheetPath">The timesheet path.</param> /// <param name="submitViaNotes">if set to <c>true</c> [submit via notes].</param> /// <param name="smtpServer">The SMTP server.</param> /// <param name="port">The port.</param> /// <param name="emailUsername">The email username.</param> /// <param name="enableSSL">if set to <c>true</c> [enable SSL].</param> /// <param name="emailAddress">The email address.</param> /// <param name="password">The password.</param> public Settings(StaffID staffID, StaffNumber staffNumber, TCheckPath tCheckPath, TimesheetPath timesheetPath, bool submitViaNotes, SmtpServer smtpServer, Port port, EmailUsername emailUsername, bool enableSSL, EmailAddress emailAddress, SecureString password) { CommonConstructor(staffID, staffNumber, tCheckPath, timesheetPath, submitViaNotes); NotSubmitViaNotesConstructor(smtpServer, port, emailUsername, enableSSL, emailAddress); this.Password = Password; }
/// <summary> /// Initializes a new instance of the <see cref="Settings" /> class. /// </summary> /// <param name="staffID">The staff ID.</param> /// <param name="staffNumber">The staff number.</param> /// <param name="tCheckPath">The t check path.</param> /// <param name="timesheetPath">The timesheet path.</param> /// <param name="submitViaNotes">if set to <c>true</c> [submit via notes].</param> public Settings(StaffID staffID, StaffNumber staffNumber, TCheckPath tCheckPath, TimesheetPath timesheetPath, bool submitViaNotes) { CommonConstructor(staffID, staffNumber, tCheckPath, timesheetPath, submitViaNotes); NotSubmitViaNotesConstructor(new SmtpServer(), new Port(), new EmailUsername(), false, new EmailAddress()); }
/// <summary> /// Initializes a new instance of the <see cref="Timesheet" /> class. /// </summary> /// <param name="staffNumber">The staff number.</param> /// <param name="staffID">The staff ID.</param> public Timesheet(StaffNumber staffNumber, StaffID staffID) { Entries = new List <Entry>(); this.StaffNumber = staffNumber; this.StaffID = staffID; }
/// <summary> /// Updates the staff details. /// </summary> /// <param name="staffNumber">The staff number.</param> /// <param name="staffID">The staff ID.</param> public void UpdateStaffDetails(StaffNumber staffNumber, StaffID staffID) { this.StaffID = staffID; this.StaffNumber = staffNumber; }