Example #1
0
 public static string GetProteinText(Protein protein, MatchOption matchOption)
 {
     return(protein != null
         ? ProteinMetadataManager.ProteinModalDisplayText(protein.DocNode.ProteinMetadata,
                                                          MatchOptionToDisplayMode(matchOption))
         : null);
 }
Example #2
0
        public DataImportContainer(DataImportResponse response, XrmRecordService xrmRecordService, Dictionary <string, IEnumerable <string> > altMatchKeyDictionary, IEnumerable <Entity> entities, ServiceRequestController controller, bool includeOwner, bool maskEmails, MatchOption matchOption, bool updateOnly, bool containsExportedConfigFields, int executeMultipleSetSize, int targetCacheLimit)
        {
            Response                     = response;
            XrmRecordService             = xrmRecordService;
            AltMatchKeyDictionary        = altMatchKeyDictionary;
            Controller                   = controller;
            IncludeOwner                 = includeOwner;
            MaskEmails                   = maskEmails;
            MatchOption                  = matchOption;
            UpdateOnly                   = updateOnly;
            ContainsExportedConfigFields = containsExportedConfigFields;
            ExecuteMultipleSetSize       = executeMultipleSetSize;
            _maxCacheCount               = targetCacheLimit;
            EntitiesToImport             = entities;
            var typesToImport = entities.Select(e => e.LogicalName).Distinct();

            var allNNRelationships = XrmService.GetAllNnRelationshipEntityNames();

            AssociationTypesToImport = typesToImport.Where(allNNRelationships.Contains).ToArray();
            EntityTypesToImport      = typesToImport.Where(t => !AssociationTypesToImport.Contains(t)).ToArray();

            IdSwitches = new Dictionary <string, Dictionary <Guid, Guid> >();
            foreach (var item in typesToImport)
            {
                IdSwitches.Add(item, new Dictionary <Guid, Guid>());
            }
        }
Example #3
0
 public StringValue(string value, MatchOption matchOption = MatchOption.ExactMatch, string wildCard = "%")
 {
     if (value != null)
     {
         _values = new object[] { TranslateValue(value, matchOption, wildCard) }
     }
     ;
 }
Example #4
0
        public PDFSearchHandle(PDFTextPage textPage, byte[] findWhatUnicode, int startIndex,
                               MatchOption flags = MatchOption.NONE)
        {
            if (textPage == null)
            {
                throw new NullReferenceException();
            }
            if (startIndex < 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            PDFLibrary.AddRef("PDFSearchHandle");

            m_TextPage = textPage;

            IntPtr unmanagedPointer = Marshal.AllocHGlobal(findWhatUnicode.Length);

            Marshal.Copy(findWhatUnicode, 0, unmanagedPointer, findWhatUnicode.Length);

            m_NativePointer = FPDFText_FindStart(textPage.NativePointer, unmanagedPointer, (int)flags, startIndex);

            Marshal.FreeHGlobal(unmanagedPointer);
        }
Example #5
0
        // We could just cast MatchOption to ProteinDisplayMode because the first 4 enum values correspond to eachother,
        // but this would break if any changes are made to the enums
        private static ProteinMetadataManager.ProteinDisplayMode MatchOptionToDisplayMode(MatchOption matchOption)
        {
            switch (matchOption)
            {
            case MatchOption.ProteinName:
                return(ProteinMetadataManager.ProteinDisplayMode.ByName);

            case MatchOption.ProteinAccession:
                return(ProteinMetadataManager.ProteinDisplayMode.ByAccession);

            case MatchOption.ProteinPreferredName:
                return(ProteinMetadataManager.ProteinDisplayMode.ByPreferredName);

            case MatchOption.ProteinGene:
                return(ProteinMetadataManager.ProteinDisplayMode.ByGene);

            default:
                throw new ArgumentOutOfRangeException("matchOption", matchOption, null);     // Not L10N
            }
        }
Example #6
0
 protected static bool IsNameMatch(MatchOption matchOption)
 {
     return(matchOption >= MatchOption.ProteinName && matchOption <= MatchOption.InChiKey);
 }
Example #7
0
 public Name(string commandName, MatchOption matchOption = MatchOption.PlainText)
 {
     MatchOption = matchOption;
     CommandName = commandName;
 }
        /// <summary>
        /// Найти ячейки по его содержанию
        /// </summary>
        /// <param name="worksheet">Рабочий лист документа в котором ведется поиск</param>
        /// <param name="searchText">Значение которое должно содержать ячейка</param>
        /// <returns>Ячейки содержание которых совпадает с указанным значением</returns>
        public static IEnumerable <Cell> FindCells(this Worksheet worksheet, string searchText, MatchOption match = MatchOption.Contains)
        {
            Func <string, string, bool> matchDeleg;

            switch (match)
            {
            default:
                throw new NotImplementedException();

            case MatchOption.Contains:
                matchDeleg = (_cellText, _searchTxt) => { return(_cellText.Contains(_searchTxt)); };
                break;

            case MatchOption.Equals:
                matchDeleg = (_cellText, _searchTxt) => { return(_cellText.Equals(_searchTxt)); };
                break;

            case MatchOption.StartsWith:
                matchDeleg = (_cellText, _searchTxt) => { return(_cellText.StartsWith(_searchTxt)); };
                break;

            case MatchOption.EndsWith:
                matchDeleg = (_cellText, _searchTxt) => { return(_cellText.EndsWith(_searchTxt)); };
                break;
            }
            return(worksheet.Descendants <Cell>().Where(c => { var val = c.GetValue(); return val != null && matchDeleg(val, searchText); }));
        }