private void StatusSwitch_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (managehelper != null && progresshelper != null) { allprojectlist = managehelper.ShowProjectList(Claims.User.Organization, true); allprojectlist.AddRange(managehelper.ShowProjectList(Claims.User.Organization, false)); } if (project_list != null) { ShowList(StatusSwitch.SelectedIndex); } }
public void ShowProjectListTest() { // 创建org Organization org = identityhelper.CreateOrFindOrganization(Entity.OrganizationEnum.TestOnly); // 创建两个project Guid uid = Guid.NewGuid(); string name1 = "testcreatafirstproject" + uid.ToString(); string name2 = "testcreatasecondproject" + uid.ToString(); ProgressResult addresult1 = helper.CreatNewProject(org, DateTime.Now, name1, "uibe", "nothing", 20); ProgressResult addresult2 = helper.CreatNewProject(org, DateTime.Now, name2, "uibe", "it's a test", 30); if (!addresult1.Succeeded || !addresult2.Succeeded) { Assert.Fail("添加记录失败!"); } // 测试ShowProjectList var result = helper.ShowProjectList(org, true); var actual = database.Projects.Where(b => b.Organization.Id == org.Id).ToList(); int resultcout = result.Count(); int actualcount = actual.Count(); if (result.Count() == 0 && actual.Count() == 0) { Assert.Fail("记录可能为空,为查询到有关记录!"); } if (resultcout != actualcount) { Assert.Fail("未成功调用showlist方法查询到有关数据!showlist失败!"); } // 删除数据库的有关数据[org pro] DeleteOrgnization(org); }
public ProjectManage() { InitializeComponent(); if (identitypage.Claims != null) { Claims = identitypage.Claims; } managehelper = ProjectManageHelper.GetInstance(); progresshelper = ProjectProgressHelper.GetInstance(); if (managehelper.ShowProjectList(Claims.User.Organization, true) != null) { allprojectlist = managehelper.ShowProjectList(Claims.User.Organization, true); } allprojectlist.AddRange(managehelper.ShowProjectList(Claims.User.Organization, false)); ShowList(StatusSwitch.SelectedIndex); if (Claims.Roles.Count() == 1 && Claims.IsInRole(AppRoleEnum.OrgnizationMember)) { project_list.ItemsSource = progresshelper.FindAuthorizedProjectsByUser(Claims.User); StatusSwitch.IsEnabled = false; } }