Example #1
0
        /// <summary>
        /// OBSOLETE
        /// </summary>
        /// <param name="ms"></param>
        /// <param name="startDate"></param>
        public static void GetBurnDownData(this RMilestoneStatus ms, DateTime startDate)
        {
            var rep = new ReleaseRepository();
            var result = rep.GetArtefactsProgress(ms.Release.Id);

            // determine amount days till milestone
            var period = new Period { StartDate = startDate, EndDate = ms.Date };
            var workingDays = period.AmountWorkingDays;

            // get progress data for milestone
            var count = 0;
            var totalProgress = result.Where(x => ms.Id == x.MilestoneId).Select(x => new { HoursRemaining = x.HoursRemaining, StatusDate = x.StatusDate, DayNumber = count++ }).ToList().OrderBy(x => x.StatusDate);

            // determine slope of known status data
            var amountDays = totalProgress.Count();
            var avgDays = totalProgress.Select(x => x.DayNumber).Average();
            var avgHours = totalProgress.Select(x => x.HoursRemaining).Average();
            var deviations = totalProgress.Select(x => new { xDeviation = x.DayNumber - avgDays, yDeviation = x.HoursRemaining - avgHours, xDevTimesyDev = (x.DayNumber - avgDays) * (x.HoursRemaining - avgHours), xDevSquare = (x.DayNumber - avgDays) * (x.DayNumber - avgDays) }).ToList();
            // divide SUM( (x - avgX) * (y - avgY) ) by SUM( (x - avgX) * (x - avgX) )
            var slope = deviations.Select(x => x.xDevTimesyDev).Sum() / deviations.Select(x => x.xDevSquare).Sum();

            // determine intercept: avgY = (slope * avgX) + intercept -> intercept = -((slope * avgX) - avgY)
            var intercept = -((slope * avgDays) - avgHours);

            // formula best fitted line: amtHours = slope * amtDays + intercept
        }
Example #2
0
        /// <summary>
        /// Update start and end date
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static Phase Reschedule(this RPeriodSchedule evt, DateTime startDate, DateTime endDate)
        {
            var conn = new SqlConnection("Data Source=localhost\\SQLENTERPRISE;Initial Catalog=Planner;Integrated Security=SSPI;MultipleActiveResultSets=true");
            try
            {
                using (conn)
                {
                    conn.Open();

                    var cmd = new SqlCommand("sp_update_phase_dates", conn);
                    cmd.Parameters.Add("@Id", System.Data.SqlDbType.Int).Value = evt.Id;
                    cmd.Parameters.Add("@StartDate", System.Data.SqlDbType.DateTime).Value = startDate;
                    cmd.Parameters.Add("@EndDate", System.Data.SqlDbType.DateTime).Value = endDate;
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;

                    cmd.ExecuteNonQuery();

                    var rep = new ReleaseRepository();
                    var phase = rep.GetRelease(evt.Id);

                    return phase;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #3
0
 /// <summary>
 /// Load Release configuration
 /// </summary>
 /// <param name="str"></param>
 /// <returns></returns>
 public static void LoadPhasesAndMilestonesAndProjects(this RReleasePlanning release)
 {
     var rep = new ReleaseRepository();
     var rel =  rep.GetReleaseSummary(release.Id);
     release.Milestones.AddRange(rel.Milestones);
     release.Phases.AddRange(rel.Phases);
     release.Projects.AddRange(rel.Projects);
 }
Example #4
0
 public JsonResult Delete(int id)
 {
     var rep = new ReleaseRepository();
     var result = rep.Delete(id);
     if (result)
         return this.Json(string.Format("Release with Id {0} succesfully deleted", id), JsonRequestBehavior.AllowGet);
     else
         Response.StatusCode = (int)HttpStatusCode.InternalServerError;
         return this.Json(string.Format("Release with Id {0} not deleted", id), JsonRequestBehavior.AllowGet);
 }
Example #5
0
        /// <summary>
        /// Plan the event in a release
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static void UpdateStatusForMilestone(this RDeliverableStatus del, RMilestoneStatus ms)
        {
            var obj = new DeliverableStatusInputModel
            {
                DeliverableId = del.Id,
                MilestoneId = ms.Id,
                ReleaseId = ms.Release.Id,
                Scope = del.Scope.Select( (project) => new ProjectStatusInputModel { Id = project.Id, Workload = project.Workload.Select( (deliv) => new ActivityStatusInputModel { Activity = deliv.Activity, HoursRemaining = deliv.HoursRemaining } ).ToList() }).ToList()
            };

            var rep = new ReleaseRepository();
            rep.SaveDeliverableStatus(obj);
        }
Example #6
0
 public JsonResult UnassignMilestone(MilestoneInputModel obj)
 {
     var rep = new ReleaseRepository();
     var release = rep.UnAssignMilestone(obj);
     return this.Json(release, JsonRequestBehavior.AllowGet);
 }
Example #7
0
        public JsonResult SchedulePhase(ScheduleReleasePhaseInputModel obj)
        {
            var uc = new ReschedulePeriod(new Phase { Id = obj.EventId }, obj.StartDate.ToDateTimeFromDutchString(), obj.EndDate.ToDateTimeFromDutchString());
            uc.Execute();

            var rep = new ReleaseRepository();
            var release = rep.GetReleaseSummary(obj.ReleaseId);
            return this.Json(release, JsonRequestBehavior.AllowGet);
        }
Example #8
0
        public JsonResult ScheduleMilestone(ScheduleReleaseEventInputModel obj)
        {
            var uc = new PlanMilestone(new Milestone { Id = obj.EventId }, obj.Date.ToDateTimeFromDutchString(), obj.Time);
            uc.Execute();

            var rep = new ReleaseRepository();
            var release = rep.GetReleaseSummary(obj.ReleaseId);
            return this.Json(release, JsonRequestBehavior.AllowGet);
        }
Example #9
0
 public JsonResult SaveReleaseConfiguration(ReleaseConfigurationInputModel obj)
 {
     var rep = new ReleaseRepository();
     var rel = rep.SaveReleaseConfiguration(obj);
     return this.Json(rel, JsonRequestBehavior.AllowGet);
 }
Example #10
0
        public JsonResult SaveMilestone(MilestoneInputModel obj)
        {
            var rep = new ReleaseRepository();
            var resultRelease = rep.SaveMilestone(obj);

            var result = this.Json(resultRelease, JsonRequestBehavior.AllowGet);
            return result;
        }
Example #11
0
 public JsonResult GetReleaseSummaryById(int id)
 {
     var rep = new ReleaseRepository();
     var release = rep.GetReleaseSummary(id);
     return this.Json(release, JsonRequestBehavior.AllowGet);
 }
Example #12
0
        public ContentResult GetReleaseSummaries()
        {
            var rep = new ReleaseRepository();
            var releases = rep.GetReleaseSummaries();

            var serializer = new JavaScriptSerializer();

            // For simplicity just use Int32's max value.
            // You could always read the value from the config section mentioned above.
            serializer.MaxJsonLength = Int32.MaxValue;

            var result = new ContentResult
            {
                Content = serializer.Serialize(releases),
                ContentType = "application/json",
            };
            return result;

            //return this.Json(releases, JsonRequestBehavior.AllowGet);
        }
Example #13
0
 public JsonResult GetReleaseSnapshotsWithProgressStatus()
 {
     var rep = new ReleaseRepository();
     var result = rep.GetReleaseSnapshotsWithProgressData();
     return this.Json(result, JsonRequestBehavior.AllowGet);
 }
Example #14
0
        public JsonResult GetReleaseProgress(int phaseid, int milestoneId)
        {
            // get complete progress data per artefact
            var rep = new ReleaseRepository();
            var progress = rep.GetArtefactsProgress(phaseid, milestoneId);

            // get burndown for total
            var msRep = new MilestoneRepository();
            var ms = msRep.GetItemById(milestoneId);

            try
            {
                // TODO: determine startdate by using the Phase startdate to which the Milestone is connected
                var uc = new GetBurndownData(new Milestone { Id = milestoneId, Date = ms.Date, Release = new Release { Id = phaseid } }, DateTime.Now.AddDays(-40));
                var burndown = uc.Execute();

                return this.Json(new { Progress = progress, Burndown = burndown }, JsonRequestBehavior.AllowGet);
            }
            catch (ConditionNotMetException ex)
            {
                HttpContext.Response.StatusDescription = string.Format("A condition has not been met: {0}", ex.Message);
                HttpContext.Response.StatusCode = 400;
                return this.Json(string.Format("A condition has not been met: {0}", ex.Message), JsonRequestBehavior.AllowGet);
            }
            catch (ProcessException ex)
            {
                HttpContext.Response.StatusDescription = string.Format("A use case processing exception has occurred: {0}", ex.Message);
                HttpContext.Response.StatusCode = 400;
                return this.Json(string.Format("A use case processing exception has occurred: {0}", ex.Message), JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                HttpContext.Response.StatusDescription = string.Format("An exception has occurred: {0}", ex.Message);
                HttpContext.Response.StatusCode = 500;
                return this.Json(string.Format("An exception has occurred: {0}", ex.Message), JsonRequestBehavior.AllowGet);
            }
        }
Example #15
0
 /// <summary>
 /// Create status records for Milestone Deliverables. Used in Release Planning Overview for status as well as planning overview
 /// </summary>
 /// <param name="release"></param>
 public static void GenerateMilestoneStatusRecords(this RReleasePlanning release)
 {
     var rep = new ReleaseRepository();
     rep.GenerateStatusRecords(release);
 }
Example #16
0
        private static IEnumerable<XYPoint> GetWorkloadHistoryPerDayAndArtefact(this RMilestoneStatus ms, DateTime startDate, int artefactId)
        {
            var rep = new ReleaseRepository();
            var result = rep.GetArtefactsProgress(ms.Release.Id);

            // determine amount days till milestone
            var period = new Period { StartDate = startDate, EndDate = ms.Date };

            return result
                .Where(x => ms.Id == x.MilestoneId && x.ArtefactId == artefactId && period.ListWorkingDays[x.StatusDate.ToDutchString()] != null) // get items for specified milestone with statusdate within specified period
                .GroupBy(m => m.StatusDate.ToDutchString(), coll => coll.HoursRemaining, (key, values) => new { HoursRemaining = values.Sum(), Date = key }) // group by statusdate, elementselector (every statusdate-key returns enumerable of remaining hours), return new type
                .Select(aProgress => new XYPoint { Y = aProgress.HoursRemaining, X = period.ListWorkingDays[aProgress.Date].Number });
        }