private void AddToIndex(Project project, IndexWriter writer) { var searchQuery = new TermQuery(new Term(SearchingFields.Id.ToString(), project.Id.ToString())); writer.DeleteDocuments(searchQuery); var doc = new Document(); doc.Add(new Field(SearchingFields.Id.ToString(), project.Id.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED)); doc.Add(new Field(SearchingFields.Name.ToString(), project.Title, Field.Store.YES, Field.Index.ANALYZED)); writer.AddDocument(doc); }
public void AddToIndex(Project project) { AddToIndex(new List<Project> { project }); }
public void UpdateIndex(Project project) { DeleteIndex(project.Id); AddToIndex(project); }
public void Save(int creatorId) { var project = new Project { Id = ProjectId, Title = Title, Details = Details, CreatorId = creatorId, DateOfChange = DateTime.Today }; //if (project.Id == 0) //{ // if (new ProjectManagementService().GetProjects().Count(e => e.Title == project.Title) != 0) // { // } //} //else //{ // if ( // new ProjectManagementService().GetProjects() // .Count(e => e.Title == project.Title && e.Id != project.Id) != 0) // { // } // else // { ProjectManagementService.SaveProject(project); if (ProjectId == 0) { ProjectManagementService.AssingRole(new ProjectUser { UserId = creatorId, ProjectId = project.Id, ProjectRoleId = 3 }); } // } //} }
public void SetParams(Project model) { Title = model.Title; CreationDate = model.DateOfChange; Details = model.Details ?? string.Empty; GetCreatorName(model.CreatorId); SetBugStatistics(ProjectId); }
public void UpdateProject(Project project) { using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { repositoriesContainer.ProjectsRepository.Save(project); repositoriesContainer.ApplyChanges(); } }
public Project SaveProject(Project project) { using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { repositoriesContainer.ProjectsRepository.Save(project); repositoriesContainer.ApplyChanges(); } return project; }
public Project SaveProject(Project project) { using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { repositoriesContainer.ProjectsRepository.Save(project); repositoriesContainer.ApplyChanges(); } new ProjectSearchMethod().AddToIndex(project); return project; }
public ProjectListViewModel FromProject(Project project) { var context = new LmPlatformModelsContext(); var isAssigned = false; foreach (var user in context.ProjectUsers) { if (user.ProjectId == project.Id && user.UserId == WebSecurity.CurrentUserId) { isAssigned = true; } } var _context = new ProjectManagementService(); var creatorId = project.Creator.Id; return new ProjectListViewModel { Id = project.Id, Title = string.Format("<a href=\"{0}\">{1}</a>", Url.Action("ProjectManagement", "BTS", new { id = project.Id }), project.Title), CreatorName = _context.GetCreatorName(creatorId), CreationDate = project.DateOfChange.ToShortDateString(), UserQuentity = _context.GetProjectUsers(project.Id).Count, IsAssigned = isAssigned }; }
public ProjectListViewModel FromProject(Project project, string htmlLinks) { var model = FromProject(project); model.Action = new HtmlString(htmlLinks); return model; }