Пример #1
0
 public new static void SearchDoc(string fileName, SwDocType swDocType, out List<FindedDocuments> fileList, string vaultName)
 {
     SwEpdm.EpdmSearch.SearchDoc(fileName, swDocType, out fileList, vaultName);
 }
Пример #2
0
            public static void SearchDoc(string fileName, SwDocType swDocType, out List<FindedDocuments> fileList, string vaultName)
            {
                var files = new List<FindedDocuments>();
                try
                {                  
                    var edmVault7 = (IEdmVault7)edmVault5;
                    
                    //Search for all text files in the edmVault7
                    var edmSearch5 = (IEdmSearch5)edmVault7.CreateUtility(EdmUtility.EdmUtil_Search);

                    var extenison = "";
                    var like = "";

                    switch ((int)swDocType)
                    {
                        case 0:
                            extenison = "";
                            like = "";
                            break;
                        case 1:
                            like = "%";
                            extenison = ".sldprt";
                            break;
                        case 2:
                            like = "%";
                            extenison = "%.sldasm";
                            break;
                        case 3:
                            like = "%";
                            extenison = "%.slddrw";
                            break;
                        case 4:
                            like = "%";
                            extenison = "%.%";
                            break;
                    }
                    edmSearch5.FileName = like + fileName + extenison;

                    var edmSearchResult5 = edmSearch5.GetFirstResult();

                    while (edmSearchResult5 != null)
                    {
                        files.Add(new FindedDocuments
                            {
                                PartIdPdm = edmSearchResult5.ID,
                                PartName = edmSearchResult5.Name,
                                PartSize = edmSearchResult5.FileSize,
                                ProjectId = edmSearchResult5.ParentFolderID,
                                Path = edmSearchResult5.Path,
                                Time = (DateTime)edmSearchResult5.FileDate
                            });
                        edmSearchResult5 = edmSearch5.GetNextResult();
                    }

                    if (edmSearch5.GetFirstResult() == null)
                    {
                        //LoggerInfo("Файл не найден!");
                        files = null;
                    }
                }

                catch (Exception exception)
                {
                    Логгер.Ошибка($"Message - {exception.Message}\nStackTrace - {exception.StackTrace}", null, "SearchDoc", "SwEpdm");
                    //MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
                }
                fileList = files;
            }
Пример #3
0
 public new static void SearchDoc(string fileName, SwDocType swDocType, out List <FindedDocuments> fileList, string vaultName)
 {
     SwEpdm.EpdmSearch.SearchDoc(fileName, swDocType, out fileList, vaultName);
 }
Пример #4
0
            public static void SearchDoc(string fileName, SwDocType swDocType, out List <FindedDocuments> fileList, string vaultName)
            {
                var files = new List <FindedDocuments>();

                try
                {
                    var edmVault7 = (IEdmVault7)edmVault5;

                    //Search for all text files in the edmVault7
                    var edmSearch5 = (IEdmSearch5)edmVault7.CreateUtility(EdmUtility.EdmUtil_Search);

                    var extenison = "";
                    var like      = "";

                    switch ((int)swDocType)
                    {
                    case 0:
                        extenison = "";
                        like      = "";
                        break;

                    case 1:
                        like      = "%";
                        extenison = ".sldprt";
                        break;

                    case 2:
                        like      = "%";
                        extenison = "%.sldasm";
                        break;

                    case 3:
                        like      = "%";
                        extenison = "%.slddrw";
                        break;

                    case 4:
                        like      = "%";
                        extenison = "%.%";
                        break;
                    }
                    edmSearch5.FileName = like + fileName + extenison;

                    var edmSearchResult5 = edmSearch5.GetFirstResult();

                    while (edmSearchResult5 != null)
                    {
                        files.Add(new FindedDocuments
                        {
                            PartIdPdm = edmSearchResult5.ID,
                            PartName  = edmSearchResult5.Name,
                            PartSize  = edmSearchResult5.FileSize,
                            ProjectId = edmSearchResult5.ParentFolderID,
                            Path      = edmSearchResult5.Path,
                            Time      = (DateTime)edmSearchResult5.FileDate
                        });
                        edmSearchResult5 = edmSearch5.GetNextResult();
                    }

                    if (edmSearch5.GetFirstResult() == null)
                    {
                        //LoggerInfo("Файл не найден!");
                        files = null;
                    }
                }

                catch (Exception exception)
                {
                    Логгер.Ошибка($"Message - {exception.Message}\nStackTrace - {exception.StackTrace}", null, "SearchDoc", "SwEpdm");
                    //MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
                }
                fileList = files;
            }