/// <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); }
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; }
public void SaveDeliverableStatus(DeliverableStatusInputModel obj) { var input = new StatusInputModel { DeliverableId = obj.DeliverableId, MilestoneId = obj.MilestoneId, ReleaseId = obj.ReleaseId, ActivityStatuses = new List<DeliverableActivityStatusInputModel>() }; foreach (var proj in obj.Scope) { input.ProjectId = proj.Id; foreach (var act in proj.Workload) { input.ActivityStatuses.Add(new DeliverableActivityStatusInputModel { ActivityId = act.Activity.Id, HoursRemaining = act.HoursRemaining }); } this.CreateDeliverableStatusRecords(input); input.ActivityStatuses.Clear(); } }