示例#1
0
        /// <summary>
        /// Reads the build.
        /// </summary>
        /// <param name="filename">The filename.</param>
        public void ReadBuild(string filename)
        {
            Parse(filename);
            DateTime date = Timesheet.GetADate();

            Timesheet.UpdateMonthAndYear(date.Month, date.Year);
            UnsavedChanges = false;
        }
示例#2
0
        /// <summary>
        /// Adds the entry.
        /// </summary>
        /// <param name="newEntry">The new entry.</param>
        /// <exception cref="TimesheetProgramLogic.EntriesNotInSameMonthException">blah blah blah</exception>
        /// <exception cref="TimesheetProgramLogic.ProjectCantBeBillableAndAccountableException">blha blha blha</exception>
        /// <exception cref="EntriesNotInSameMonthException">Occurs when all entries aren't in the same month</exception>
        /// <exception cref="ProjectCantBeBillableAndAccountableException">Occurs when the project is both billable and accountable</exception>
        public void AddEntry(Entry newEntry)
        {
            if (Timesheet.Entries.Count == 0)
            {
                Timesheet.Month = newEntry.Date.Month;
                Timesheet.Year  = newEntry.Date.Year;
                Timesheet.UpdateMonthAndYear(newEntry.Date.Month, newEntry.Date.Year);
            }

            VerifyEntry(newEntry, true);

            InsertEntry(newEntry);
            UnsavedChanges = true;
        }
        /// <summary>
        /// Calculates the weekly summary.
        /// </summary>
        /// <param name="timesheet">The timesheet.</param>
        /// <returns>fdgdfgfd dfgdfgfd</returns>
        public static WeeklySummary CalculateWeeklySummary(Timesheet timesheet)
        {
            List <Entry>  entries = timesheet.Entries;
            WeeklySummary summary = new WeeklySummary();

            summary.NumberOfDaysWorkedSoFar = NumberOfDaysWorkedSoFar(entries);
            summary.TotalHoursWorkedSoFar   = TotalHoursWorkedInMonth(entries);
            if (MonthsWith37andAhalfHourWeeks.Contains(timesheet.Month))
            {
                summary.ExpectedHoursPerWeek = 37.5;
            }
            else if (MonthsWith35andAhalfHourWeeks.Contains(timesheet.Month))
            {
                summary.ExpectedHoursPerWeek = 35.5;
            }

            return(summary);
        }
示例#4
0
        /// <summary>
        /// Reads the XML.
        /// </summary>
        /// <param name="filename">The filename.</param>
        public void ReadXML(string filename)
        {
            Timesheet timesheet    = Serialization.DeserializeTimesheet(filename);
            bool      isFirstEntry = true;

            foreach (Entry entry in timesheet.Entries)
            {
                if (isFirstEntry)
                {
                    Timesheet.Month = entry.Date.Month;
                    Timesheet.Year  = entry.Date.Year;
                    New();
                    isFirstEntry = false;
                }

                AddEntry(entry);
            }

            DateTime aDate = Timesheet.GetADate();

            Timesheet.Month = aDate.Month;
            Timesheet.Year  = aDate.Year;
            UnsavedChanges  = false;
        }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LinqTimesheetManager" /> class.
 /// </summary>
 /// <param name="timesheet">The timesheet.</param>
 public LinqTimesheetManager(Timesheet timesheet) : base(timesheet)
 {
 }
示例#6
0
 /// <summary>
 /// News this instance.
 /// </summary>
 public void New()
 {
     Timesheet      = new Timesheet(Timesheet.StaffNumber, Timesheet.StaffID);
     UnsavedChanges = false;
 }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ATimesheetManager" /> class.
 /// </summary>
 /// <param name="timesheet">The timesheet.</param>
 public ATimesheetManager(Timesheet timesheet)
 {
     this.Timesheet = timesheet;
 }