Beispiel #1
0
 public UnAssignResource(RHumanResource resource, Release release, Project project, Milestone milestone, Deliverable deliverable, Activity activity, Period period)
 {
     _resource = resource;
     _release = release;
     _milestone = milestone;
     _deliverable = deliverable;
     _activity = activity;
     _period = period;
     _project = project;
 }
Beispiel #2
0
 public PlanReleaseResource(RHumanResource resource, Release release, Project project, Milestone milestone, Deliverable deliverable, Activity activity, Period period, double focusFactor)
 {
     _resource = resource;
     _release = release;
     _milestone = milestone;
     _deliverable = deliverable;
     _activity = activity;
     _focusFactor = focusFactor;
     _period = period;
     _project = project;
 }
Beispiel #3
0
 /// <summary>
 /// UnAssign the resource from the specified deliverable activity
 /// </summary>
 /// <param name="str"></param>
 /// <returns></returns>
 public static void UnAssignFromRelease(this RHumanResource person, Release release, Project project, Milestone milestone, Deliverable deliverable, Activity activity, Period assignedPeriod)
 {
     var rep = new ResourceRepository();
     try
     {
         rep.DeleteReleaseAssignment(release.Id, project.Id, person.Id, milestone.Id, deliverable.Id, activity.Id, assignedPeriod.StartDate, assignedPeriod.EndDate);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Beispiel #4
0
 public Release AddProjects(Release release, SqlConnection conn)
 {
     var projs = new SqlCommand(string.Format("Select rp.ProjectId, p.Title, p.ShortName from ReleaseProjects rp inner join Projects p on rp.ProjectId = p.Id where PhaseId = {0}", release.Id), conn);
     using (var reader3 = projs.ExecuteReader())
     {
         while (reader3.Read())
         {
             var p = new Project { Id = int.Parse(reader3["ProjectId"].ToString()), Title = reader3["Title"].ToString(), ShortName = reader3["ShortName"].ToString() };
             release.Projects.Add(p);
         }
     }
     return release;
 }
Beispiel #5
0
 /// <summary>
 /// Plan the resource for an assignment
 /// </summary>
 /// <param name="str"></param>
 /// <returns></returns>
 public static void PlanForRelease(this RHumanResource person, RReleasePlanning release, Project project, Milestone milestone, Deliverable deliverable, Activity activity, Period assignedPeriod, double focusFactor)
 {
     var rep = new ResourceRepository();
     try
     {
         rep.SaveReleaseAssignment(release.Id, project.Id, person.Id, milestone.Id, deliverable.Id, activity.Id, assignedPeriod.StartDate, assignedPeriod.EndDate, focusFactor);
         // make sure we have status records for all release, project, milestone and deliverable combinations
         if (release.Milestones.Count == 0)
             release.LoadPhasesAndMilestonesAndProjects();
         release.GenerateMilestoneStatusRecords();
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Beispiel #6
0
        public JsonResult GetProjects()
        {
            var conn = new SqlConnection("Data Source=localhost\\SQLENTERPRISE;Initial Catalog=Planner;Integrated Security=SSPI;MultipleActiveResultSets=true");
            var projects = new List<Project>();

            using (conn)
            {
                conn.Open();

                // Release
                var cmd = new SqlCommand("Select * from Projects", conn);
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var p = new Project { Id = int.Parse(reader["Id"].ToString()), Title = reader["Title"].ToString(), Description = reader["Description"].ToString(), ShortName = reader["ShortName"].ToString() };
                        projects.Add(p);
                    }
                }
            }
            return this.Json(projects, JsonRequestBehavior.AllowGet);
        }
Beispiel #7
0
        public List<Project> GetConfiguredProjectsForRelease(int releaseId)
        {
            var conn = new SqlConnection(this.ConnectionString);

            var cmd = new SqlCommand("sp_get_release_projects", conn);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.Add("@ReleaseId", System.Data.SqlDbType.Int).Value = releaseId;
            var lst = new List<Project>();

            using (conn)
            {
                conn.Open();
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var p = new Project { Id = int.Parse(reader["Id"].ToString()), Title = reader["Title"].ToString(), Description = reader["Description"].ToString(), ShortName = reader["ShortName"].ToString() };
                        lst.Add(p);
                    }
                }
            }
            return lst;
        }
Beispiel #8
0
        public JsonResult SaveDeliverableStatus(DeliverableStatusInputModel obj)
        {
            //var rep = new ReleaseRepository();
            //rep.SaveDeliverableStatus(obj);
            var del = new Deliverable { Id = obj.DeliverableId };
            foreach(var proj in obj.Scope)
            {
                var project = new Project { Id = proj.Id };
                foreach (var act in proj.Workload)
                {
                    project.Workload.Add(new ActivityStatus { Activity = act.Activity, HoursRemaining = act.HoursRemaining });
                }
                del.Scope.Add(project);
            }
            var ms = new Milestone { Id = obj.MilestoneId, Release = new Release { Id = obj.ReleaseId } };

            var uc = new UpdateMilestoneDeliverableStatus(del, ms);
            uc.Execute();

            var result = this.Json("Saved", JsonRequestBehavior.AllowGet);
            return result;
        }
Beispiel #9
0
        public Release GetRelease(int id)
        {
            // add MultipleActiveResultSets=true to enable nested datareaders
            var conn = new SqlConnection("Data Source=localhost\\SQLENTERPRISE;Initial Catalog=Planner;Integrated Security=SSPI;MultipleActiveResultSets=true");
            Release release = null;

            using (conn)
            {
                conn.Open();

                // Release
                var cmd = new SqlCommand(string.Format("Select * from Phases where Id = {0}", id), conn);
                using (var reader = cmd.ExecuteReader())
                {
                    if (reader.Read())
                        release = new Release { Id = int.Parse(reader["Id"].ToString()), EndDate = DateTime.Parse(reader["EndDate"].ToString()), StartDate = DateTime.Parse(reader["StartDate"].ToString()), Title = reader["Title"].ToString(), Description = reader["Description"].ToString() };
                }

                // Child phases
                var cmd2 = new SqlCommand(string.Format("Select * from Phases where ParentId = {0}", id), conn);
                using (var reader = cmd2.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        release.Phases.Add(new Phase { Id = int.Parse(reader["Id"].ToString()), EndDate = DateTime.Parse(reader["EndDate"].ToString()), StartDate = DateTime.Parse(reader["StartDate"].ToString()), Title = reader["Title"].ToString(), Description = reader["Description"].ToString() });
                    }
                }

                // Projects
                using (var cmdProjects = new SqlCommand(string.Format("SELECT rp.id, rp.PhaseId as ReleaseId, rp.ProjectId, p.Title, p.[Description], p.TfsIterationPath, p.TfsDevBranch, p.ShortName FROM ReleaseProjects rp INNER JOIN Projects p on rp.ProjectId = p.Id WHERE rp.PhaseId = {0}", id), conn))
                {
                    using (var projectsReader = cmdProjects.ExecuteReader())
                    {
                        while (projectsReader.Read())
                        {
                            var project = new Project { ShortName = projectsReader["ShortName"].ToString(), Id = int.Parse(projectsReader["ProjectId"].ToString()) };

                            // Backlog
                            //var cmd3 = new SqlCommand(string.Format("Select i.BusinessId, i.ContactPerson, i.WorkRemaining, i.Title, i.State, p.Id AS ProjectId, p.ShortName as ProjectShortName from TfsImport i INNER JOIN Phases r ON i.IterationPath LIKE r.TfsIterationPath + '%' INNER JOIN Projects p on i.IterationPath LIKE p.TfsIterationPath + '%' WHERE r.Id = {0}", id), conn);
                            //using (var featuresReader = cmd3.ExecuteReader())
                            //{
                            //    while (featuresReader.Read())
                            //    {
                            //        var feature = new ReleaseModels.Feature { BusinessId = featuresReader["BusinessId"].ToString(), ContactPerson = featuresReader["ContactPerson"].ToString(), RemainingHours = int.Parse(featuresReader["WorkRemaining"].ToString()), Title = featuresReader["Title"].ToString(), Status = featuresReader["State"].ToString() };
                            //        project.Backlog.Add(feature);
                            //    }
                            //}

                            //// Assigned Resources
                            //var cmdReleaseResources = new SqlCommand(String.Format("Select rr.*, p.Initials, p.HoursPerWeek from ReleaseResources rr INNER JOIN Persons p on rr.PersonId = p.Id where rr.ReleaseId = {0} and rr.ProjectId = {1}", id, project.Id), conn);
                            //using (var releaseResourcesReader = cmdReleaseResources.ExecuteReader())
                            //{
                            //    while (releaseResourcesReader.Read())
                            //    {
                            //        var assignment = new ReleaseModels.ResourceAssignment { EndDate = DateTime.Parse(releaseResourcesReader["EndDate"].ToString()), StartDate = DateTime.Parse(releaseResourcesReader["StartDate"].ToString()), FocusFactor = double.Parse(releaseResourcesReader["FocusFactor"].ToString()), Resource = new ReleaseModels.Resource { AvailableHoursPerWeek = int.Parse(releaseResourcesReader["HoursPerWeek"].ToString()), Initials = releaseResourcesReader["Initials"].ToString() } };
                            //        // get absences
                            //        var cmdAbsences = new SqlCommand(String.Format("Select * from Absences where PersonId = {0}", releaseResourcesReader["PersonId"].ToString()), conn);
                            //        using (var absencesReader = cmdAbsences.ExecuteReader())
                            //        {
                            //            while (absencesReader.Read())
                            //            {
                            //                assignment.Resource.PeriodsAway.Add(new ReleaseModels.Phase { Id = int.Parse(absencesReader["Id"].ToString()), EndDate = DateTime.Parse(absencesReader["EndDate"].ToString()), StartDate = DateTime.Parse(absencesReader["StartDate"].ToString()), Title = absencesReader["Title"].ToString() });
                            //            }
                            //        }
                            //        project.AssignedResources.Add(assignment);
                            //    }
                            //}

                            release.Projects.Add(project);
                        }
                    }
                }
            }

            conn.Close();
            return release;
        }
Beispiel #10
0
        public Project GetProject(int id)
        {
            // add MultipleActiveResultSets=true to enable nested datareaders
            var conn = new SqlConnection(this.ConnectionString);
            Project p = null;

            using (conn)
            {
                conn.Open();

                // Release
                var cmd = new SqlCommand(string.Format("Select * from Projects where Id = {0}", id), conn);
                using (var reader = cmd.ExecuteReader())
                {
                    reader.Read();
                    p = new Project { Id = int.Parse(reader["Id"].ToString()), Title = reader["Title"].ToString(), Description = reader["Description"].ToString(), ShortName = reader["ShortName"].ToString() };
                }

                // Backlog
                /*var cmd3 = new SqlCommand(string.Format("Select i.BusinessId, i.ContactPerson, i.WorkRemaining, i.Title, i.State, p.Id AS ProjectId from TfsImport i INNER JOIN Phases r ON i.IterationPath LIKE r.TfsIterationPath + '%' INNER JOIN Projects p on i.IterationPath LIKE p.TfsIterationPath + '%' WHERE r.Id = {0}", id), conn);
                using (var reader = cmd3.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var feature = new ReleaseModels.Feature { BusinessId = reader["BusinessId"].ToString(), ContactPerson = reader["ContactPerson"].ToString(), RemainingHours = int.Parse(reader["WorkRemaining"].ToString()), Title = reader["Title"].ToString(), Status = reader["State"].ToString() };

                        // find Project for Feature
                        ReleaseModels.Project project;
                        var cmd4 = new SqlCommand(String.Format("Select * from Projects where Id = {0}", reader["ProjectId"].ToString()), conn);
                        using (var reader2 = cmd4.ExecuteReader())
                        {
                            reader2.Read();
                            project = new ReleaseModels.Project { ShortName = reader2["ShortName"].ToString() };

                            // Resources
                            var team = new ReleaseModels.Team();
                            var cmd5 = new SqlCommand(String.Format("Select * from ReleaseResources where ReleaseId = {0} and ProjectId = {1}", id, reader["ProjectId"].ToString()), conn);
                            using (var reader3 = cmd5.ExecuteReader())
                            {
                                while (reader3.Read())
                                {
                                    var cmd6 = new SqlCommand(String.Format("Select * from Persons where Id = {0}", reader3["PersonId"].ToString()), conn);

                                    using (var reader4 = cmd6.ExecuteReader())
                                    {
                                        reader4.Read();
                                        // reader3 is used for FocusFactor since this is stored in ReleaseResources, the rest is from Persons
                                        var teamMember = new ReleaseModels.TeamMember { Initials = reader4["Initials"].ToString(), FocusFactor = double.Parse(reader3["FocusFactor"].ToString()), AvailableHoursPerWeek = int.Parse(reader4["HoursPerWeek"].ToString()) };

                                        var cmd7 = new SqlCommand(String.Format("Select * from Absences where PersonId = {0}", reader3["PersonId"].ToString()), conn);
                                        using (var reader5 = cmd7.ExecuteReader())
                                        {
                                            while (reader5.Read())
                                            {
                                                teamMember.PeriodsAway.Add(new ReleaseModels.Phase { Id = int.Parse(reader5["Id"].ToString()), EndDate = DateTime.Parse(reader5["EndDate"].ToString()), StartDate = DateTime.Parse(reader5["StartDate"].ToString()), Title = reader5["Title"].ToString() });
                                            }
                                        }
                                        team.TeamMembers.Add(teamMember);
                                    }
                                }
                            }
                            project.ProjectTeam = team;
                        }

                        feature.Project = project;
                        release.Backlog.Add(feature);
                    }
                }
                */
                conn.Close();
                return p;
            }
        }