Esempio n. 1
0
        /// <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;
 }
Esempio n. 3
0
 /// <summary>
 /// Writes the project header.
 /// </summary>
 /// <param name="staffID">The staff ID.</param>
 /// <param name="lines">The lines.</param>
 /// <param name="month">The month.</param>
 /// <param name="year">The year.</param>
 /// <param name="projectNumber">The project number.</param>
 private void WriteProjectHeader(StaffID staffID, List <string> lines, string month, int year, int projectNumber)
 {
     lines.Add("************************************************************************");
     lines.Add("*                                                                      *");
     lines.Add("* P" + projectNumber.ToString("0000") + " - " + month + "                                                          *");
     lines.Add("* Timesheet for " + staffID.ID + ", " + month + " " + year + "                                           *");
     lines.Add("* Generated by WALDMs Timesheet Program                                *");
     lines.Add("*                                                                      *");
     lines.Add("*                                                                      *");
     lines.Add("************************************************************************");
     lines.Add("*TASK     PHASE    DATE     PER HRS              DESCRIPTION            ");
     lines.Add("*-------- -------- -------- --- ---- -----------------------------------");
     lines.Add("P" + projectNumber.ToString("0000"));
 }
 /// <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;
 }