private void AddButton_Click(object sender, EventArgs e) { IterationEditForm f = new IterationEditForm(); if (f.ShowDialog() == DialogResult.Cancel) { return; } if (project.ProjectIterations.Count() == 256) { throw new Exception("最多只支持256个迭代。"); } ProjectIteration iteration = new ProjectIteration(); iteration.Order = (byte)(project.ProjectIterations.Count()); iteration.ProjectID = project.ID; iteration.Name = f.IterationName; iteration.Comment = f.IterationComment; iteration.ID = Guid.NewGuid(); JianLiLinq.Default.DB.ProjectIterations.InsertOnSubmit(iteration); JianLiLinq.Default.DB.SubmitChanges(); this.listBox1.Items.Add(iteration); }
private List <ProjectIteration> LoadIterations(XmlNode parentNode, ProjectIteration parentItem = null) { var result = new List <ProjectIteration>(); foreach (XmlNode item in parentNode.ChildNodes) { if (item.Name == "Children") { result = this.LoadIterations(item, parentItem); } else { string nodeId = this.GetNodeID(item.OuterXml); NodeInfo nodeInfo = this.commonStructureService.GetNode(nodeId); var pi = new ProjectIteration { Name = nodeInfo.Name, StartDate = nodeInfo.StartDate, FinishDate = nodeInfo.FinishDate, ParentUri = nodeInfo.ParentUri, Path = nodeInfo.Path, ProjectUri = nodeInfo.ProjectUri, StructureType = nodeInfo.StructureType, Uri = nodeInfo.Uri, FullPath = this.GetFullPath(parentItem, nodeInfo.Name), ParentProjectIteration = parentItem }; pi.Children = this.LoadIterations(item, pi); result.Add(pi); } } return(result); }
private void button1_Click(object sender, EventArgs e) { ProjectIteration pi = project.ProjectIterations[comboBox2.SelectedIndex]; this.Task = DataCenter.CreateTask(this.Module, pi, textBox1.Text, textBox2.Text, (byte)(PriorityComboBox.SelectedIndex + 1)); this.DialogResult = DialogResult.OK; Close(); }
public void AddIteration_passingInProjectDetailsWithThreeLevelsOfIterations_IterationCountStaysTheSameButTheChildOfChildIterationCountOfTheFirstIterationGoesUpByOne() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); List <ProjectIteration> initialList; ProjectIteration initialFirstIteration; List <ProjectIteration> finalList; ProjectIteration finalFirstIteration; using (IIterationManager manager = IterationManagerFactory.GetManager(projectDetail)) { initialList = manager.ListIterations(); if (initialList.Count == 0) { Assert.Fail("No iterations found yet to add a duplication of"); } ProjectIteration[] listOfIterations = initialList.Where(o => o.Children.Count > 0).ToArray(); if (listOfIterations.Length == 0) { Assert.Fail("No iterations found in the first interation yet to add a duplication of"); } listOfIterations = listOfIterations.Where(o => o.Children.Count > 0).ToArray(); if (listOfIterations.Length == 0) { Assert.Fail("The first interation has no children yet to add a duplication of"); } ProjectIteration firstIteration = listOfIterations[0]; initialFirstIteration = firstIteration.Children[0]; string newIterationName = firstIteration.Name + "\\" + initialFirstIteration.Name + "\\Iteration " + GetRandomGuid(); DateTime?startDate = DateTime.Now; DateTime?endDate = DateTime.Now.AddDays(10); // act manager.AddNewIteration(newIterationName, startDate, endDate); // assert finalList = manager.ListIterations(); listOfIterations = finalList.Where(o => o.Children.Count > 0).ToArray(); listOfIterations = listOfIterations.Where(o => o.Children.Count > 0).ToArray(); finalFirstIteration = listOfIterations[0].Children[0]; } int expectedRoot = initialList.Count; int actualRoot = finalList.Count; // check root level Area count Assert.AreEqual(expectedRoot, actualRoot); int expectedChild = initialFirstIteration.Children.Count + 1; int actualChild = finalFirstIteration.Children.Count; // check child level Area count Assert.AreEqual(expectedChild, actualChild); }
public void DeleteIteration(ProjectIteration projectIteration) { if (projectIteration != null) { this.commonStructureService.DeleteBranches(new[] { projectIteration.Uri }, projectIteration.ParentUri); } else { throw new ArgumentNullException("projectIteration", "A valid Project Iteration is required to perform a delete"); } }
public void DeleteIterationUsingIterationPath(string iterationPath) { if (this.CheckIfPathAlreadyExists(iterationPath)) { string formattedIterationPath = this.FormatIterationName(iterationPath); ProjectIteration projectIteration = this.FindProjectIteration(formattedIterationPath); this.DeleteIteration(projectIteration); } else { throw new Exception("The iteration path " + iterationPath + " doesn't exists in the project " + this.projectDetail.ProjectName); } }
// 重新设定周期 void menu_Click(object sender, EventArgs e) { if (!(ProjectTreeView.SelectedNode.Tag is Task)) { throw new Exception("期望对项目设定周期。"); } ToolStripMenuItem item = (ToolStripMenuItem)sender; Task t = (Task)ProjectTreeView.SelectedNode.Tag; ProjectIteration pi = DataCenter.GetProjectIteration(project, item.Text); DataCenter.SetTaskIteration(ref t, pi); }
public static Task CreateTask(ProjectModule module, ProjectIteration iteration, string name, string comment, byte priority) { Task t = new Task(); t.ID = Guid.NewGuid(); t.Parent = module.ID; t.Comment = comment; t.Priority = priority; t.ProjectIteration = iteration; t.Title = name; JianLiLinq.Default.DB.Tasks.InsertOnSubmit(t); JianLiLinq.Default.DB.SubmitChanges(); return(t); }
public ProjectIteration FindProjectIteration(string fullIterationPath) { ProjectIteration projectIteration = null; foreach (ProjectIteration pi in this.FlattenIterations(this.ListIterations())) { if (string.Compare(pi.FullPath, fullIterationPath, true) == 0) { projectIteration = pi; break; } } return(projectIteration); }
public ProjectIterationListView() { RegisterPoupMenuItem("Edit", "Edit", ProjectIteration => { Guid id = ProjectIteration.AsDyanmic().ProjectIterationId; OnEditProjectIteration(new EventArgs <Guid>(id)); }); RegisterPoupMenuItem("Delete", "Delete", ProjectIteration => { Guid id = ProjectIteration.AsDyanmic().ProjectIterationId; OnDeleteProjectIteration(new EventArgs <Guid>(id)); }); SetRowHighlight(); }
/// <summary> /// 建立项目 /// 不允许项目同名。 /// </summary> /// <param name="name"></param> /// <param name="desc"></param> /// <returns></returns> public static Project CreateProject(string name, string desc) { var prj = from project in JianLiLinq.Default.DB.Projects where project.Name == name select project; if (prj.Count() > 0) { throw new Exception("项目 " + name + " 已经存在,请换个名称。"); } // 先保证项目有一个根模块,以便添加模块和任务。 // 新建一个模块。 Guid pmguid = Guid.NewGuid(); Guid pguid = Guid.NewGuid(); ProjectModule pm = new ProjectModule(); pm.ID = pmguid; pm.Name = name;// 初始化时跟项目同名 pm.Comment = ""; pm.Parent = pguid; JianLiLinq.Default.DB.ProjectModules.InsertOnSubmit(pm); Project p = new Project(); p.ID = pguid; p.Name = name; p.Desc = desc; p.ProjectModule = pm;// 此后不能改变 JianLiLinq.Default.DB.Projects.InsertOnSubmit(p); // 必须新建一个ProjectIteration,否则新建的任务无法分配周期。 ProjectIteration pi = new ProjectIteration(); pi.ID = Guid.NewGuid(); pi.Name = "周期 1"; pi.Order = 0; pi.Project = p; pi.Comment = "默认建立的周期,请填写描述。"; JianLi3Data.JianLiLinq.Default.DB.ProjectIterations.InsertOnSubmit(pi); JianLiLinq.Default.DB.SubmitChanges(); return(p); }
private string GetFullPath(ProjectIteration parentItem, string name) { string result = name; while (parentItem != null) { result = parentItem.Name + "\\" + result; parentItem = parentItem.ParentProjectIteration; } if (result.ToLower().StartsWith("iteration\\")) { result = result.Remove(0, result.IndexOf('\\') + 1); } return(this.FormatIterationName(result)); }
private void AddIterationAndCheckEnabledOnBacklog(string teamName, bool addToBacklogForTeam) { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); List <ProjectIteration> initialList; List <ProjectIteration> finalList; string newIterationName = null; IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); ITeamManager teamManager = TeamManagerFactory.GetManager(projectDetail); initialList = manager.ListIterations(); newIterationName = "Iteration " + GetRandomGuid(); DateTime?startDate = DateTime.Now; DateTime?endDate = DateTime.Now.AddDays(10); // act manager.AddNewIteration(newIterationName, startDate, endDate, new List <ITfsTeam> { addToBacklogForTeam?teamManager.GetTfsTeam(teamName) : null }); // assert finalList = manager.ListIterations(); int expected = initialList.Count + 1; int actual = finalList.Count; Assert.AreEqual(expected, actual); ProjectIteration addedItem = (from o in finalList where o.Name == newIterationName select o).FirstOrDefault(); Assert.IsNotNull(addedItem); Assert.AreEqual(addToBacklogForTeam, teamManager.GetTfsTeam(teamName).IsIterationPathEnabled(newIterationName)); }
// 设定Task Iteration 2 internal static void SetTaskIteration(ref Task t, ProjectIteration pi) { t.ProjectIteration = pi; JianLiLinq.Default.DB.SubmitChanges(); }