Exemplo n.º 1
0
 public static Sprint GetSprintById(ScrumTimeEntities scrumTimeEntities, int id)
 {
     Sprint sprint = null;
     var results = from t in scrumTimeEntities.Sprints
                   where t.SprintId == id
                   select t;
     if (results.Count() > 0)
         sprint = results.First<Sprint>();
     else
         sprint = new Sprint();
     return sprint;
 }
 private decimal CalculateHoursForSprint(Sprint sprint)
 {
     decimal hours = 0;
     if (sprint != null && sprint.Stories != null && sprint.Stories.Count() > 0)
     {
         foreach (Story story in sprint.Stories)
         {
             if (story.Tasks != null && story.Tasks.Count() > 0)
                 hours += (story.Tasks.Sum(t => t.Hours) != null) ?
                     (decimal)story.Tasks.Sum(t => t.Hours) : 0;
         }
     }
     CheckSetYAxisMax(hours);
     return hours;
 }
Exemplo n.º 3
0
 public virtual ActionResult Edit(int id)
 {
     List<Sprint> allSprints = SprintService.GetAllSprints(_ScrumTimeEntities,
         SessionHelper.GetCurrentProductId(User.Identity.Name, Session));
     Sprint noneSprint = new Sprint()
     {
         Name = "None",
         SprintId = -1
     };
     allSprints.Insert(0, noneSprint);
     Story story = _StoryService.GetStoryById(id);
     StoryViewModel storyViewModel = new StoryViewModel()
     {
         StoryModel = story,
         AllSprints = allSprints
     };
     return PartialView(storyViewModel);
 }
Exemplo n.º 4
0
        // [['08/03/2010', 51, '08/03/2010'], ['08/05/2010', 0, '08/05/2010']]
        private List<object> CreateIdealScrumTaskJsonList(Sprint sprint)
        {
            ScrumTimeEntities scrumTimeEntities = new ScrumTimeEntities();
            SprintService sprintService = new SprintService(scrumTimeEntities);

            List<object> idealScrumTaskJsonList = new List<object>();
            List<object> scrumDetailList1 = new List<object>();
            List<object> scrumDetailList2 = new List<object>();
            if (sprint != null)
            {
                scrumDetailList1.Add(sprint.StartDate.ToString("MM/dd/yyyy"));
                scrumDetailList1.Add(sprintService.GetTotalHourCount(sprint.SprintId));
                scrumDetailList1.Add(sprint.StartDate.ToString("MM/dd/yyyy"));
                idealScrumTaskJsonList.Add(scrumDetailList1);

                scrumDetailList2.Add(sprint.FinishDate.ToString("MM/dd/yyyy"));
                scrumDetailList2.Add(0);
                scrumDetailList2.Add(sprint.FinishDate.ToString("MM/dd/yyyy"));
                idealScrumTaskJsonList.Add(scrumDetailList2);
            }
            return idealScrumTaskJsonList;
        }
Exemplo n.º 5
0
        public virtual ActionResult Save(FormCollection collection)
        {
            try
            {
                string id = collection.Get("sprintId");
                string productId = collection.Get("productId");
                bool newSprint = false;
                if (id == null || id == "0")
                {
                    id = "0";
                    newSprint = true;
                }
                string name = collection.Get("name");
                string description = collection.Get("description");
                string start = collection.Get("start");
                string finish = collection.Get("finish");
                // TODO:  Validate the sprint data before saving
                // TODO:  Set the correct product id
                Sprint sprint = new Sprint()
                {
                    SprintId = Int32.Parse(id),
                    ProductId = Int32.Parse(productId),
                    Name = name,
                    Description = description,
                    StartDate = DateTime.Parse(start),
                    FinishDate = DateTime.Parse(finish)
                };
                _SprintService.SaveSprint(sprint);

                if (newSprint)
                    return RedirectToAction(Actions.ListByStartDateDesc(Int32.Parse(productId)));
                else
                    return RedirectToAction(Actions.ReadOnly(Int32.Parse(id)));
            }
            catch (Exception ex)
            {
                return View();  // TODO:  Handle displaying the exception condition
            }
        }
Exemplo n.º 6
0
 public virtual ActionResult New(int productId)
 {
     // TODO: May want to lookup the product id to ensure that it is valid
     Sprint sprint = new Sprint()
     {
         ProductId = productId,
         Name = "---",
         StartDate = DateTime.Today,
         FinishDate = DateTime.Today.AddDays(30)
     };
     return PartialView(Views.Edit, sprint);
 }
Exemplo n.º 7
0
        public Sprint SaveSprint(Sprint sprint)
        {
            if (sprint != null)
            {
                if (sprint.SprintId == 0)  // this is new
                {
                    _ScrumTimeEntities.AddToSprints(sprint);
                }
                else  // the sprint exists
                {
                    _ScrumTimeEntities.AttachTo("Sprints", sprint);

                    ScrumTimeEntities freshScrumTimeEntities =
                        new ScrumTimeEntities(_ScrumTimeEntities.Connection.ConnectionString);
                    Sprint existingSprint = GetSprintById(freshScrumTimeEntities, sprint.SprintId);
                    if (existingSprint == null)
                    {
                        throw new Exception("The sprint no longer exists.");
                    }
                    _ScrumTimeEntities.ObjectStateManager.ChangeObjectState(sprint, System.Data.EntityState.Modified);
                }
                _ScrumTimeEntities.SaveChanges();
            }
            return sprint;
        }
Exemplo n.º 8
0
        // [['08/03/2010', 1, '08/03/2010'], ['09/15/2010', 1, '09/15/2010']]
        private List<object> CreateSprintJsonList(int sprintIndex, Sprint sprint,
            DateTime startDateRange, DateTime endDateRange)
        {
            List<object> sprintJsonList = new List<object>();
            DateTime startDate = sprint.StartDate;
            List<object> sprintStartDetailsList = new List<object>();
            sprintStartDetailsList.Add(startDate.ToString("MM/dd/yyyy"));
            sprintStartDetailsList.Add(sprintIndex);
            sprintStartDetailsList.Add(startDate.ToString("MM/dd/yyyy"));
            sprintJsonList.Add(sprintStartDetailsList);

            DateTime finishDate = sprint.FinishDate;
            List<object> sprintFinishDetailsList = new List<object>();
            sprintFinishDetailsList.Add(finishDate.ToString("MM/dd/yyyy"));
            sprintFinishDetailsList.Add(sprintIndex);
            sprintFinishDetailsList.Add(finishDate.ToString("MM/dd/yyyy"));
            sprintJsonList.Add(sprintFinishDetailsList);

            return sprintJsonList;
        }
Exemplo n.º 9
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Sprints EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSprints(Sprint sprint)
 {
     base.AddObject("Sprints", sprint);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Create a new Sprint object.
 /// </summary>
 /// <param name="sprintId">Initial value of the SprintId property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="startDate">Initial value of the StartDate property.</param>
 /// <param name="finishDate">Initial value of the FinishDate property.</param>
 /// <param name="productId">Initial value of the ProductId property.</param>
 public static Sprint CreateSprint(global::System.Int32 sprintId, global::System.String name, global::System.DateTime startDate, global::System.DateTime finishDate, global::System.Int32 productId)
 {
     Sprint sprint = new Sprint();
     sprint.SprintId = sprintId;
     sprint.Name = name;
     sprint.StartDate = startDate;
     sprint.FinishDate = finishDate;
     sprint.ProductId = productId;
     return sprint;
 }
Exemplo n.º 11
0
 public virtual ActionResult New()
 {
     List<Sprint> allSprints = SprintService.GetAllSprints(_ScrumTimeEntities,
         SessionHelper.GetCurrentProductId(User.Identity.Name, Session));
     Sprint noneSprint = new Sprint()
     {
         Name = "None",
         SprintId = -1
     };
     allSprints.Insert(0, noneSprint);
     int currentProductId = SessionHelper.GetCurrentProductId(User.Identity.Name, Session);
     Product product = _ScrumTimeEntities.Products.First<Product>(p => p.ProductId == currentProductId);
     StoryViewModel storyViewModel = new StoryViewModel()
     {
         StoryModel = new Story()
         {
             StoryId = 0,
             Narrative = "As a ...",
             Points = 0,
             Priority = 0,
             UserDefinedId = (product.Stories.Count() + 1).ToString()
         },
         AllSprints = allSprints
     };
     return PartialView(Views.Edit, storyViewModel);
 }
Exemplo n.º 12
0
 protected Scrum GetMostRecentScrum(Sprint sprint)
 {
     Scrum mostRecentScrum = null;
     DateTime maxScrumDate = DateTime.MinValue;
     if (sprint.Scrums != null && sprint.Scrums.Count() > 0)
         maxScrumDate = sprint.Scrums.Max(s => s.DateOfScrum);
     if (maxScrumDate.CompareTo(DateTime.MinValue) > 0)
         mostRecentScrum = GetScrumByDateOfScrumAndSprintId(_ScrumTimeEntities, maxScrumDate, sprint.SprintId);
     return mostRecentScrum;
 }
Exemplo n.º 13
0
 protected ScrumDetail BuildScrumDetail(Sprint sprint, Task task)
 {
     Scrum mostRecentScrum = GetMostRecentScrum(sprint);
     ScrumDetail mostRecentScrumDetail = null;
     if (mostRecentScrum != null && mostRecentScrum.ScrumDetails.Count() > 0)
     {
         var results = from s in mostRecentScrum.ScrumDetails
                       where s.TaskId == task.TaskId
                       select s;
         if (results.Count() > 0)
             mostRecentScrumDetail = results.First();
     }
     ScrumDetail scrumDetail = new ScrumDetail()
     {
         AssignedTo = (mostRecentScrumDetail != null) ? mostRecentScrumDetail.AssignedTo : AccountMembershipService.UNASSIGNED,
         HoursCompleted = (mostRecentScrumDetail != null) ? mostRecentScrumDetail.HoursCompleted : 0,
         HoursRemaining = (mostRecentScrumDetail != null) ? mostRecentScrumDetail.HoursRemaining :
             ( (task.Hours != null) ? (int)task.Hours : 0 ),
         StoryTaskDescription = task.Story.UserDefinedId + " -> " + task.Description,
         TaskId = task.TaskId
     };
     return scrumDetail;
 }
Exemplo n.º 14
0
 //private List<object> HandleEmptyScrumList(s
 // [['08/03/2010', 51, '08/03/2010'], ['08/05/2010', 49, '08/05/2010']]
 private List<object> CreateScrumTaskJsonList(Sprint sprint)
 {
     ScrumService scrumService = new ScrumService(new ScrumTimeEntities());
     List<Scrum> scrums = scrumService.GetScrumsBySprintId(sprint.SprintId);
     List<object> scrumJsonList = new List<object>();
     foreach (Scrum scrum in scrums)
     {
         List<object> scrumDetailList = new List<object>();
         scrumDetailList.Add(scrum.DateOfScrum.ToString("MM/dd/yyyy"));
         scrumDetailList.Add(scrum.ScrumDetails.Sum(s => s.HoursRemaining));
         scrumDetailList.Add(scrum.DateOfScrum.ToString("MM/dd/yyyy"));
         scrumJsonList.Add(scrumDetailList);
     }
     return scrumJsonList;
 }