private static bool SetMatches(CardSet set, string name, SearchTypes searchTypes, bool caseSensitive = false)
    {
      var setName = caseSensitive
        ? set.Name
        : set.Name.ToLower();

      var promptName = caseSensitive
        ? name
        : name.ToLower();

      switch (searchTypes)
      {
        case SearchTypes.StartsWith:
          return setName.StartsWith(promptName);

        case SearchTypes.EndsWith:
          return setName.EndsWith(promptName);

        case SearchTypes.Equals:
          return setName == promptName;

        case SearchTypes.Contains:
        default:
          return setName.Contains(promptName);
      }
    }
Example #2
0
 /// <summary>
 /// Holds search criteria for scheduling log searches
 /// </summary>
 /// <param name="player"></param>
 /// <param name="gamelogtype"></param>
 /// <param name="timefrom"></param>
 /// <param name="timeto"></param>
 /// <param name="searchkey">null or empty string to indicate this requires no match search</param>
 /// <param name="searchtype"></param>
 internal SearchData(string player, GameLogTypes gamelogtype, DateTime timefrom, DateTime timeto, string searchkey, SearchTypes searchtype)
 {
     this.Player = player;
     this.GameLogType = gamelogtype;
     this.TimeFrom = timefrom;
     this.TimeTo = timeto;
     if (searchkey != null) this.SearchKey = searchkey;
     else this.SearchKey = "";
     this.SearchType = searchtype;
 }
Example #3
0
 private string SearchTypesToString(SearchTypes T)
 {
     string type = "ssdp:all";
     switch (T)
     {
         case SearchTypes.rootdevice:
             type = "upnp:rootdevice";
             break;
         case SearchTypes.InternetGatewayDevice:
             type = "urn:schemas-upnp-org:device:InternetGatewayDevice:1";
             break;
         case SearchTypes.MediaServer:
             type = "urn:schemas-upnp-org:device:MediaServer:1";
             break;
         case SearchTypes.MediaRenderer:
             type = "urn:schemas-upnp-org:device:MediaRenderer:1";
             break;
         default:
             break;
     }
     return type;
 }
Example #4
0
 public bool HasMultivaluedSearchType()
 {
     return(GetAllFields().Select(f => f.SearchType).Distinct().Any(st => SearchTypes.First(s => s.Name == st).MultiValued));
 }
Example #5
0
 public static List <string> Split(string line, string delimiter, SearchTypes search, bool trim)
 {
     return(Split(line, delimiter, search, MatchTypes.WordOnly, STRINGQUOTE, trim));
 }
Example #6
0
 public static Match NextMatch(string line, string pattern, SearchTypes search, MatchTypes validMatch = MatchTypes.WordOnly, string seqdelim = STRINGQUOTE)
 {
     return(NextMatch(line, pattern, 0, search, validMatch, seqdelim));
 }
Example #7
0
 /// <summary>
 /// Set the search criteria
 /// </summary>
 /// <param name="player">Player name, case sensitive</param>
 /// <param name="gamelogtype">Type of the log</param>
 /// <param name="timefrom">Begin date boundary</param>
 /// <param name="timeto">End date boundary</param>
 /// <param name="searchkey">Text to search for, or regex expression for regex search type</param>
 /// <param name="searchtype">Search type</param>
 /// <param name="PM_recipient">
 /// In case this is PM-log search criteria, this should be the PM recipient name.
 /// Not supplying this value will result in a general PM search trough all conversations.
 /// </param>
 public void SetSearchCriteria(string player, GameLogTypes gamelogtype, DateTime timefrom, DateTime timeto, string searchkey, SearchTypes searchtype, string PM_recipient = null)
 {
     SearchCriteria = new SearchData(player, gamelogtype, timefrom, timeto, searchkey, searchtype);
     if (PM_recipient != null) this.SetPM_Player(PM_recipient);
 }
Example #8
0
 public void setSearchType(SearchTypes type)
 {
     searchType = type;
 }
 /// <summary>
 /// Obtiene el texto de un control.
 /// </summary>
 /// <param name="searchString">Texto con el que se busca el Elemento.</param>
 /// <param name="searchType">Tipo de búsqueda.</param>
 /// <returns>Retorna el texto del control.</returns>
 public string GetText(string searchString, SearchTypes searchType)
 {
     return(FindElement(searchString, searchType).GetAttribute("value"));
 }
Example #10
0
 private void button4_Click(object sender, EventArgs e)
 {
     // Alles weergeven
     CurrentSearchType = SearchTypes.DEFAULT;
     plot();
 }
Example #11
0
        public void setSession(Session s)
        {
            this.session = s;

            CurrentSearchType = SearchTypes.DEFAULT;
            plot();
        }
Example #12
0
 public static string GetNameForSearchType(SearchTypes type)
 {
     return EnumToNameMap[type];
 }
Example #13
0
        /// <summary>
        ///     Executes an advanced search using pagination, sorting, filters, facets, and highlighting.
        /// </summary>
        /// <param name="searchText">The text used for the search. When empty all results are returned.</param>
        /// <param name="totalRecords">The returned total number of records in the results</param>
        /// <param name="currentPage">The current page of results to return</param>
        /// <param name="pageSize">The size of the result set to return (default=20). Maximum is 1000.</param>
        /// <param name="filter">
        ///     A set of comma or semicolon separated field names to searching.
        ///     Only fields marked with the 'IsSearchable' attribute can be included.
        ///     The default is empty and all searchable fields will be searched.
        ///     ///
        /// </param>
        /// <param name="selectFields"></param>
        /// A set of comma or semicolon separated field names to return values for.
        /// Default is empty and will return all field values
        /// <param name="orderBy">
        ///     A set of comma or semicolon separated sort terms.
        ///     Default is empty and will return results sorted by score relevance.
        ///     For example, OrganisationName, SicName DESC
        ///     Only fields marked with the 'IsSortable' attribute can be included.
        /// </param>
        /// <param name="facets">
        ///     Specifies the facets to query and returns the facet results
        ///     The default is empty and no facets will be applied.
        ///     Only fields marked with the 'IsFacetable' attribute can be included.
        ///     Call by specifing field names as keys in the dictionary.
        ///     The resulting dictionary for each field returns all possible values and their count for that field.
        ///     ///
        /// </param>
        /// <param name="filter">
        ///     A filter expression using OData syntax (see
        ///     https://docs.microsoft.com/en-us/rest/api/searchservice/odata-expression-syntax-for-azure-search)
        ///     The default is empty and no filter will be applied.
        ///     Only fields marked with the 'IsFilterable' attribute can be included.
        ///     String comparisons are case sensitive.
        ///     You can also use the operators '==','!=', '>=', '>', '<=', '<', '&&', '||' which will be automatically replaced with OData counterparts 'EQ','NE', 'GE', 'GT', 'LE', 'LT', 'AND', 'OR'.
        /// Special functions also include search.in(myfield, 'a, b, c')
        /// /// </param>
        /// <param name="highlights">
        ///     A set of comma or semicolon separated field names used for hit highlights.
        ///     Only fields marked with the 'IsSearchable' attribute can be included.
        ///     By default, Azure Search returns up to 5 highlights per field.
        ///     The limit is configurable per field by appending -
        ///     <max # of highlights>
        ///         following the field name.
        ///         For example, highlight=title-3,description-10 returns up to 3 highlighted hits from the title field and up to
        ///         10 hits from the description field. <max # of highlights> must be an integer between 1 and 1000 inclusive.
        /// </param>
        public async Task <PagedResult <SicCodeSearchModel> > SearchAsync(string searchText,
                                                                          int currentPage,
                                                                          SearchTypes searchType,
                                                                          int pageSize        = 20,
                                                                          string searchFields = null,
                                                                          string selectFields = null,
                                                                          string orderBy      = null,
                                                                          Dictionary <string, Dictionary <object, long> > facets = null,
                                                                          string filter          = null,
                                                                          string highlights      = null,
                                                                          SearchModes searchMode = SearchModes.Any)
        {
            // Execute search based on query string
            var sp = new SearchParameters
            {
                SearchMode = (SearchMode)searchMode,
                Top        = pageSize,
                Skip       = (currentPage - 1) * pageSize,
                IncludeTotalResultCount = true,
                QueryType = QueryType.Simple
            };

            //Specify the fields to search
            if (!string.IsNullOrWhiteSpace(searchFields))
            {
                sp.SearchFields = searchFields.SplitI().ToList();
            }

            //Limit result fields
            if (!string.IsNullOrWhiteSpace(selectFields))
            {
                sp.Select = selectFields.SplitI().ToList();
            }

            // Define the sort type or order by relevance score
            if (!string.IsNullOrWhiteSpace(orderBy) && !orderBy.EqualsI("Relevance", "Relevance desc", "Relevance asc"))
            {
                sp.OrderBy = orderBy.SplitI().ToList();
            }

            // Add filtering
            sp.Filter = string.IsNullOrWhiteSpace(filter) ? null : filter;

            //Add facets
            if (facets != null && facets.Count > 0)
            {
                sp.Facets = facets.Keys.ToList();
            }

            //Execute the search
            var searchIndexClient = await _searchIndexClient.Value;
            var results           = searchIndexClient.Documents.Search <SicCodeSearchModel>(searchText, sp);

            //Return the total records
            var totalRecords = results.Count.Value;

            /* There are too many empty searches being executed (about 1200). This needs further investigation to see if/how they can be reduced */
            if (!string.IsNullOrEmpty(searchText))
            {
                var telemetryProperties = new Dictionary <string, string>
                {
                    { "TimeStamp", VirtualDateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") },
                    { "QueryTerms", searchText },
                    { "ResultCount", totalRecords.ToString() },
                    { "Top", sp.Top.ToString() },
                    { "Skip", sp.Skip.ToString() }
                };

                _telemetryClient?.TrackEvent("Gpg_Search", telemetryProperties);

                await SearchLog.WriteAsync(telemetryProperties);
            }

            //Return the facet results
            if (sp.Facets != null && sp.Facets.Any())
            {
                foreach (var facetGroupKey in results.Facets.Keys)
                {
                    if (facets[facetGroupKey] == null)
                    {
                        facets[facetGroupKey] = new Dictionary <object, long>();
                    }

                    foreach (var facetResult in results.Facets[facetGroupKey])
                    {
                        facets[facetGroupKey][facetResult.Value] = facetResult.Count.Value;
                    }
                }
            }

            //Return the results
            var searchResults = new PagedResult <SicCodeSearchModel>
            {
                Results            = results.Results.Select(r => r.Document).ToList(),
                CurrentPage        = currentPage,
                PageSize           = pageSize,
                ActualRecordTotal  = totalRecords,
                VirtualRecordTotal = totalRecords
            };

            return(searchResults);
        }
        public SearchType GetSearchTypeForFile(string validFile)
        {
            String extension = Path.GetExtension(validFile);

            return(SearchTypes.SingleOrDefault(s => String.Compare(extension, s.Extension, true) == 0));
        }
Example #15
0
 public SearchType(SearchTypes type, string name)
 {
     Type = type;
     Name = name;
 }
Example #16
0
        public async Task <PagedResultOutput <APHeaderTransactionsUnitDto> > GetAPHeaderTransactionUnits(SearchInputDto input)
        {
            bool unPosted = false;
            var  query    = from invoices in _apHeaderTransactionsUnitRepository.GetAll()
                            join user in _userUnitRepository.GetAll() on invoices.CreatorUserId equals user.Id
                            into users
                            from userunits in users.DefaultIfEmpty()
                            join pcaccount in _pettyCashAccountUnitRepository.GetAll() on invoices.PettyCashAccountId equals pcaccount.Id
                            into pcaccountunit
                            from pcaccountunits in pcaccountunit.DefaultIfEmpty()
                            join account in _accountUnitRepository.GetAll() on pcaccountunits.AccountId equals account.Id
                            into accountunit
                            from accountunits in accountunit.DefaultIfEmpty()
                            join paymentterms in _vendorPaymentTermUnitRepository.GetAll() on invoices.PaymentTermId equals paymentterms.Id
                            into paymenttermsunit
                            from paymenttermunits in paymenttermsunit.DefaultIfEmpty()
                            join batch in _batchUnitRepository.GetAll() on invoices.BatchId equals batch.Id
                            into batchunit
                            from batchunits in batchunit.DefaultIfEmpty()
                            join vendor in _vendorUnitRepository.GetAll() on invoices.VendorId equals vendor.Id
                            into vendorunit
                            from vendors in vendorunit.DefaultIfEmpty()
                            join bankaccount in _bankAccountUnitRepository.GetAll() on invoices.BankAccountId equals bankaccount.Id
                            into bankaccountunit
                            from bankaccounts in bankaccountunit.DefaultIfEmpty()
                            select new
            {
                Invoices         = invoices,
                BatchName        = batchunits.Description,
                VendorName       = vendors.LastName,
                CreatedUser      = userunits.UserName,
                PaymentTerm      = paymenttermunits.Description,
                BankAccount      = bankaccounts.BankAccountNumber,
                PettyCashAccount = accountunits.Caption
            };

            if (!ReferenceEquals(input.Filters, null))
            {
                SearchTypes mapSearchFilters = Helper.MappingFilters(input.Filters);
                if (!ReferenceEquals(mapSearchFilters, null))
                {
                    query = query.CreateFilters(mapSearchFilters);
                }
            }
            query = query
                    .Where(u => u.Invoices.TypeOfAccountingDocumentId == TypeOfAccountingDocument.AccountsPayable &&
                           u.Invoices.IsPosted == unPosted);


            var resultCount = await query.CountAsync();

            var results = await query
                          .AsNoTracking()
                          .OrderBy(Helper.GetSort("Invoices.Description ASC", input.Sorting))
                          .PageBy(input)
                          .ToListAsync();


            return(new PagedResultOutput <APHeaderTransactionsUnitDto>(resultCount, results.Select(item =>
            {
                var dto = item.Invoices.MapTo <APHeaderTransactionsUnitDto>();
                dto.BatchName = item.BatchName;
                dto.VendorName = item.VendorName;
                dto.CreatedUser = item.CreatedUser;
                dto.PaymentTerm = item.PaymentTerm;
                dto.BankAccount = item.BankAccount;
                dto.PettyCashAccount = item.PettyCashAccount;
                dto.TypeOfCheckGroup = item.Invoices.TypeOfCheckGroupId != null ? item.Invoices.TypeOfCheckGroupId.ToDisplayName() : "";
                dto.TypeOfInvoice = item.Invoices.TypeOfInvoiceId.ToDisplayName();
                dto.AccountingDocumentId = item.Invoices.Id;
                return dto;
            }).ToList()));
        }
Example #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bool   saveSearch = false;
        string searchText = string.Empty;

        //get the text in the search box
        searchBox = (TextBox)FindControl("ctl00$txtSearchBox");

        //validate page vars
        PageVariablesCollection vars = new PageVariablesCollection();

        vars.Add(new RequestVariable("p", typeof(int), false));
        vars.Add(new RequestVariable("founderId", typeof(int), false));
        vars.Add(new RequestVariable("searchType", typeof(SearchTypes), true));
        vars.Add(new RequestVariable("sort", typeof(bool), false));

        Page.ValidateVariables(vars);

        //the page variable (browsing pages with a result set)
        //_searchType = (SearchTypes)Enum.Parse(typeof(SearchTypes), vars["type"].Value.ToString());
        _searchType = (SearchTypes)vars["searchType"].Value;
        _sort       = vars["sort"].HasValue ? (bool)vars["sort"].Value : false;

        //check for page variable
        if (vars["p"].HasValue)
        {
            _page = (int)vars["p"].Value;
        }


        switch (_searchType)
        {
        case SearchTypes.Founders:

            //check to see if a founderId is supplied (i.e. the search is for all things related to a founder)
            if (vars["founderId"].HasValue)
            {
                _founderId = (int)vars["founderId"].Value;
            }

            //load founder quotes
            LoadQuotesByFounder(_founderId);

            PanelFounder.Visible = true;
            PanelFounderQuotesSummary.Visible = true;
            PanelSearchSummary.Visible        = false;

            break;

        case SearchTypes.Quotes:
            //upon search postback (the user searched in the search box from this page)
            if (IsPostBack)
            {
                this.SearchQuotes(searchBox.Text, true);
            }
            //the request is an initial one, or from another page
            else
            {
                //a supplied search string was given
                if (Request.QueryString["SearchText"] != null)
                {
                    //find out if this was a custom search
                    if (Request.QueryString["Custom"] != null)
                    {
                        saveSearch = (Request.QueryString["Custom"] == "true") ? true : false;
                    }

                    //search
                    this.SearchQuotes(Request.QueryString["SearchText"], saveSearch);
                }
                //no search string -- redirect back to home
                else
                {
                    Response.Redirect("Default.aspx");
                }
            }
            break;

        case SearchTypes.Documents:
            //do nothing
            break;
        }
    }
Example #18
0
        public static Search Create(SearchTypes type)
        {
            ConsensusSite site = ConsensusDomain.Configuration[ConsensusDomain.Configuration.DefaultSite];

            return(Search.Create(site, type));
        }
Example #19
0
        public IEnumerable <Post> Search(SearchTypes search)
        {
            var data      = Read();
            var blogQuery = data.OfType <Post>();

            switch (search)
            {
            case SearchTypes.SearchByBlogName:
                Menu.displayMessage("Enter a Blog Name");
                var blogName = Menu.getStringInput();

                var SearchByBlogName = blogQuery
                                       .Where(p => p.Blog.Name.Contains(blogName));
                if (SearchByBlogName is IEnumerable <Post> )
                {
                    return(SearchByBlogName);
                }
                else
                {
                    Menu.displayMessage("Could not find blog");
                    return(blogQuery);
                }

            case SearchTypes.SearchByBlogId:
                Menu.displayMessage("Enter a Blog Id");
                var blogId = Menu.getIntInput();

                var SearchByBlogId = blogQuery
                                     .Where(p => p.BlogId.Equals(blogId));
                if (SearchByBlogId is IEnumerable <Post> )
                {
                    return(SearchByBlogId);
                }
                else
                {
                    Menu.displayMessage("Could not find blog");
                    return(blogQuery);
                }


            case SearchTypes.SearchByPostId:
                Menu.displayMessage("Enter a Post Id");
                var postId         = Menu.getIntInput();
                var SearchByPostId = blogQuery
                                     .Where(p => p.PostID.Equals(postId));
                if (SearchByPostId is IEnumerable <Post> )
                {
                    return(SearchByPostId);
                }
                else
                {
                    Menu.displayMessage("Could not find blog");
                    return(blogQuery);
                }

            case SearchTypes.SearchByPostTitle:
                Menu.displayMessage("Enter a Post Title");
                var postTitle         = Menu.getStringInput();
                var SearchByPostTitle = blogQuery
                                        .Where(p => p.Title.Contains(postTitle));
                if (SearchByPostTitle is IEnumerable <Post> )
                {
                    return(SearchByPostTitle);
                }
                else
                {
                    Menu.displayMessage("Could not find blog");
                    return(blogQuery);
                }

            case SearchTypes.SearchByPostContent:
                Menu.displayMessage("Enter a Post Title");
                var postContent         = Menu.getStringInput();
                var SearchByPostContent = blogQuery
                                          .Where(p => p.Content.Contains(postContent));
                if (SearchByPostContent is IEnumerable <Post> )
                {
                    return(SearchByPostContent);
                }
                else
                {
                    Menu.displayMessage("Could not find blog");
                    return(blogQuery);
                }

            case SearchTypes.SearchError:
                Menu.displayMessage("Could not Determine Search Type");
                return(blogQuery);

            default:
                return(blogQuery);
            }
        }
Example #20
0
 public void Start(SearchTypes T)
 {
     SSniffer.Search(SearchTypesToString(T));
 }
        public void Browse()
        {
            SearchTypes searchType = Menu.getSearchType();

            Menu.displayBlogs(Search(searchType));
        }
Example #22
0
 public static Match LastMatchWordOnly(string line, string pattern, int start, SearchTypes search, string seqdelim = STRINGQUOTE)
 {
     return(NextMatchWordOnly(line, pattern, start, search, -1, StopDecrementingAt, SubstringBackward, closer, opener, RegexOptions.RightToLeft, seqdelim));
 }
        public Blog Find(SearchTypes search)
        {
            var data      = Read();
            var blogQuery = data.OfType <Blog>();

            switch (search)
            {
            case SearchTypes.SearchByBlogName:
                Menu.displayMessage("Enter a Blog Name");
                var blogName = Menu.getStringInput();

                var SearchByBlogName = blogQuery
                                       .Where(b => b.Name.Contains(blogName))
                                       .FirstOrDefault();
                if (SearchByBlogName is Blog)
                {
                    return(SearchByBlogName);
                }
                else
                {
                    Menu.displayMessage("Could not find blog");
                    return(blogQuery.Single());
                }

            case SearchTypes.SearchByBlogId:
                Menu.displayMessage("Enter a Blog Id");
                var blogId = Menu.getIntInput();

                var SearchByBlogId = blogQuery
                                     .Where(b => b.BlogId.Equals(blogId))
                                     .FirstOrDefault();
                if (SearchByBlogId is Blog)
                {
                    return(SearchByBlogId);
                }
                else
                {
                    Menu.displayMessage("Could not find blog");
                    return(blogQuery.Single());
                }


            case SearchTypes.SearchByPostId:
                Menu.displayMessage("Enter a Post Id");
                var postId         = Menu.getIntInput();
                var SearchByPostId = blogQuery
                                     .Where(b => b.Posts.Exists(p => p.PostID.Equals(postId)))
                                     .FirstOrDefault();
                if (SearchByPostId is Blog)
                {
                    return(SearchByPostId);
                }
                else
                {
                    Menu.displayMessage("Could not find blog");
                    return(blogQuery.Single());
                }

            case SearchTypes.SearchByPostTitle:
                Menu.displayMessage("Enter a Post Title");
                var postTitle         = Menu.getStringInput();
                var SearchByPostTitle = blogQuery
                                        .Where(b => b.Posts.Exists(p => p.Title.Contains(postTitle)))
                                        .FirstOrDefault();
                if (SearchByPostTitle is Blog)
                {
                    return(SearchByPostTitle);
                }
                else
                {
                    Menu.displayMessage("Could not find blog");
                    return(blogQuery.Single());
                }

            case SearchTypes.SearchByPostContent:
                Menu.displayMessage("Enter a Post Title");
                var postContent         = Menu.getStringInput();
                var SearchByPostContent = blogQuery
                                          .Where(b => b.Posts.Exists(p => p.Content.Contains(postContent)))
                                          .FirstOrDefault();
                if (SearchByPostContent is Blog)
                {
                    return(SearchByPostContent);
                }
                else
                {
                    Menu.displayMessage("Could not find blog");
                    return(blogQuery.Single());
                }

            case SearchTypes.SearchError:
                Menu.displayMessage("Could not Determine Search Type");
                return(blogQuery.Single());

            default:
                return(blogQuery.Single());
            }
        }
Example #24
0
 public static Match LastMatch(string line, string pattern, SearchTypes search, MatchTypes validMatch = MatchTypes.WordOnly, string seqdelim = STRINGQUOTE)
 {
     return(LastMatch(line, pattern, line.Length - 1, search, validMatch, seqdelim));
 }
 public Task <List <SearchFileResult> > SearchFilesAsync(string searchPhrase    = null,
                                                         SearchTypes searchType = SearchTypes.SearchCaseInsensitiveText)
 {
     return(Task.Run(() => SearchFiles(searchPhrase, searchType)));
 }
 public static async Task<CardSet> GetCardSetByNameAsync(this MtgDb.Info.Driver.Db database, string name, SearchTypes searchTypes = SearchTypes.Contains)
 {
   var cardSets = await database.GetCardSetsAsync();
   return cardSets.FirstOrDefault(cs => SetMatches(cs, name, searchTypes));
 }
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="searchType"></param>
 /// <param name="searchString"></param>
 public READ_PublicationBySearch(SearchTypes searchType, string searchString)
 {
     SearchType   = searchType;
     SearchString = searchString;
 }
Example #28
0
 ///<summary>
 ///constructor
 ///</summary>
 ///<param name="searchType"></param>
 protected GraphSearchTimeSliced(SearchTypes searchType, Entity.Bot.BotEntity bot)
 {
     _bot = bot;
     _searchType = searchType;
 }
Example #29
0
        private Type generateNewSearch(Type[] searchArgs, Type branchID, bool?filterBranch)
        {
            branchID = branchID ?? typeof(AccessInfo.branchID);
            SearchParamTypes argsTypes  = 0;
            SearchTypes      searchType = 0;
            var typesDict = new Dictionary <Type, Type>();

            foreach (Type arg in searchArgs)
            {
                if (typeof(IBqlJoin).IsAssignableFrom(arg))
                {
                    typesDict[typeof(IBqlJoin)] = arg;
                    argsTypes |= SearchParamTypes.Join;
                }
                else if (typeof(IBqlWhere).IsAssignableFrom(arg))
                {
                    typesDict[typeof(IBqlWhere)] = arg;
                    argsTypes |= SearchParamTypes.Where;
                }
                else if (typeof(IBqlAggregate).IsAssignableFrom(arg))
                {
                    typesDict[typeof(IBqlAggregate)] = arg;
                    argsTypes |= SearchParamTypes.Aggregate;
                }
                else if (typeof(IBqlOrderBy).IsAssignableFrom(arg))
                {
                    typesDict[typeof(IBqlOrderBy)] = arg;
                    argsTypes |= SearchParamTypes.OrderBy;
                }
            }

            Type newSearch     = null;
            Type newSearchType = null;

            switch (argsTypes & (SearchParamTypes.Aggregate | SearchParamTypes.OrderBy))
            {
            case SearchParamTypes.Aggregate:
                newSearchType = typeof(Search5 <, , ,>);
                searchType    = SearchTypes.Search54;
                break;

            case SearchParamTypes.OrderBy:
                newSearchType = typeof(Search2 <, , ,>);
                searchType    = SearchTypes.Search24;
                break;

            case (SearchParamTypes.Aggregate | SearchParamTypes.OrderBy):
                newSearchType = typeof(Search5 <, , , ,>);
                searchType    = SearchTypes.Search55;
                break;

            case 0:
                newSearchType = typeof(Search2 <, ,>);
                searchType    = SearchTypes.Search23;
                break;
            }

            if (newSearchType != null)
            {
                if (typesDict.ContainsKey(typeof(IBqlJoin)))
                {
                    typesDict[typeof(IBqlJoin)] = BqlCommand.Compose(
                        typeof(InnerJoin <, ,>),
                        typeof(Account),
                        typeof(On <, ,>),
                        typeof(Account.accountID),
                        typeof(Equal <CashAccount.accountID>),
                        typeof(And2 <,>),
                        typeof(Match <Account, Current <AccessInfo.userName> >),
                        typeof(And <>),
                        typeof(Match <,>),
                        typeof(Account),
                        typeof(Optional <>),
                        branchID,
                        typeof(InnerJoin <, ,>),
                        typeof(Sub),
                        typeof(On <Sub.subID, Equal <CashAccount.subID>, And <Match <Sub, Current <AccessInfo.userName> > > >),
                        typesDict[typeof(IBqlJoin)]);
                }
                else
                {
                    typesDict[typeof(IBqlJoin)] = typeof(InnerJoin <Account,
                                                                    On <Account.accountID, Equal <CashAccount.accountID>, And <Match <Account, Current <AccessInfo.userName> > > >,
                                                                    InnerJoin <Sub, On <Sub.subID, Equal <CashAccount.subID>, And <Match <Sub, Current <AccessInfo.userName> > > > > >);
                }

                List <Type> args = new List <Type>
                {
                    typeof(Where2 <,>),
                    typeof(Not <>),
                    typeof(FeatureInstalled <FeaturesSet.branch>),
                    typeof(Or <, ,>),
                    typeof(CashAccount.restrictVisibilityWithBranch),
                    typeof(Equal <>),
                    typeof(False),
                    typeof(Or <,>),
                    typeof(CashAccount.branchID)
                };

                Type[] filterConditions = filterBranch == true ? new Type[] { typeof(Equal <>), typeof(Current <>), branchID }
                                                                                                                           : new Type[] { typeof(IsNotNull) };
                args.AddRange(filterConditions);

                if (typesDict.ContainsKey(typeof(IBqlWhere)))
                {
                    args.Insert(0, typeof(Where2 <,>));
                    args.AddRange(new Type[] { typeof(And <>), typesDict[typeof(IBqlWhere)] });
                }

                typesDict[typeof(IBqlWhere)] = BqlCommand.Compose(args.ToArray());
                var newSearchList = new List <Type> {
                    newSearchType, typeof(CashAccount.cashAccountID), typesDict[typeof(IBqlJoin)], typesDict[typeof(IBqlWhere)]
                };

                if (searchType == SearchTypes.Search54 || searchType == SearchTypes.Search55)
                {
                    newSearchList.Add(typesDict[typeof(IBqlAggregate)]);
                }

                if (searchType == SearchTypes.Search24 || searchType == SearchTypes.Search55)
                {
                    newSearchList.Add(typesDict[typeof(IBqlOrderBy)]);
                }

                newSearch = BqlCommand.Compose(newSearchList.ToArray());
            }
            return(newSearch);
        }
        private List <Invoice> searchInvoices(SearchTypes searchType, SearchFilterTypes filterType)
        {
            //begin - shan - mar 14, 2012 - set default value to be error value (-999)
            //based on that differentiate whether zero has been entered or fields has been left empty
            //while searching based on the amount
            //decimal startAmount = 0;
            //decimal.TryParse(txtStartAmount.Text.Trim(), out startAmount);
            //decimal endAmount = 0;
            //decimal.TryParse(txtEndAmount.Text.Trim(), out endAmount);
            var     invoices    = new List <Invoice>();
            decimal startAmount = -999;
            decimal endAmount   = -999;

            startAmount = decimal.TryParse(txtStartAmount.Text.Trim(), out startAmount) ? startAmount : -999;
            endAmount   = decimal.TryParse(txtEndAmount.Text.Trim(), out endAmount) ? endAmount : -999;

            var searchValue = txtSearchBy.Text.Trim();

            if (searchType == SearchTypes.ByDateOrAmount)
            {
                invoices = InvoiceProvider.SearchInvoice(new InvoiceSearchFilter()
                {
                    SearchByDateOrAmount = true,
                    FromDate             = FromDate.SelectedDate,
                    ToDate      = ToDate.SelectedDate,
                    StartAmount = (0 > startAmount) ? (decimal?)null : startAmount,
                    EndAmount   = (0 > endAmount) ? (decimal?)null : endAmount,
                }, DistributorID);
            }
            else
            {
                var searchFilter = new InvoiceSearchFilter();
                searchFilter.SearchByDateOrAmount = false;
                searchFilter.FirstName            = (filterType == SearchFilterTypes.FirstName) ? searchValue : string.Empty;
                searchFilter.LastName             = (filterType == SearchFilterTypes.LastName) ? searchValue : string.Empty;
                searchFilter.StreetAddress        = (filterType == SearchFilterTypes.StreetAddress) ? searchValue : string.Empty;
                searchFilter.City        = (filterType == SearchFilterTypes.City) ? searchValue : string.Empty;
                searchFilter.State       = (filterType == SearchFilterTypes.State) ? searchValue : string.Empty;
                searchFilter.ZipCode     = (filterType == SearchFilterTypes.ZipCode) ? searchValue : string.Empty;
                searchFilter.SKU         = (filterType == SearchFilterTypes.SKU) ? searchValue : string.Empty;
                searchFilter.Description = (filterType == SearchFilterTypes.Description) ? searchValue : string.Empty;

                //begin - shan - mar 14, 2012 - assign null based on error value
                //to differentiate whether to search by 0 or empty field
                //based on this, while filtering check for null or 0
                decimal parseValue = -999;

                parseValue = decimal.TryParse(searchValue, out parseValue) ? parseValue : -999;
                {
                    searchFilter.TotalVolumePoints = (filterType == SearchFilterTypes.TotalVolumePoints) ?
                                                     (0 < parseValue ? parseValue : (decimal?)null) : (decimal?)null;
                    searchFilter.InvoiceTotal = (filterType == SearchFilterTypes.InvoiceTotal) ?
                                                (0 < parseValue ? parseValue : (decimal?)null) : (decimal?)null;
                }

                invoices = InvoiceProvider.SearchInvoice(searchFilter, DistributorID);

                //shan - mar 15, 2012 - to set secondary sorting to be of invoice #
                //sort the invoices to be ordered by invoice # descendingg
                //while applying sorting from grid that should get filter as the primary sorting
                if (null != invoices && invoices.Count > 0)
                {
                    invoices = invoices.OrderByDescending(inv => inv.DistributorInvoiceNumber).ToList();
                }
            }

            return(invoices);
        }
Example #31
0
        private static Match MatchGroup(string line, string pattern, ref int tracker, ref int len, SearchTypes search,
                                        int shiftFactor, CodeStub NextStart, RegexOptions orientation)
        {
            int             index  = -1;
            string          value  = "";
            GroupCollection groups = null;

            switch (search)
            {
            case SearchTypes.STRING:
            {
                index = line.Substring(NextStart(tracker, len), len).IndexOf(pattern, StringComparison.Ordinal);

                if (index >= 0)
                {
                    value = pattern;
                }
                break;
            }

            case SearchTypes.REGEX:
            {
                System.Text.RegularExpressions.Match match =

                    Regex.Match(line.Substring(NextStart(tracker, len), len), pattern, orientation | RegexOptions.Multiline);

                if (match.Success)
                {
                    value  = match.Value;
                    index  = match.Index;
                    groups = match.Groups;
                }
                break;
            }

            default:
            {
                throw new ArgumentException();
            }
            }

            if (index >= 0)
            {
                return(new Match(value, NextStart(tracker, len) + index, value.Length, groups));
            }

            tracker += shiftFactor * len;

            return(Fail());
        }
Example #32
0
        public static void StartSearch()
        {
            new Thread(() =>
            {
                Cancel = false;

                StatusChanged?.Invoke(SearchStatus.Started);
                SearchFileChanged?.Invoke("Starting...");

                try
                {
                    if (SearchType == SearchTypes.Folder)
                    {
                        string folder = SearchTarget[0];

                        SearchFileChanged?.Invoke(folder);

                        SearchTarget = Directory.GetFiles(folder, "*.h", SearchOption.AllDirectories);
                        SearchType   = SearchTypes.File;
                    }

                    if (SearchType == SearchTypes.File)
                    {
                        for (int i = 0; i < SearchTarget.Length; i++)
                        {
                            var file = new FileInfo(SearchTarget[i]);
                            SearchFileChanged?.Invoke(file.FullName, i + 1, SearchTarget.Length);

                            var cache = GetCacheForFile(file);

                            var searchResult = cache.SearchHere(SearchWhat);

                            foreach (var result in searchResult)
                            {
                                StatusChanged?.Invoke(SearchStatus.FoundSomething, result);
                            }
                        }
                    }

                    if (SearchType == SearchTypes.Cache)
                    {
                        for (int i = 0; i < Cache.Count; i++)
                        {
                            var cache = Cache[i];
                            SearchFileChanged?.Invoke(cache.File.FullName, i + 1, Cache.Count);

                            var searchResult = cache.SearchHere(SearchWhat);

                            foreach (var result in searchResult)
                            {
                                StatusChanged?.Invoke(SearchStatus.FoundSomething, result);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    StatusChanged?.Invoke(SearchStatus.Error, ex);
                }

                StatusChanged?.Invoke(SearchStatus.Finished);
            }).Start();
        }
Example #33
0
        private static Match NextMatchWordOnly(string line, string pattern, int start, SearchTypes search,
                                               int shiftFactor, CodeStub StopAt, CodeStub NextStart,
                                               string pushSymbols, string popSymbols,
                                               RegexOptions orientation, string seqdelim = STRINGQUOTE)
        {
            Match match = Fail();

            int tracker = start;
            int len;

            while (!match.Success && tracker >= 0 && tracker < line.Length)
            {
                if (seqdelim.Contains(line[tracker]))
                {
                    tracker += shiftFactor * NextLiteralSequenceLength(line, tracker, StopAt(tracker, line.Length), shiftFactor, seqdelim);

                    continue;
                }

                if (pushSymbols.Contains(line[tracker]))
                {
                    tracker += shiftFactor * NextGroupLength(line, tracker, StopAt(tracker, line.Length), shiftFactor, pushSymbols, popSymbols);

                    continue;
                }

                len = NextWordLength(line, tracker, StopAt(tracker, line.Length), shiftFactor, pushSymbols + popSymbols + seqdelim);

                match = MatchGroup(line, pattern, ref tracker, ref len, search, shiftFactor, NextStart, orientation);
            }

            return(match);
        }
 /// <summary>
 /// Hace clic en un control.
 /// </summary>
 /// <param name="searchString">Texto con el que se busca el Elemento.</param>
 /// <param name="searchType">Tipo de búsqueda.</param>
 public void Click(string searchString, SearchTypes searchType)
 {
     FindElement(searchString, searchType).Click();
 }
Example #35
0
 public static Match NextMatchNonLiteralSequence(string line, string pattern, int start, SearchTypes search, string seqdelim = STRINGQUOTE)
 {
     return(NextMatchNonLiteralSequence(line, pattern, start, search, 1, StopIncrementingAt, SubstringForward, RegexOptions.None, seqdelim));
 }
Example #36
0
        private bool SearchAttributeSet(DicomAttributeCollection set, string filename, SearchTypes searchType)
        {
            if (searchType == SearchTypes.PrivateSequence)
            {
                foreach (DicomAttribute attrib in set)
                {
                    if (attrib.Tag.IsPrivate && attrib.Tag.VR.Equals(DicomVr.SQvr))
                    {
                        Platform.Log(LogLevel.Info, "Found file with private SQ: {0}", filename);
                        return(true);
                    }
                    if (!attrib.Tag.VR.Equals(DicomVr.SQvr) || attrib.IsNull)
                    {
                        continue;
                    }
                    // Recursive search
                    foreach (DicomSequenceItem item in (DicomSequenceItem[])attrib.Values)
                    {
                        SearchAttributeSet(item, filename, searchType);
                    }
                }
            }
            else if (searchType == SearchTypes.Overlay)
            {
                foreach (DicomAttribute attrib in set)
                {
                    if ((attrib.Tag.TagValue & 0xFF000000) == 0x60000000)
                    {
                        Platform.Log(LogLevel.Info, "Found embedded overlay in file: {0}", filename);
                        return(true);
                    }
                    if (attrib.Tag.TagValue > 0x70000000)
                    {
                        return(false);
                    }
                }
            }
            else if (searchType == SearchTypes.PaletteColor)
            {
                if (set.Contains(DicomTags.PhotometricInterpretation))
                {
                    if (set[DicomTags.PhotometricInterpretation].ToString().Equals("PALETTE COLOR"))
                    {
                        return(true);
                    }
                }
                return(false);
            }

            return(false);
        }
Example #37
0
 public static Match NextMatchNonGroup(string line, string pattern, int start, SearchTypes search)
 {
     return(NextMatchNonGroup(line, pattern, start, search, 1, StopIncrementingAt, SubstringForward, opener, closer, RegexOptions.None));
 }
        //public ActionResult Search()//no search parameters given
        //{
        //    return View(db.Song.ToList());
        //}
        public ActionResult Search(string searchTitle, SearchTypes? searchType, int? searchArtist, bool? ORSearch)
        {
            var songs = from s in db.Song
                        select s;

            //songs.Include(s => s.Artist);
            if (ORSearch == false) //this is an AND search
            {
                if (String.IsNullOrEmpty(searchTitle) == false)
                {
                    if (searchType == SearchTypes.KEYWORD)
                    {
                        songs = songs.Where(s => s.Name.Contains(searchTitle));
                    }

                    else
                    {
                        songs = songs.Where(s => s.Name == searchTitle);
                    }
                }

                if (searchArtist != null && searchArtist != -1) //there is something to search for in artist
                {
                    songs = songs.Where(s => s.Artist.ArtistID == searchArtist);
                }
            }
            else if (ORSearch == true) //this is an or search
            {
                if (searchType == SearchTypes.KEYWORD)
                {
                    songs = songs.Where(s => s.Name.Contains(searchTitle) || s.Artist.ArtistID == searchArtist);
                }
                else if (searchType == SearchTypes.EXACT)
                {
                    songs = songs.Where(s => s.Name == searchTitle || s.Artist.ArtistID == searchArtist);
                }

            }

            ViewBag.AllArtists = UpdateArtists.GetAllArtistsWithAll(db);
            return View(songs.ToList());
        }
Example #39
0
 public static Match NextMatchWordOnly(string line, string pattern, int start, SearchTypes search, string seqdelim = STRINGQUOTE)
 {
     return(NextMatchWordOnly(line, pattern, start, search, 1, StopIncrementingAt, SubstringForward, opener, closer, RegexOptions.None, seqdelim));
 }
Example #40
0
		private bool SearchAttributeSet(DicomAttributeCollection set, string filename, SearchTypes searchType)
		{
			if (searchType == SearchTypes.PrivateSequence)
			{
				foreach (DicomAttribute attrib in set)
				{
					if (attrib.Tag.IsPrivate && attrib.Tag.VR.Equals(DicomVr.SQvr))
					{
						Platform.Log(LogLevel.Info, "Found file with private SQ: {0}", filename);
						return true;
					}
					if (!attrib.Tag.VR.Equals(DicomVr.SQvr) || attrib.IsNull) continue;
					// Recursive search
					foreach (DicomSequenceItem item in (DicomSequenceItem[]) attrib.Values)
					{
						SearchAttributeSet(item, filename, searchType);
					}
				}
			}
			else if (searchType == SearchTypes.Overlay)
			{
				foreach (DicomAttribute attrib in set)
				{
					if ((attrib.Tag.TagValue & 0xFF000000) == 0x60000000)
					{
						Platform.Log(LogLevel.Info, "Found embedded overlay in file: {0}", filename);
						return true;
					}
					if (attrib.Tag.TagValue > 0x70000000)
						return false;
				}
			}
			else if (searchType == SearchTypes.PaletteColor)
			{
				if (set.Contains(DicomTags.PhotometricInterpretation))
				{
					if (set[DicomTags.PhotometricInterpretation].ToString().Equals("PALETTE COLOR"))
						return true;
				}
				return false;
			}

			return false;
		}
Example #41
0
 public static Match LastMatchNonLiteralSequence(string line, string pattern, int start, SearchTypes search, string seqdelim = STRINGQUOTE)
 {
     return(NextMatchNonLiteralSequence(line, pattern, start, search, -1, StopDecrementingAt, SubstringBackward, RegexOptions.RightToLeft, seqdelim));
 }
Example #42
0
 public static Match LastMatchNonGroup(string line, string pattern, int start, SearchTypes search)
 {
     return(NextMatchNonGroup(line, pattern, start, search, -1, StopDecrementingAt, SubstringBackward, closer, opener, RegexOptions.RightToLeft));
 }
Example #43
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <PagedResultOutput <ArInvoiceEntryDocumentUnitDto> > GetArInvoiceEntryDocumentUnits(SearchInputDto input)
        {
            bool unPosted = false;
            var  query    = from invoices in _arInvoiceEntryDocumentUnitRepository.GetAll()
                            join customer in _customerUnitRepository.GetAll() on invoices.CustomerId equals customer.Id
                            into customers
                            from customer in customers.DefaultIfEmpty()
                            join currency in _currencyUnitRepository.GetAll() on invoices.TypeOfCurrencyId equals currency.Id into
                            currencys
                            from currency in currencys.DefaultIfEmpty()
                            join paymentTerm in _customerPaymentTermUnitRepository.GetAll() on invoices.ArPaymentTermId equals paymentTerm.Id into
                            paymentTerms
                            from paymentTerm in paymentTerms.DefaultIfEmpty()
                            join salesRep in _salesRepUnitRepository.GetAll() on invoices.SalesRepId equals salesRep.Id into
                            salesReps
                            from salesRep in salesReps.DefaultIfEmpty()

                            select new
            {
                invoices,
                TypeOfCurrency = currency.Description,
                SalesRepName   = salesRep.LastName,
                ArPaymentTerm  = paymentTerm.Description,
                CustomerName   = customer.LastName
            };

            if (!ReferenceEquals(input.Filters, null))
            {
                SearchTypes mapSearchFilters = Helper.MappingFilters(input.Filters);
                if (!ReferenceEquals(mapSearchFilters, null))
                {
                    query = query.CreateFilters(mapSearchFilters);
                }
            }

            query = query.Where(u =>
                                u.invoices.TypeOfAccountingDocumentId == TypeOfAccountingDocument.AccountsReceivable &&
                                u.invoices.IsPosted == unPosted);



            var resultCount = await query.CountAsync();

            var results = await query
                          .AsNoTracking()
                          .OrderBy(Helper.GetSort("invoices.DocumentReference DESC", input.Sorting))
                          .PageBy(input)
                          .ToListAsync();

            var arIdList = string.Join(",", results.Select(x => x.invoices.Id).ToArray());

            var arDetailsList = from arDetail in _arInvoiceEntryDocumentDetailUnitRepository.GetAll()
                                join account in _accountUnitRepository.GetAll() on arDetail.AccountId equals account.Id
                                join job in _jobUnitRepository.GetAll() on arDetail.JobId equals job.Id
                                select new
            {
                AccountingDocumentId = arDetail.AccountingDocumentId,
                Account = account.AccountNumber,
                Job     = job.JobNumber,
                JobName = job.Caption,
                Amount  = arDetail.Amount
            };

            var arDetails = await arDetailsList.Where(u => arIdList.Contains(u.AccountingDocumentId.ToString())).ToListAsync();

            var arDetailGroup = (arDetails.GroupBy(i => i.AccountingDocumentId)
                                 .Select(g => new
            {
                g.Key,
                Jobs = string.Join(",", g.Select(u => u.Job)),
                JobName = string.Join(",", g.Select(u => u.JobName)),
                Account = string.Join(",", g.Select(u => u.Account)),
                Amount = g.Sum(u => u.Amount)
            })).ToList();

            var arList = from ar in results
                         join details in arDetailGroup on ar.invoices.Id equals details.Key
                         select new { arData = ar, arDetailGroup = details };

            return(new PagedResultOutput <ArInvoiceEntryDocumentUnitDto>(resultCount, arList.Select(item =>
            {
                var dto = item.arData.invoices.MapTo <ArInvoiceEntryDocumentUnitDto>();
                dto.JobNumber = item.arDetailGroup.Jobs;
                dto.JobName = item.arDetailGroup.JobName;
                dto.AccountNumber = item.arDetailGroup.Account;
                dto.TypeOfCurrency = item.arData.TypeOfCurrency;
                dto.SalesRepName = item.arData.SalesRepName;
                dto.ArPaymentTerm = item.arData.ArPaymentTerm;
                dto.AccountingDocumentId = item.arData.invoices.Id;
                dto.CustomerName = item.arData.CustomerName;
                return dto;
            }).ToList()));
        }