private void FillEpicsData(Epic epic, IDictionary <string, object> fields) { foreach (var field in fields) { var key = field.Key; var value = field.Value; if (key.ToUpperInvariant().Contains("System.Id".ToUpperInvariant(), StringComparison.InvariantCulture)) { epic.SourceId = Convert.ToInt32(value, CultureInfo.InvariantCulture); } if (key.ToUpperInvariant().Contains("System.IterationId".ToUpperInvariant(), StringComparison.InvariantCulture)) { epic.IterationSk = Convert.ToInt32(value, CultureInfo.InvariantCulture); } if (key.ToUpperInvariant().Contains("System.CreatedDate".ToUpperInvariant(), StringComparison.InvariantCulture)) { epic.CreationDate = Convert.ToDateTime(value, CultureInfo.InvariantCulture); } if (key.ToUpperInvariant().Contains("System.Title".ToUpperInvariant(), StringComparison.InvariantCulture)) { epic.EpicName = value.ToString(); } if (key.ToUpperInvariant().Contains("System.State".ToUpperInvariant(), StringComparison.InvariantCulture)) { epic.State = value.ToString(); } } epic.IsActive = 1; }
/// <summary> /// Wandelt ein XML-Element in eine Epic um /// </summary> /// <param name="root"></param> /// <param name="surface"></param> /// <returns></returns> private Epic ConvertToEpic(XElement root, ScrumSurface surface) { Epic item = new Epic(); ConvertToItemBase(root, item, surface); return(item); }
public void UpdateEpicWithMinimumDataSucceeds() { var client = new TargetProcessClient { ApiSiteInfo = new ApiSiteInfo(TargetProcessRoutes.Route.Epics) }; var originalName = $"Sample Epic From Code - {DateTime.Now}"; var epic = new Epic { Name = originalName, Project = new Project { Id = 194 } }; var data = client.CreateData <Epic>(epic); Assert.NotNull(data); Assert.False(data.HttpResponse.IsError); var newName = $"Sample Modified Epic From Code - {DateTime.Now}"; var newEpic = new Epic { Id = data.Data.Id, Project = data.Data.Project, Name = newName }; var newData = client.UpdateData <Epic>(newEpic); // Verify name changed Assert.NotEqual(newData.Data.Name, originalName); Assert.Equal(newData.Data.Name, newName); // Verify ID did NOT change Assert.Equal(data.Data.Id, newData.Data.Id); }
public void CreateEpicAndThenDeleteItSucceeds() { //Create an epic var client = new TargetProcessClient { ApiSiteInfo = new ApiSiteInfo(TargetProcessRoutes.Route.Epics) }; var epic = new Epic { Name = $"Sample Epic From Code - {DateTime.Now}", Project = new Project { Id = 194 } }; var data = client.CreateData <Epic>(epic); Assert.NotNull(data); Assert.False(data.HttpResponse.IsError); Assert.NotNull(data.Data.Project); Assert.NotNull(data.Data.Project.Id); var createdId = data.Data.Id; Assert.NotEqual(0, createdId); Assert.NotNull(createdId); var result = client.DeleteData <Epic>((int)createdId); Assert.NotNull(result); Assert.NotNull(result.Data.Id); Assert.Equal(createdId, result.Data.Id); Assert.Null(result.Data.Project); }
public Epic Create(Epic user) { _epic.InsertOne(user); return(user); }
public async Task DeleteEpicAsync_FicticiousEpicId_ThrowsNotFoundException() { //arrange Guid publicProjectId = Guid.NewGuid(); Project expectedProject = new Project() { ProjectId = 1, PublicProjectId = publicProjectId, Name = "name", Description = null, DateTimeCreated = DateTime.UtcNow.AddMinutes(-60) }; var projectRepositoryMock = new Mock <IProjectRepository>(MockBehavior.Strict); projectRepositoryMock.Setup(x => x.GetProjectAsync(publicProjectId)) .ReturnsAsync(expectedProject); Guid publicEpicId = Guid.NewGuid(); Epic expectedEpic = null; var epicRepositoryMock = new Mock <IEpicRepository>(MockBehavior.Strict); epicRepositoryMock.Setup(x => x.GetEpicAsync(publicEpicId)) .ReturnsAsync(expectedEpic); epicRepositoryMock.Setup(x => x.DeleteEpicAsync(publicEpicId)) .Returns(Task.CompletedTask); var epicManager = new EpicManager(projectRepositoryMock.Object, epicRepositoryMock.Object); //act/assert _ = await Assert.ThrowsAsync <NotFoundException>(async() => { await epicManager.DeleteEpicAsync(publicProjectId, publicEpicId); }); }
public async Task <AddOrUpdateEpicResponse> Handle(AddOrUpdateEpicRequest request) { var entity = await _context.Epics .SingleOrDefaultAsync(x => x.Id == request.Epic.Id); if (entity == null) { _context.Epics.Add(entity = new Epic()); } entity.Name = request.Epic.Name; entity.Description = request.Epic.Description; entity.IsTemplate = request.Epic.IsTemplate; entity.ProductId = request.Epic.ProductId; entity.Product = await _context.Products.Where(x => x.Id == request.Epic.ProductId.Value) .SingleOrDefaultAsync(); entity.Slug = request.Epic.Name.GenerateSlug(); if (request.Epic.Priority.HasValue) { entity.Priority = request.Epic.Priority.Value; } await _context.SaveChangesAsync(); return(new AddOrUpdateEpicResponse()); }
public async Task UpdateEpics_should_update_epic_and_return_its_new_content() { var dueValue = "2020-01-15"; var startValue = "2020-01-02"; var epicKey = "KEY-11"; var epicJson = CreateJsonElement(); var updatedEpic = new Epic(); IReadOnlyDictionary <string, string[]> fields = new Dictionary <string, string[]> { { "Start date", new[] { "custom_1" } } }; _client.Setup(x => x.QueryFieldNameToKeysMap()).ReturnsAsync(fields); _client.Setup(x => x.UpdateIssue(epicKey, It.IsAny <IssueContent>())).Returns(Task.CompletedTask); _client.Setup(x => x.QueryJql("key=KEY-11")).ReturnsAsync(new[] { epicJson }); _mapper.Setup(x => x.MapEpic(epicJson, fields)).Returns(updatedEpic); var epic = await _provider.UpdateEpic(epicKey, new EpicMeta { DueDate = DateTime.Parse(dueValue), StartDate = DateTime.Parse(startValue) }); epic.ShouldBeSameAs(updatedEpic); var expectedFields = new Dictionary <string, string> { { "custom_1", startValue }, { "duedate", dueValue } }; _client.Verify(x => x.UpdateIssue(epicKey, It.Is <IssueContent>(c => AreFieldsEqual(c, expectedFields)))); }
private Epic SetupEpicMapping(JsonElement element) { var epic = new Epic(); _mapper.Setup(x => x.MapEpic(element, It.IsAny <IReadOnlyDictionary <string, string[]> >())).Returns(epic); return(epic); }
private async Task <int> GetOrCreateClubhouseEpic(Octokit.Issue issue) { if (issue.Milestone == null) { return(0); } if (!_fetchedEpics) { _epics = (await _client.Epics.List()).ToList(); } var directHit = _epics.FirstOrDefault(x => x.Name.Equals(issue.Milestone.Title)); if (directHit != null) { return(directHit.Id); } //else, we don't have an epic with this details.... var newEpic = new Epic { Name = issue.Milestone.Title, CreatedAt = issue.Milestone.CreatedAt.DateTime, //deadline Description = issue.Milestone.Description, }; if (issue.Milestone.DueOn.HasValue) { newEpic.Deadline = issue.Milestone.DueOn.Value.DateTime; } await _client.Epics.Create(newEpic); return(newEpic.Id); }
internal Epic CreateChildEpic(Epic epic) { var childEpic = epic.GenerateChildEpic(); RegisterForDisposal(childEpic); return(childEpic); }
private void CreateNewEpicButton_Click(object sender, RoutedEventArgs e) { CheckData(); try { if (isDataCorrect) { var epic = new Epic() { ProjectId = this.ProjectId, Project = context.Projects.Where(p => p.Id == ProjectId).First(), Title = EpicTitle.Text, Description = EpicDescription.Text, StartDay = startDate, DeadLine = deadLine }; context.Epics.Add(epic); context.SaveChanges(); MessageBox.Show("Epic succesfully added", "Information", MessageBoxButton.OK, MessageBoxImage.Information); } this.DialogResult = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void CreateAssets() { if (sandboxProject == null) { sandboxProject = SandboxProject; andre = Instance.Get.MemberByID("Member:1000"); danny = Instance.Get.MemberByID("Member:1005"); epic1 = Instance.Create.Epic("Epic 1", SandboxProject); epic2 = epic1.GenerateChildEpic(); epic2.Name = "Epic 2"; epic2.Save(); story1 = SandboxProject.CreateStory("Story 1"); story2 = SandboxProject.CreateStory("Story 2"); story3 = SandboxProject.CreateStory("Story 3"); defect1 = SandboxProject.CreateDefect("Defect 1"); defect2 = SandboxProject.CreateDefect("Defect 2"); defect3 = SandboxProject.CreateDefect("Defect 3"); story1.Description = "ABCDEFGHIJKJMNOPQRSTUVWXYZ"; story1.Save(); story2.Description = "1234567890"; story2.Save(); story3.Description = "123 ABC"; story3.Save(); story1.Owners.Add(andre); story1.Owners.Add(danny); story3.Owners.Add(andre); defect2.Owners.Add(andre); defect3.Owners.Add(danny); defect1.FoundInBuild = "1.0.0.0"; defect1.ResolvedInBuild = "1.0.0.2"; defect1.Environment = "Windows"; defect1.Estimate = 2.0; defect1.Reference = "123456"; defect1.Save(); defect2.AffectedByDefects.Add(defect1); defect2.FoundInBuild = "1.0.0.0"; defect2.FoundBy = "Joe"; defect2.VerifiedBy = andre; defect2.Environment = "Mac"; defect2.Type.CurrentValue = "Documentation"; defect2.ResolutionReason.CurrentValue = "Duplicate"; defect2.Estimate = 1.0; defect2.Save(); defect3.FoundInBuild = "1.0.0.1"; defect3.FoundBy = "Bob"; defect3.VerifiedBy = danny; defect3.Type.CurrentValue = "Code"; defect3.ResolutionReason.CurrentValue = "Fixed"; defect3.Save(); } }
public ActionResult DeleteConfirmed(int id) { Epic epic = db.Epics.Find(id); db.Epics.Remove(epic); db.SaveChanges(); return(RedirectToAction("Index")); }
public void SingleBranchLVT_Epic() { Epic EpicObj = SingleBranchLVT.Vision.Goals[0].Bets[0].Initiatives[0].Epics[0]; Assert.IsInstanceOf(typeof(Epic), EpicObj, "Test Epic is instance of Epic class"); Assert.AreEqual("epicDescription", EpicObj.Description, "Test Epic has a description"); Assert.AreEqual("epicDeadline", EpicObj.Deadline, "Test Epic has a deadline"); }
/// <summary> /// Update an Epic /// See <a href="https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/epic-partiallyUpdateEpic">Partially update epic</a> /// </summary> /// <param name="jiraClient">IAgileDomain to bind the extension method to</param> /// <param name="epic">Epic to update</param> /// <param name="cancellationToken">CancellationToken</param> /// <returns>Epic</returns> public static async Task <Epic> UpdateEpicAsync(this IAgileDomain jiraClient, Epic epic, CancellationToken cancellationToken = default) { jiraClient.Behaviour.MakeCurrent(); var epicUri = jiraClient.JiraAgileRestUri.AppendSegments("epic", epic.Id); var response = await epicUri.PostAsync <HttpResponse <Epic, Error> >(epic, cancellationToken).ConfigureAwait(false); return(response.HandleErrors()); }
public ActionResult EditEpic(int id, int?from) { Epic existTask = new Epic(); existTask = db.Epics.FirstOrDefault(x => x.EpicId == id); return(View(existTask)); }
public ActionResult CreateEpic(int id, int?from) { var newEpic = new Epic(); newEpic.ProjectId = id; return(View(newEpic)); }
/// <summary> /// Schreibt eine Epic als XML-ELement /// </summary> /// <param name="item"></param> /// <returns></returns> private XElement EncodeEpic(Epic item) { XElement root = new XElement("Epic"); //Es gibt keine Eigenschaften, die nur Epics besitzen EncodeItemBase(item, root); return(root); }
public void SetupForTest() { _epicPresenter = new EpicPresenter(); _testEpic = new Epic("testDescription", "testDeadline"); _parentNodeID = "Parent Initiative NodeID"; _expectedEpicOrgChartString = $"[{{ v:'{_testEpic.NodeID}', f:'{_testEpic.GetType().Name}<div style=\"font-style:italic\">{_testEpic.Description}</div><div style=\"font-style:italic\">{_testEpic.Deadline}</div>'}}, '{_parentNodeID}']"; }
/// <summary> /// Erstellt ein paar User Stories und Epics zum Testen /// </summary> private void DebugStories() { Epic e = new Epic(); UserStory u = new UserStory(); u.Epic = e; Database.AddItem(e); Database.AddItem(u); }
public void DeleteEpic(Epic epic, ApplicationUser deletedBy) { repository.Delete(epic, deletedBy); epic.Assignments.ForEach(x => { repository.Delete(x, deletedBy); }); }
public void Run() { /* * Project * | * |-----Epic-1 * | | * | |----US-1(5) * | | * | |----US-2(8) * | * |-----Epic-2 * | | * | |----US-3(3) * | | * | |----US-4(8) * | * | * |----US-5(2) * | * |----US-6(8) * * Total story points in a project: 34 */ // User stories var us1 = new UserStory(5); var us2 = new UserStory(8); var us3 = new UserStory(3); var us4 = new UserStory(8); var us5 = new UserStory(2); var us6 = new UserStory(8); // Epics var epic1 = new Epic(); epic1.AddUserStory(us1); epic1.AddUserStory(us2); var epic2 = new Epic(); epic2.AddUserStory(us3); epic2.AddUserStory(us4); // Project var project = new Project(); project.AddEpic(epic1); project.AddEpic(epic2); project.AddUserStory(us5); project.AddUserStory(us6); // Calculate total sum, it should be 34 var result = project.CalculateStoryPoints(); Console.WriteLine($"Total number of story points in a Project is {result}"); }
public void TestValidObjectWrongType() { Epic epic = EntityFactory.CreateEpic("test epic", SandboxProject); Story testMe = Instance.Get.StoryByID(epic.ID); Assert.IsNull(testMe); // _server.Get.StoryByID(AssetID.FromToken("Epic:1448")); /// oid is correct for epic /// expected result if null }
public static void Main(string[] args) { Epic t1 = new Epic { Time = 3 }; Epic t2 = new Epic { Time = 5 }; }
public async Task LoadEpic(int id) { EpicEntity = await EpicsService.GetEpicOrNull(id); if (EpicEntity.Id != 0) { await SelectOrganization(EpicEntity.Project.OrganizationId); } }
public async Task <Epic> UpdateEpicAsync(Epic epic) { var epicEntity = _mapper.Map <Models.Entities.Epic>(epic); var updatedEntity = await _epicRepository.UpdateItemAsync(epicEntity); var epicModel = _mapper.Map <Epic>(updatedEntity); return(epicModel); }
public static Domain.Models.Epic MapWithWriter(Epic entity) { return(new Domain.Models.Epic { ID = entity.Id, Title = entity.Name, Date = (DateTime)entity.DateCreated, Writer = UserMapper.Map(entity.Writer) }); }
public static Domain.Models.Epic MapWithRatings(Epic entity) { return(new Domain.Models.Epic { ID = entity.Id, Title = entity.Name, Date = (DateTime)entity.DateCreated, Ratings = entity.Ratings.Select(RatingMapper.Map) }); }
public EpicControl(Epic epic, ScrumSurface surface) : base(epic, surface) { UserInterface = new EpicUI_Base(); StdView = new EpicUI_View(); EditorView = new EpicUI_Editor(); this.Epic.DataChanged += (s, e) => { this.Invoke(CheckVisibility); }; this.Epic.ExternalDataChanged += (s, e) => { this.Invoke(CheckVisibility); }; AfterInit(); }
/// <summary> /// Reads all Epics for the indicated Project /// </summary> /// <param name="ProjectID">Formatted ID of the Project (Rally Feature)</param> public static List<Epic> GetEpicsForProject(string ProjectID) { List<Epic> listReturn = new List<Epic>(); // Grab all Epics under the given project LogOutput("Using RallyAPI to request epic information for all projects...", "GetEpicsForProject", true); LogOutput("Building Rally Request...", "GetEpicsForProject", true); //Request rallyRequest = new Request("PortfolioItem/Epic"); Request rallyRequest = new Request("PortfolioItem/Feature"); rallyRequest.Fetch = new List<string>() { "Name", "FormattedID", "Owner", "PlannedEndDate", "PlannedStartDate","ActualEndDate", "State", "Description", "Release", "StatusChangedDate" }; rallyRequest.Query = new Query("Parent.FormattedID", Query.Operator.Equals, ProjectID); LogOutput("Running Rally Query request...", "GetEpicsForProject", true); QueryResult rallyResult = RallyAPI.Query(rallyRequest); LogOutput("Looping through Query request...", "GetEpicsForProject", true); foreach (var result in rallyResult.Results) { Epic epic = new Epic(); epic.Name = RationalizeData(result["Name"]); epic.FormattedID = RationalizeData(result["FormattedID"]); epic.Owner = RationalizeData(result["Owner"]); epic.PlannedEndDate = Convert.ToDateTime(result["PlannedEndDate"]); epic.ActualEndDate = Convert.ToDateTime(result["ActualEndDate"]); epic.PlannedStartDate = Convert.ToDateTime(result["PlannedStartDate"]); epic.State = RationalizeData(result["State"]); epic.Description = RationalizeData(result["Description"]); epic.ParentProject = ProjectName(ProjectID); epic.Release = RationalizeData(result["Release"]); epic.StateChangedDate = Convert.ToDateTime(result["StatusChangedDate"]); LogOutput("Appending new epic object to return list...", "GetEpicsForProject", true); listReturn.Add(epic); } LogOutput("Completed processing all epics, returning list", "GetEpicsForProject", true); return listReturn; }
static void Main(string[] args) { #region StartUp Section // Initialize all variables ConfigRallyUID = ""; ConfigRallyPWD = ""; ConfigLogPath = ""; ConfigStatusEOL = ""; ConfigReportPath = ""; ReportFile = ""; LogFile = ""; ConfigDBServer = ""; ConfigDBName = ""; ConfigDBUID = ""; ConfigDBPWD = ""; ReportDayNum = 0; ReportWeekNum = 0; ReportMonth = 0; ReportQuarter = 0; ReportYear = 0; // Get the configuration information from config file if (!GetConfigSettings()) { // If we can't get the configuration settings, we can't even log anything, so just terminate Environment.Exit(-1); } // Check for any commandline arguments. If there are not any, assume a "Daily" operating mode and set // the report date to yesterday (we don't want to report on today) if (args.Length != 0) { GetCommandArgs(); } else { OperatingMode = OperateMode.Daily; ReportingDay = DateTime.Today.AddDays(-1); ReportDayNum = ReportingDay.Day; ReportMonth = ReportingDay.Month; ReportYear = ReportingDay.Year; } #endregion StartUp Section // Log the start of processing LogOutput("Started processing at " + DateTime.Now.ToLongTimeString() + " on " + DateTime.Now.ToLongDateString(), "Main", false); DateTime dtStartTime = DateTime.Now; // Log the operating mode switch (OperatingMode) { case OperateMode.Daily: LogOutput("Operating in Daily Mode...Processing for Day " + ReportingDay.ToString("dd-MMM-yyyy"), "Main", false); break; case OperateMode.Monthly: LogOutput("Operating in Monthly Mode...Processing for " + ReportingDay.ToString("MMM"), "Main", false); break; case OperateMode.Quarterly: LogOutput("Operating in Quarterly mode...Processing for Quarter Q" + ReportQuarter.ToString() + "Y" + ReportYear.ToString(), "Main", false); break; case OperateMode.Annual: LogOutput("Operating in Annual mode...Processing for year " + ReportYear.ToString(), "Main", false); break; case OperateMode.Weekly: LogOutput("Operating in Weekly mode...Processing for Day " + ReportingDay.ToString("dd-MMM-yyyy"), "Main", false); break; default: LogOutput("Unknown Operating mode...assuming Daily...", "Main", false); break; } #region Gather from Rally // Create the Rally API object LogOutput("Creating reference to RallyAPI...", "Main", true); RallyAPI = new RallyRestApi(); // Login to Rally LogOutput("Starting connection to Rally...", "Main", true); try { RallyAPI.Authenticate(ConfigRallyUID, ConfigRallyPWD, ConfigRallyURL); LogOutput("Response from RallyAPI.Authenticate: " + RallyAPI.AuthenticationState.ToString(), "Main", true); if (RallyAPI.AuthenticationState.ToString() != "Authenticated") { // We did not actually connect LogOutput("Unable to connect to Rally and establish session. Application will terminate.", "Main", false); Environment.Exit(-1); } else { if (RallyAPI.ConnectionInfo.UserName == null) { LogOutput("RallyAPI.ConnectionInfo: " + RallyAPI.ConnectionInfo.ToString(), "Main", false); LogOutput("Unable to authenticate with Rally. Application will terminate.", "Main", false); Environment.Exit(-1); } else { LogOutput("Connected to Rally as user " + RallyAPI.ConnectionInfo.UserName, "Main", true); } } } catch (Exception ex) { LogOutput("Error Connecting to Rally: " + ex.Message, "Main", false); LogOutput("Rally Authentication State: " + RallyAPI.AuthenticationState.ToString() + "Rally Connection Info: " + RallyAPI.ConnectionInfo.ToString(), "Main", false); } // Grab the active Initiatives we want to report on LogOutput("Getting all Initiatives...", "Main", false); List<Initiative> InitiativeList = new List<Initiative>(); LogOutput("Calling 'GetInitiativeList'...", "Main", true); InitiativeList = GetInitiativeList(); LogOutput("Done with 'GetInitiativeList'", "Main", true); if (InitiativeList.Count == 0) { // Could not get the Initiatives...or nothing to report on, so stop LogOutput("Unable to open Initiative list or no Initiatives to report on. Application will terminate.", "Main", false); InitiativeList.Clear(); RallyAPI.Logout(); // Disconnect from Rally Environment.Exit(-1); // End Program } LogOutput("Retrieved " + InitiativeList.Count + " Initiatives to report on", "Main", false); // Now iterate through the initiatives and get all the Features or "Projects" LogOutput("Getting all Projects for the Initiatives...", "Main", false); BasicProjectList = new List<Project>(); LogOutput("Looping for each Initiative...", "Main", true); foreach (Initiative init in InitiativeList) { // Get the project list for the current initiative ONLY List<Project> ProjectList = new List<Project>(); LogOutput("Calling 'GetProjectsForInitiative' with " + init.Name.Trim() + "...", "Main", true); ProjectList = GetProjectsForInitiative(init.Name.Trim()); LogOutput("Done with 'GetProjectsForInitiative' for " + init.Name.Trim(), "Main", true); // Append this list to the FULL list LogOutput("Appending " + ProjectList.Count + " projects to object 'BasicProjectList'", "Main", true); BasicProjectList.AddRange(ProjectList); } LogOutput("Retrieved " + BasicProjectList.Count + " Projects total", "Main", false); // We need to loop through the project list now and for each project // we need to get all the epics. Then with each epic, we recursively // get all user stories LogOutput("Getting all User Stories for all projects...", "Main", false); // Initialize a new list of projects. This will become the full list including stories // and defects CompleteProjectList = new List<Project>(); LogOutput("Looping for each Project...", "Main", true); foreach (Project proj in BasicProjectList) { // Get all the epics for this project LogOutput("~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+", "Main", true); LogOutput("Calling 'GetEpicsForProject' with " + proj.Name.Trim() + "...", "Main", true); List<Epic> EpicList = new List<Epic>(); EpicList = GetEpicsForProject(proj.FormattedID.Trim()); LogOutput("Done with 'GetEpicsForProject' for " + proj.Name.Trim(), "Main", true); // Now go through each of the Epics for the current project // and recurse through to get all final-level user stories LogOutput("Getting all User Stories for " + proj.Name + "...", "Main", true); List<Epic> FullEpicList = new List<Epic>(); BasicStoryList = new List<UserStory>(); LogOutput("Looping for each Epic...", "Main", true); foreach (Epic epic in EpicList) { Epic newepic = new Epic(); List<UserStory> StoryList = new List<UserStory>(); LogOutput("Calling 'GetUserStoriesPerParent' with " + epic.FormattedID.Trim() + " as Root Parent...", "Main", true); StoryList = GetUserStoriesPerParent(epic.FormattedID.Trim(), epic.Name.Trim(), true); LogOutput("Done with 'GetUserStoriesPerParent' for " + epic.FormattedID.Trim(), "Main", true); // save the info as a new epic newepic.ActualEndDate = epic.ActualEndDate; newepic.DefectActual = epic.DefectActual; newepic.DefectEstimate = epic.DefectEstimate; newepic.DefectToDo = epic.DefectToDo; newepic.Description = epic.Description; newepic.FormattedID = epic.FormattedID; newepic.Name = epic.Name; newepic.Owner = epic.Owner; newepic.ParentProject = epic.ParentProject; newepic.PlannedEndDate = epic.PlannedEndDate; newepic.PlannedStartDate = epic.PlannedStartDate; newepic.Release = epic.Release; newepic.State = epic.State; newepic.StateChangedDate = epic.StateChangedDate; newepic.StoryActual = epic.StoryActual; newepic.StoryEstimate = epic.StoryEstimate; newepic.StoryToDo = epic.StoryToDo; newepic.UserStories = StoryList; // Add the stories to the full list FullEpicList.Add(newepic); BasicStoryList.AddRange(StoryList); } LogOutput("Retrieved " + BasicStoryList.Count + " User Stories for " + proj.Name, "Main", false); // Get any defects there may be for the User Stories LogOutput("Getting all Defects for " + proj.Name + "...", "Main", false); BasicDefectList = new List<Defect>(); LogOutput("Looping for each Story...", "Main", true); foreach (UserStory story in BasicStoryList) { List<Defect> DefectList = new List<Defect>(); // Defects will always be attached to a User Story LogOutput("Calling 'GetDefectsForStory' with " + story.Name + "...", "Main", true); DefectList = GetDefectsForStory(story); LogOutput("Done with 'GetDefectsForStory' for " + story.Name, "Main", true); // If there are any defects, add them to the list if (DefectList.Count > 0) { LogOutput("Appending " + DefectList.Count + " defects to object 'BasicDefectList'", "Main", true); BasicDefectList.AddRange(DefectList); } } // At this point we have the FULL list of User Stories/Defects for the current // project. We now create a "new" project with the same properties, but this time // we are able to store the Epics, User Stories, and Defects. LogOutput("Creating new project object and populating with full information...", "Main", true); Project newproject = new Project(); newproject.ActualEndDate = proj.ActualEndDate; newproject.Description = proj.Description; newproject.Expedite = proj.Expedite; newproject.FormattedID = proj.FormattedID; newproject.Initiative = proj.Initiative; newproject.LastUpdateDate = proj.LastUpdateDate; newproject.Name = proj.Name; newproject.OpportunityAmount = proj.OpportunityAmount; newproject.Owner = proj.Owner; newproject.UpdateOwner = proj.UpdateOwner; newproject.StakeHolder = proj.StakeHolder; newproject.PlannedEndDate = proj.PlannedEndDate; newproject.PlannedStartDate = proj.PlannedStartDate; newproject.RevokedReason = proj.RevokedReason; newproject.State = proj.State; newproject.StateChangedDate = proj.StateChangedDate; newproject.StatusUpdate = proj.StatusUpdate; newproject.UserStories = BasicStoryList; newproject.Defects = BasicDefectList; newproject.Epics = FullEpicList; LogOutput("Appending new project object to object 'CompleteProjectList'", "Main", true); CompleteProjectList.Add(newproject); } LogOutput("Done looping through all projects", "Main", false); LogOutput("Appending new project object to object 'CompleteProjectList'", "Main", true); #endregion Gather from Rally #region Calculation Section // We now have a full list of all projects with all complete information so // at this point we can calculate the Actuals for each project based on the reporting mode we are operating in switch (OperatingMode) { case OperateMode.Daily: // This mode runs every day and simply keeps running total of time with daily inserts for each project AllProjectInfo = new List<Project>(); LogOutput("Calling 'CalculateDailyTotals' with " + CompleteProjectList.Count + " complete projects...", "Main", true); AllProjectInfo = CalculateDailyTotals(CompleteProjectList, ReportingDay); LogOutput("Done with 'CalculateDailyTotals'", "Main", true); // Now create the final report LogOutput("Calling 'CreateDailyReport'...", "Main", true); CreateDailyReport(AllProjectInfo, ReportingDay); LogOutput("Done with 'CreateDailyReport'...", "Main", true); break; case OperateMode.Monthly: // This mode runs each month and creates very high-level summary info AllProjectInfo = new List<Project>(); LogOutput("Calling 'CalculateMonthlyReport' with " + CompleteProjectList.Count + " complete projects...", "Main", true); AllProjectInfo = CalculateMonthlyReport(CompleteProjectList, ReportMonth); LogOutput("Done with 'CalculateMonthlyReport'", "Main", true); // Now create the final report LogOutput("Calling 'CreateMonthlyReport'...", "Main", true); CreateMonthlyReport(AllProjectInfo, ReportMonth); LogOutput("Done with 'CreateMonthlyReport'...", "Main", true); break; case OperateMode.Quarterly: AllProjectInfo = new List<Project>(); LogOutput("Calling 'CalculateQuarterTotals' with " + CompleteProjectList.Count + " complete projects...", "Main", true); AllProjectInfo = CalculateQuarterTotals(CompleteProjectList, ReportQuarter, ReportYear); LogOutput("Done with 'CalculateQuarterTotals'", "Main", true); // Now create the final report LogOutput("Calling 'CreateQuarterReport'...", "Main", true); CreateQuarterReport(AllProjectInfo, ReportYear.ToString() + 'Q' + ReportQuarter.ToString()); LogOutput("Done with 'CreateQuarterReport'...", "Main", true); break; case OperateMode.Annual: AllProjectInfo = new List<Project>(); LogOutput("Calling 'CalculateAnnualTotals' with " + CompleteProjectList.Count + " complete projects...", "Main", true); AllProjectInfo = CalculateAnnualTotals(CompleteProjectList, ReportYear); LogOutput("Done with 'CalculateAnnualTotals'", "Main", true); // Now create the final report LogOutput("Calling 'CreateAnnualReport'...", "Main", true); CreateAnnualReport(AllProjectInfo, ReportYear); LogOutput("Done with 'CreateAnnualReport'...", "Main", true); break; case OperateMode.Weekly: // This mode is intended to run on Sunday in order to run stats for up-to-and-including current week for projects. The "Project Update" // is also included so the single table can be queried AllProjectInfo = new List<Project>(); LogOutput("Calling 'CalculateWeeklyTotals' with " + CompleteProjectList.Count + " complete projects...", "Main", true); AllProjectInfo = CalculateWeeklyTotals(CompleteProjectList, ReportingDay); LogOutput("Done with 'CalculateWeeklyTotals'", "Main", true); // Now create the weekly report LogOutput("Calling 'CreateWeeklyReport'...", "Main", true); CreateWeeklyReport(AllProjectInfo, ReportingDay); LogOutput("Done with 'CreateWeeklyReport'...", "Main", true); break; } #endregion DateTime dtEndTime = DateTime.Now; string strTotSeconds = dtEndTime.Subtract(dtStartTime).TotalSeconds.ToString(); LogOutput("Completed processing at " + DateTime.Now.ToLongTimeString() + " on " + DateTime.Now.ToLongDateString() + " - Total Processing Time: " + strTotSeconds + " seconds", "Main", false); Environment.Exit(0); }
/// <summary> /// Accepts list of all Epics / User Stories / Defects and creates summary total roll-ups at the Epic level /// </summary> /// <param name="epics">List of all Epics</param> /// <param name="stories">List of all Stories</param> /// <param name="defects">List of all Defects</param> public static List<Epic> CreateWeeklyEpicSummary(List<Epic> epics, List<UserStory> stories, List<Defect> defects) { List<Epic> ReturnEpics = new List<Epic>(); foreach (Epic epic in epics) { Epic newepic = new Epic(); newepic.StoryEstimate = 0; newepic.StoryToDo = 0; newepic.StoryActual = 0; newepic.DefectEstimate = 0; newepic.DefectToDo = 0; newepic.DefectActual = 0; newepic.ActualEndDate = epic.ActualEndDate; newepic.Description = epic.Description; newepic.FormattedID = epic.FormattedID; newepic.Name = epic.Name; newepic.Owner = epic.Owner; newepic.ParentProject = epic.ParentProject; newepic.PlannedEndDate = epic.PlannedEndDate; newepic.PlannedStartDate = epic.PlannedStartDate; newepic.Release = epic.Release; newepic.State = epic.State; newepic.StateChangedDate = epic.StateChangedDate; newepic.UserStories = epic.UserStories; foreach (UserStory story in newepic.UserStories) { foreach (Task storytask in story.Tasks) { newepic.StoryEstimate = newepic.StoryEstimate + storytask.Estimate; newepic.StoryToDo = newepic.StoryToDo + storytask.ToDo; newepic.StoryActual = newepic.StoryActual + storytask.Actual; if (defects != null) { foreach (Defect defect in defects) { if (defect.ParentStory == story.FormattedID) { foreach (Task defecttask in defect.Tasks) { newepic.DefectEstimate = newepic.DefectEstimate + defecttask.Estimate; newepic.DefectToDo = newepic.DefectToDo + defecttask.ToDo; newepic.DefectActual = newepic.DefectActual + defecttask.Actual; } } } } } } ReturnEpics.Add(newepic); } return ReturnEpics; }