Ejemplo n.º 1
0
        /// <summary>
        /// Accepts User Story and calculates daily totals
        /// </summary>
        /// <param name="tasks">Story to calculate</param>
        /// <param name="Action">Indicates whether to total for Estimate, ToDo, or Actuals</param>
        /// <param name="DayforDaily">Date to calculate totals for</param>
        private static decimal TaskTotal(List<Task> tasks, ProjectTotal Action, DateTime DayforDaily)
        {
            decimal decReturn = 0;

            foreach (Task task in tasks)
            {
                if (DayforDaily.ToShortDateString() == task.LastUpdate.ToShortDateString())
                {
                    switch (Action)
                    {
                        case ProjectTotal.Estimate:
                            decReturn = decReturn + task.Estimate;
                            break;
                        case ProjectTotal.ToDo:
                            decReturn = decReturn + task.ToDo;
                            break;
                        case ProjectTotal.Actual:
                            decReturn = decReturn + task.Actual;
                            break;
                        default:
                            break;
                    }

                }
            }

            return decReturn;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Accepts list of all User Stories / Defects and calculates quarter totals
        /// </summary>
        /// <param name="defects">List of Defects to calculate</param>
        /// <param name="Action">Indicates whether to total for Estimate, ToDo, or Actuals</param>
        /// <param name="RptQuarter">Which quarter to generate totals for</param>
        /// <param name="RptYear">Which Year to generate totals for</param>
        private static decimal CreateQuarterTotal(List<Defect> defects, ProjectTotal Action, int RptQuarter, int RptYear)
        {
            decimal decReturn = 0;
            string ReportPeriod = "";
            string StoryRptPeriod = "";

            // Set the string to indicate the Reporting Period
            ReportPeriod = "Q" + RptQuarter + RptYear;

            // Loop through the stories
            foreach (Defect defect in defects)
            {
                // Set the string to indicate the story period
                // Releases are quarterly and of the format--> 2016'Q1 CTO C&I Labs
                if (defect.Release != "")
                {
                    StoryRptPeriod = "Q" + defect.Release.Substring(6, 1) + defect.Release.Substring(0, 4);
                }
                else
                {
                    StoryRptPeriod = "";
                }
                if (ReportPeriod == StoryRptPeriod)
                {
                    foreach (Task task in defect.Tasks)
                    {
                        switch (Action)
                        {
                            case ProjectTotal.Estimate:
                                decReturn = decReturn + task.Estimate;
                                break;
                            case ProjectTotal.ToDo:
                                decReturn = decReturn + task.ToDo;
                                break;
                            case ProjectTotal.Actual:
                                decReturn = decReturn + task.Actual;
                                break;
                            default:
                                break;
                        }
                    }
                }
            }

            return decReturn;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Accepts list of all User Stories / Defects and calculates weekly totals
        /// </summary>
        /// <param name="stories">List of Stories to calculate</param>
        /// <param name="Action">Indicates whether to total for Estimate, ToDo, or Actuals</param>
        /// <param name="DayforWeekly">Date to use for calculating Sunday/Saturday end dates</param>
        private static decimal CreateWeeklyTotal(List<UserStory> stories, ProjectTotal Action, DateTime DayforWeekly)
        {
            decimal decReturn = 0;
            DateTime startDate;
            DateTime endDate;

            // Set the end dates for the Reporting Period.  Should start on Sunday and end on Saturday
            startDate = GetFirstDayOfWeek(DayforWeekly, CultureInfo.CurrentCulture);
            endDate = startDate.AddDays(6);

            // Loop through the stories
            foreach (UserStory story in stories)
            {
                foreach (Task task in story.Tasks)
                {
                    if ((task.LastUpdate >= startDate) && (task.LastUpdate <= endDate))
                    {
                        switch (Action)
                        {
                            case ProjectTotal.Estimate:
                                decReturn = decReturn + task.Estimate;
                                break;
                            case ProjectTotal.ToDo:
                                decReturn = decReturn + task.ToDo;
                                break;
                            case ProjectTotal.Actual:
                                decReturn = decReturn + task.Actual;
                                break;
                            default:
                                break;
                        }
                    }
                }

            }

            return decReturn;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Accepts list of all User Stories / Defects and calculates weekly totals
        /// </summary>
        /// <param name="stories">List of Stories to calculate</param>
        /// <param name="Action">Indicates whether to total for Estimate, ToDo, or Actuals</param>
        /// <param name="YearForAnnual">Which Year to generate totals for</param>
        private static decimal CreateAnnualTotal(List<UserStory> stories, ProjectTotal Action, int YearForAnnual)
        {
            decimal decReturn = 0;
            DateTime startDate;
            DateTime endDate;

            // Set the end dates for the Reporting Period.  Should start on Sunday and end on Saturday
            startDate = new DateTime(YearForAnnual, 1, 1);
            endDate = new DateTime(YearForAnnual, 12, 31);

            // Loop through the stories
            foreach (UserStory story in stories)
            {
                foreach (Task task in story.Tasks)
                {
                    if ((task.LastUpdate >= startDate) && (task.LastUpdate <= endDate))
                    {
                        switch (Action)
                        {
                            case ProjectTotal.Estimate:
                                decReturn = decReturn + task.Estimate;
                                break;
                            case ProjectTotal.ToDo:
                                decReturn = decReturn + task.ToDo;
                                break;
                            case ProjectTotal.Actual:
                                decReturn = decReturn + task.Actual;
                                break;
                            default:
                                break;
                        }
                    }
                }

            }

            return decReturn;
        }