public void Delete(ProjectDetail projectDetail) { if (projectDetail.ProjectName != null && projectDetail.Status != null) { _context.Delete(projectDetail); } }
private YumlClassDiagram GenerateClassDiagram(ProjectDetail rootProjectDetail, ProjectDetailsCollection parentProjectDetailsCollection, bool newlineForEachRelationship) { var classDiagram = new YumlClassDiagram(newlineForEachRelationship); GenerateClassDiagramRelationships(rootProjectDetail, parentProjectDetailsCollection, classDiagram.Relationships, newlineForEachRelationship); return(classDiagram); }
public void Save(ProjectDetail project) { ProjectDetailValidator validator = new ProjectDetailValidator(); validator.ValidateAndThrow(project); _projectsDataManager.Save(project); }
private void UpdateProjectsConfigEntity() { //更新 ProjectsConfigEntity.NugetServer = tb_NugetServer.Text; ProjectsConfigEntity.APIKey = tb_APIKey.Text; //更新当前在选的程序 ProjectDetail project = null; if (!string.IsNullOrEmpty(cb_projects.Text)) { project = ProjectsConfigEntity.Projects.FirstOrDefault(c => c.Name == cb_projects.Text); } if (project == null) { project = new ProjectDetail(cb_projects.Text, tb_Author.Text, tb_projectRootPath.Text); project.SetDependencesString(tb_Dependences.Text); ProjectsConfigEntity.Projects.Add(project); } else { project.Author = tb_Author.Text; project.RootPath = tb_projectRootPath.Text; project.SetDependencesString(tb_Dependences.Text); } WriteText("已更新" + nameof(ProjectsConfigEntity)); }
private string GetData() { context.Response.ContentType = "application/json"; DataClassesDataContext dc = new DataClassesDataContext(); String F_projectID = context.Session[SessionMgm.ProjectID].ToString(); String guideID = null, result = ""; if ("sci".Equals(paras["type"])) { ScienceProject sp = dc.ScienceProject.SingleOrDefault(_sp => _sp.F_ID.Equals(F_projectID)); if (sp != null) { guideID = sp.F_guideProjectID; } } else if ("social".Equals(paras["type"])) { EducationV2.SocialProject sp = dc.SocialProject.SingleOrDefault(_sp => _sp.F_ID.Equals(F_projectID)); if (sp != null) { guideID = sp.F_guideProjectID; } } if (String.IsNullOrEmpty(guideID) == false) { ProjectDetail pd = dc.ProjectDetail.SingleOrDefault(_pd => _pd.F_ID.Equals(guideID)); result = UtilHelper.GetJSON(pd); } return(result); }
private List <YumlRelationshipBase> GenerateYumlRelationships(ProjectDetail projectDetail, ProjectDetailsCollection projectDetailsCollection, bool newlineForEachRelationship) { var relationships = new List <YumlRelationshipBase>(); var detailModel = GenerateClass(projectDetail); foreach (var linkObject in projectDetail.ChildProjects) { var childModel = GenerateClass(projectDetailsCollection.GetById(linkObject.Id)); relationships.Add(new SimpleAssociation { Parent = detailModel, Child = childModel }); } foreach (var dllReference in projectDetail.References) { var childModel = GenerateClass(dllReference); relationships.Add(new SimpleAssociation { Parent = detailModel, Child = childModel }); } return(relationships); }
public static ProjectDetailsOutputModel FromEntity(ProjectDetail projectDetails) { return(new ProjectDetailsOutputModel() { Id = projectDetails.Id, ProjectId = projectDetails.ProjectId, Info = projectDetails.Info, Description = projectDetails.Description, Images = projectDetails.ProjectDetailImages.Select(x => new ImageOutputModel() { Id = x.ImageId, Path = x.Image.ImagePath, Alt = x.Image.ImageAlt }).ToList(), Links = projectDetails.ProjectDetailLinks.Select(x => new LinkOutputModel() { Id = x.LinkId, Name = x.Link.Name, Href = x.Link.Href }).ToList(), Tags = projectDetails.ProjectDetailTags.Select(x => new TagOutputModel() { Id = x.TagId, Name = x.Tag.Name }).ToList() }); }
public void AddArea_passingInProjectDetailsWithThreeLevelsOfAreasAllCompletelyNew_AreaGoesUpByOneOnTopLevelAndTwoLevelsDownAreCreated() { // arrange ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail; List <ProjectArea> initialList; List <ProjectArea> finalList; bool fullExpectedPathExists = false; using (IAreaManager manager = AreaManagerFactory.GetManager(projectDetail)) { initialList = manager.ListAreas(); string newAreaName = "Top Level " + GetRandomGuid() + "\\Level Two\\Level Three"; // act manager.AddNewArea(newAreaName); // assert finalList = manager.ListAreas(); fullExpectedPathExists = manager.CheckIfPathAlreadyExists(newAreaName); } int expectedRoot = initialList.Count + 1; int actualRoot = finalList.Count; // check root level Area count Assert.AreEqual(expectedRoot, actualRoot); // check newly added top level node has 1 child and that child has 1 child Assert.IsTrue(fullExpectedPathExists); }
public void AddIteration_passingInProjectDetailsWithThreeLevelsOfIterationsAllCompletelyNew_IterationGoesUpByOneOnTopLevelAndTwoLevelsDownAreCreated() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); List <ProjectIteration> initialList; List <ProjectIteration> finalList; bool fullExpectedPathExists = false; using (IIterationManager manager = IterationManagerFactory.GetManager(projectDetail)) { initialList = manager.ListIterations(); string newIterationName = "Top Level " + GetRandomGuid() + "\\Level Two\\Level Three"; DateTime?startDate = DateTime.Now; DateTime?endDate = DateTime.Now.AddDays(10); // act manager.AddNewIteration(newIterationName, startDate, endDate); // assert finalList = manager.ListIterations(); fullExpectedPathExists = manager.CheckIfPathAlreadyExists(newIterationName); } int expectedRoot = initialList.Count + 1; int actualRoot = finalList.Count; // check root level iteration count Assert.AreEqual(expectedRoot, actualRoot); // check newly added top level node has 1 child and that child has 1 child Assert.IsTrue(fullExpectedPathExists); }
public ProjectDetail GetProjectDetails(string code) { var connection = new OracleConnection { ConnectionString = Constants.ConnectionString }; ProjectDetail projectDetails = null; string commText = "APR_PROJECT_HYPOTHESIS_K.Get_PROJECT_DETAILS_p"; OracleCommand cmd = new OracleCommand(commText, connection) { CommandType = CommandType.StoredProcedure }; OracleParameter projectDetailsOracleParameter = cmd.Parameters.Add("PROJECT_DETAILS", OracleDbType.RefCursor, ParameterDirection.Output); OracleParameter projectCodeOracleParameter = cmd.Parameters.Add("CODE", OracleDbType.Varchar2, ParameterDirection.Input); projectCodeOracleParameter.Value = code; connection.Open(); cmd.ExecuteNonQuery(); var myReader = ((OracleRefCursor)projectDetailsOracleParameter.Value).GetDataReader(); while (myReader.Read()) { projectDetails = new ProjectDetail() { PROJECT_NAME = myReader[0].ToString(), PROJECT_STATUS = myReader[1].ToString(), PROJECT_INDICATIONS_CODE = myReader[2].ToString(), INITIATING_PROJECTCODE = myReader[3].ToString(), PROJECT_TYPE_LABEL = myReader[4].ToString() }; } connection.Close(); return(projectDetails); }
public void AddIteration_passingInProjectDetails_IterationCountGoesUpByOne() { // arrange ProjectDetail projectDetail = this.CreateProjectDetail(); List <ProjectIteration> initialList; List <ProjectIteration> finalList; IIterationManager manager = IterationManagerFactory.GetManager(projectDetail); initialList = manager.ListIterations(); string newIterationName = "Iteration " + GetRandomGuid(); DateTime?startDate = DateTime.Now; DateTime?endDate = DateTime.Now.AddDays(10); // act manager.AddNewIteration(newIterationName, startDate, endDate); // assert finalList = manager.ListIterations(); int expected = initialList.Count + 1; int actual = finalList.Count; Assert.AreEqual(expected, actual); manager.Dispose(); }
public ActionResult Project(Project pr) { List <string> l = new List <string>(); l.Add("Home"); l.Add("Project"); List <string> l2 = new List <string>(); l2.Add("/Home"); l2.Add("/Home/Index"); ProjectDetail p = new ProjectDetail(); using (ISession session = Data.OpenSession()) { using (ITransaction tx = session.BeginTransaction()) { session.SaveOrUpdate(pr); p.Proj = pr; p.ProjectTypes = session.CreateCriteria <ProjectType>().SetMaxResults(1000).List <ProjectType>(); p.Departments = session.CreateCriteria <Grouping>().SetMaxResults(1000).List <Grouping>(); l.Add(p.Proj.ProjectName); l2.Add("/Home/Project/" + pr.ProjectId); } } p.Header = getHeaderInfo(l, l2, "Project Details", "Hi"); return(View(p)); }
public ActionResult Project(int Id) { List <string> l = new List <string>(); l.Add("Home"); l.Add("Project"); List <string> l2 = new List <string>(); l2.Add("/Home"); l2.Add("/Home/Index"); ProjectDetail p = new ProjectDetail(); using (ISession session = Data.OpenSession()) { using (ITransaction tx = session.BeginTransaction()) { p.Proj = (Project)session.Load(typeof(Project), Id); p.ProjectTypes = session.CreateCriteria <ProjectType>().SetMaxResults(1000).List <ProjectType>(); p.Departments = session.CreateCriteria <Grouping>().SetMaxResults(1000).List <Grouping>(); p.selectedDepartment = (short)p.Proj.ProjectGroupingId; l.Add(p.Proj.ProjectName); l2.Add("/Home/Project/1"); } } p.Header = getHeaderInfo(l, l2, "Project Details", "Hi"); return(View(p)); }
private ProjectDetailVM ConvertToViewModel(ProjectDetail pd) { return(new ProjectDetailVM { ID = pd.ID, LoginID = pd.LoginID, Client = pd.Client, ProjectTitle = pd.ProjectDetails, FromMonth = pd.FromMonth, FromYear = pd.FromMonth, ToMonth = pd.ToMonth, ToYear = pd.ToYear, IsCurrent = pd.IsCurrent, ProjectLocation = pd.ProjectLocation, IsOnsite = pd.IsOnsite, EmploymentType = pd.EmploymentType, ProjectDetails = pd.ProjectDetails, Role = pd.Role, RoleDescription = pd.RoleDescription, TeamSize = pd.TeamSize, SkillsUsed = pd.SkillsUsed, DisplayOrder = pd.DisplayOrder, UpdatedOn = pd.UpdatedOn }); }
private YumlClassDiagram MakeParentDiagram(ProjectDetail projectDetail, bool newlineForEachRelationship) { var classDiagram = new YumlClassDiagram(newlineForEachRelationship); GenerateParentDiagram(projectDetail, classDiagram.Relationships, newlineForEachRelationship); return(classDiagram); }
public async Task <IHttpActionResult> PutProjectDetail(int id, ProjectDetailVM projectDetailVM) { ProjectDetail projectDetail = ConvertToDBModel(projectDetailVM); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != projectDetail.ID) { return(BadRequest()); } db.Entry(projectDetail).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProjectDetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private void AddAreaAndCheckEnabledOnBacklog(string teamName, bool enableForTeam) { // arrange ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail; List <ProjectArea> initialList; List <ProjectArea> finalList; string newAreaName = null; IAreaManager manager = AreaManagerFactory.GetManager(projectDetail); ITeamManager teamManager = TeamManagerFactory.GetManager(projectDetail); initialList = manager.ListAreas(); newAreaName = "Area " + GetRandomGuid(); // act manager.AddNewArea(newAreaName, new List <ITfsTeam> { enableForTeam?teamManager.GetTfsTeam(teamName) : null }); // assert finalList = manager.ListAreas(); int expected = initialList.Count + 1; int actual = finalList.Count; Assert.AreEqual(expected, actual); ProjectArea addedItem = (from o in finalList where o.Name == newAreaName select o).FirstOrDefault(); Assert.IsNotNull(addedItem); Assert.AreEqual(enableForTeam, teamManager.GetTfsTeam(teamName).IsAreaPathEnabled(newAreaName)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Session.Add(SessionMgm.PageJumtType, PageJumpType.ASSIGN); Session.Add(SessionMgm.AttachmentProjectID, Request["id"]); if (Session[SessionMgm.Role].ToString().Equals(RoleType.EduAdmin)) { HyperLink1.NavigateUrl = "frmUploadAttachment.aspx?type=1"; } DataClassesDataContext dc = new DataClassesDataContext(); ProjectDetail project = dc.ProjectDetail.SingleOrDefault(_pd => _pd.F_ID.Equals(Request["id"])); if (project != null) { txtCode.Text = project.F_code; txtContent.Text = project.F_content; txtEndDate.Text = project.F_endDate.Value.ToShortDateString(); txtName.Text = project.F_name; txtSource.Text = project.F_source; txtStartDate.Text = project.F_startDate.Value.ToShortDateString(); if (project.F_schoolDeadline != null) { txtDeadLineOfSchool.Text = project.F_schoolDeadline.Value.ToShortDateString(); } } if (Session[SessionMgm.Role].Equals(RoleType.EduAdmin)) { btnConfirm.Visible = true; } } }
public void AddArea_passingInProjectDetailsWithTwoLevelsOfAreas_AreaCountStaysTheSameButTheChildAreaCountOfTheFirstAreaGoesUpByOne() { // arrange ProjectDetail projectDetail = TestConstants.TfsTeamProjectDetail; List <ProjectArea> initialList; ProjectArea initialFirstArea; List <ProjectArea> finalList; ProjectArea finalFirstArea; using (IAreaManager manager = AreaManagerFactory.GetManager(projectDetail)) { initialList = manager.ListAreas(); initialFirstArea = initialList[0]; string newAreaName = initialFirstArea.Name + "\\Area " + GetRandomGuid(); // act manager.AddNewArea(newAreaName); // assert finalList = manager.ListAreas(); finalFirstArea = finalList[0]; } int expectedRoot = initialList.Count; int actualRoot = finalList.Count; // check root level Area count Assert.AreEqual(expectedRoot, actualRoot); int expectedChild = initialFirstArea.Children.Count + 1; int actualChild = finalFirstArea.Children.Count; // check child level Area count Assert.AreEqual(expectedChild, actualChild); }
public async Task <ActionResult <ProjectDetail> > PostProjectDetail(ProjectDetail projectDetail) { _context.ProjectDetails.Add(projectDetail); await _context.SaveChangesAsync(); return(CreatedAtAction("GetProjectDetail", new { id = projectDetail.PMId }, projectDetail)); }
public ActionResult GetProjects(string accountName) { AccountDetail accountDetail = new AccountDetail(); try { if (Convert.ToString(Session["PAT"]) != null) { string token = Convert.ToString(Session["PAT"]); ADOCLProjects projects = new ADOCLProjects(token); ProjectDetail projectDetail = new ProjectDetail(); var getProjectResponse = projects.GetProjects(accountName); projectDetail.ProjectDetails = new List <Value>(); projectDetail.ProjectDetails = JsonConvert.DeserializeObject <List <Value> >(JsonConvert.SerializeObject(getProjectResponse.ResponseAsDynamicObj.value)); return(PartialView("_GetProjects", projectDetail)); } else { return(RedirectToAction("../Account/Verify")); } } catch (Exception) { return(View(accountDetail)); } }
public ActionResult UpdateProjectDetail(int projectId) { if (CheckAuthProjectManager() == 0) { ViewBag.ErrorMessage = "Log in first"; return(RedirectToAction("LogIn", "UserAuthentication")); } else if (CheckAuthProjectManager() == 1) { User user = userManager.GetUserById(Convert.ToInt32(Session["UserId"])); ViewBag.UserName = user.Name; if (projectManager.IsProjectExistsById(projectId)) { ProjectDetail projectDetail = projectManager.GetProjectDetailsById(projectId); ViewBag.Files = projectManager.GetProjectFilesForDropDown(projectId); return(View(projectDetail)); } else { return(HttpNotFound()); } } else { return(HttpNotFound()); } }
public async Task <IActionResult> PutProjectDetail(int id, ProjectDetail projectDetail) { if (id != projectDetail.PMId) { return(BadRequest()); } _context.Entry(projectDetail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProjectDetailExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void TestAddItemWithRelationships() { ContactInformation contactInformation = new ContactInformation() { Phone = "phone", Email = "*****@*****.**" }; Customer customer = new Customer() { Name = "Customer", ContactInformation = contactInformation }; Resource r = new Resource() { ContactInformation = contactInformation, Name = "Demo" }; ProjectDetail projectDetail = new ProjectDetail() { Budget = 1000, Critical = true }; Project p = new Project() { Customer = customer, Name = "Project", Description = "Description", End = DateTime.Now.AddDays(1), ProjectDetail = projectDetail, Start = DateTime.Now }; projectRepository.Add(p); projectRepository.UnitOfWork.Commit(); p.ProjectId.Should().NotBe(0, "User id is zero."); p.ProjectDetail.Project.Should().Be(p); p.Customer.CustomerId.Should().NotBe(0, "Customer id is zero."); }
public async Task <ApiResponse> Handle(AddEditCriteriaEvaluationSubmitCommand request, CancellationToken cancellationToken) { ApiResponse response = new ApiResponse(); // DbContext db = _uow.GetDbContext(); try { ProjectDetail projectDetail = await _dbContext.ProjectDetail .FirstOrDefaultAsync(x => x.ProjectId == request.ProjectId && x.IsDeleted == false); if (projectDetail != null) { projectDetail.IsCriteriaEvaluationSubmit = request.IsCriteriaEvaluationSubmit; projectDetail.ModifiedDate = DateTime.UtcNow; await _dbContext.SaveChangesAsync(); response.StatusCode = StaticResource.successStatusCode; response.CommonId.IsApproved = projectDetail.IsCriteriaEvaluationSubmit.Value; response.Message = "Success"; } else { throw new Exception("Project not found"); } } catch (Exception ex) { response.StatusCode = StaticResource.failStatusCode; response.Message = StaticResource.SomethingWrong + ex.Message; } return(response); }
public async Task <ActionResult <ProjectDetail> > PostCreateProject(ProjectDetail item) { _context.ProjectDetails.Add(item); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetProjectDetail), new { id = item.ProjectId }, item)); }
public async Task <ActionResult> OnPostProject(string name, string supervisor, string company, DateTime start, DateTime end, string summary) { this.Error = null; if (string.IsNullOrEmpty(name)) { this.Error = "Project Name can't be empty."; } if (string.IsNullOrEmpty(supervisor)) { this.Error = "Project Supervisor can't be empty."; } if (string.IsNullOrEmpty(company)) { this.Error = "Project Company can't be empty."; } if (start.Equals(DateTime.MinValue)) { this.Error = "Start Date is invalid."; } if (!DateTime.MinValue.Equals(end) && end.CompareTo(start) < 0) { this.Error = "End Date cannot be after Start Date."; } if (string.IsNullOrEmpty(summary)) { this.Error = "Project Detail can't be empty."; } if (!string.IsNullOrEmpty(this.Error)) { return(OnGet()); } this.CurrentUser = this.GetUser(HttpContext.User.Identity.Name); ProjectDetail projectDetail = new ProjectDetail() { ID = Guid.NewGuid(), Company = company, Supervisor = supervisor, Title = name, StartDate = start, Summary = summary }; if (!DateTime.MinValue.Equals(end)) { projectDetail.EndDate = end; } this.CurrentUser.ProjectDetails.Add(projectDetail); await _context.SaveChangesAsync(); return(Redirect("~/details")); }
public YumlClassOutput Translate(ProjectDetail projectDetail, bool newlineForEachRelationship = false) { Logger.Log("Translating ProjectDetail to YumlClassOutput", LogLevel.High); var parentDiagram = MakeParentDiagram(projectDetail, newlineForEachRelationship); return(new YumlClassOutput(MakeDependenciesDiagram(projectDetail, newlineForEachRelationship), parentDiagram, projectDetail.FullPath)); }
// get project info by guid public ProjectDetail GetProjectInfoByOtherInfo(ProjectDetail projectDetail) { return(Context.ProjectDetails.Where( p => p.ProjectName == projectDetail.ProjectName && p.CodeName == projectDetail.CodeName && p.StartDate == projectDetail.StartDate && p.EndDate == projectDetail.EndDate && p.Status == projectDetail.Status).FirstOrDefault()); }
private static YumlClassWithDetails MakeClass(ProjectDetail projectDetail) { var detailModel = new YumlClassWithDetails(projectDetail.Name); AddDotNetNotes(projectDetail, detailModel); AddCppNotes(projectDetail.CppDetails, detailModel); return(detailModel); }
private void LoadProjectDetail(Project project) { var pd = new ProjectDetail(); pd.DataContext = new ProjectDetailViewModel(project); pd.Show(); }