Exemplo n.º 1
0
        private static Dictionary <SearchDocType, List <Guid> > get_existing_ids(Guid applicationId,
                                                                                 List <SearchDoc> docs, ref List <DocFileInfo> files)
        {
            Dictionary <SearchDocType, List <Guid> > ids = new Dictionary <SearchDocType, List <Guid> >();

            ids[SearchDocType.Node] = CNController.get_existing_node_ids(applicationId,
                                                                         docs.Where(u => u.SearchDocType == SearchDocType.Node).Select(v => v.ID).ToList(), true, false);

            ids[SearchDocType.NodeType] = CNController.get_existing_node_type_ids(applicationId,
                                                                                  docs.Where(u => u.SearchDocType == SearchDocType.NodeType).Select(v => v.ID).ToList(), false);

            ids[SearchDocType.Question] = QAController.get_existing_question_ids(applicationId,
                                                                                 docs.Where(u => u.SearchDocType == SearchDocType.Question).Select(v => v.ID).ToList());

            ids[SearchDocType.User] = UsersController.get_approved_user_ids(applicationId,
                                                                            docs.Where(u => u.SearchDocType == SearchDocType.User).Select(v => v.ID).ToList());

            //Files
            List <DocFileInfo> newFiles = DocumentsController.get_file_owner_nodes(applicationId,
                                                                                   docs.Where(u => u.SearchDocType == SearchDocType.File).Select(v => v.ID).ToList())
                                          .Where(u => u.FileID.HasValue).ToList();

            ids[SearchDocType.File] = newFiles.Select(v => v.FileID.Value).ToList();

            foreach (DocFileInfo f in newFiles)
            {
                if (!files.Any(u => u.FileID == f.FileID))
                {
                    files.Add(f);
                }
            }
            //end of Files

            return(ids);
        }