Esempio n. 1
0
 public Search(IDatabase db, SearchArgs args,
     int sendTimeout, int receiveTimeout, int sendBufferSize, int receiveBufferSize)
     : base(sendTimeout, receiveTimeout, sendBufferSize, receiveBufferSize)
 {
     _db = db;
     _args = args;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     string apiUrl = ConfigurationManager.AppSettings["Earth911.ApiUrl"];
     string apiKey = ConfigurationManager.AppSettings["Earth911.ApiKey"];
     Earth911.Api api = new Earth911.Api(apiUrl, apiKey);
     searchArgs = new SearchArgs(Request, api);
 }
Esempio n. 3
0
 public Search(IDatabase db, SearchArgs args,
     Security.RequestingPartyType requestingPartyType,
     Security.Session session, int sendTimeout,
     int receiveTimeout, int sendBufferSize, int receiveBufferSize)
     : base(db, sendTimeout, receiveTimeout, sendBufferSize, receiveBufferSize)
 {
     _requestingPartyType = requestingPartyType;
     _session = session;
     _args = args;
 }
        public static string SearchData(string CurrentPageIndex, string PageSize, string filter)
        {
            //分页查询
            SearchArgs args = new SearchArgs();

            args.CurrentIndex = int.Parse(CurrentPageIndex);
            args.PageSize     = int.Parse(PageSize);
            int begin = args.StartIndex + 1;
            int end   = args.StartIndex + args.PageSize;

            string res = string.Empty;

            try
            {
                string sql = "select  [FirstName],[LastName],[PlexID],[Department] from " +
                             "(SELECT ROW_NUMBER()OVER(ORDER BY FCI.FirstName) Indexs,FCI.* FROM [FGA_PlexUser_T] FCI  WHERE 1=1";

                //查询条件
                if (!String.IsNullOrEmpty(filter))
                {
                    sql = sql + " and FCI.FirstName like '%" + filter + "%'";
                }


                sql = sql + ") AA where AA.indexs between " + begin + " and " + end + " ";

                DataSet ds = new DataSet();
                ds = FGA_DAL.Base.SQLServerHelper_WMS.Query(sql);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    List <PlexUserModel> luw = new List <PlexUserModel>();
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        PlexUserModel ERM = new PlexUserModel(row);
                        luw.Add(ERM);
                    }

                    JavaScriptSerializer jssl = new JavaScriptSerializer();
                    res = jssl.Serialize(luw);
                    res = res.Replace("\\/Date(", "").Replace(")\\/", "");
                }
            }
            catch (Exception e)
            {
            }
            return(res);
        }
        public async Task GetCarInsuranceAdvice_SearchForRulesExcludingRulesWithoutSearchConditions_ReturnsNoRules()
        {
            // Arrange
            const ContentTypes expectedContent   = ContentTypes.CarInsuranceAdvice;
            DateTime           expectedMatchDate = new DateTime(2018, 06, 01);
            SearchArgs <ContentTypes, ConditionTypes> searchArgs = new SearchArgs <ContentTypes, ConditionTypes>
            {
                Conditions = new Condition <ConditionTypes>[]
                {
                    new Condition <ConditionTypes>
                    {
                        Type  = ConditionTypes.RepairCosts,
                        Value = 800.00000m
                    },
                    new Condition <ConditionTypes>
                    {
                        Type  = ConditionTypes.RepairCostsCommercialValueRate,
                        Value = 86.33m
                    }
                },
                ContentType = expectedContent,
                DateBegin   = expectedMatchDate,
                DateEnd     = expectedMatchDate,
                ExcludeRulesWithoutSearchConditions = true
            };

            IRulesDataSource <ContentTypes, ConditionTypes> rulesDataSource = await RulesFromJsonFile.Load
                                                                              .FromJsonFileAsync <ContentTypes, ConditionTypes>(DataSourceFilePath, serializedContent : false);

            RulesEngine <ContentTypes, ConditionTypes> rulesEngine = RulesEngineBuilder.CreateRulesEngine()
                                                                     .WithContentType <ContentTypes>()
                                                                     .WithConditionType <ConditionTypes>()
                                                                     .SetDataSource(rulesDataSource)
                                                                     .Configure(reo =>
            {
                reo.PriotityCriteria = PriorityCriterias.BottommostRuleWins;
            })
                                                                     .Build();

            // Act
            IEnumerable <Rule <ContentTypes, ConditionTypes> > actual = await rulesEngine.SearchAsync(searchArgs);

            // Assert
            actual.Should().NotBeNull();
            actual.Should().HaveCount(0);
        }
Esempio n. 6
0
 /// <summary>
 /// ログを削除する
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (!ValidateInputs())
         {
             return;
         }
         SearchArgs args = GetSearchArgs();
         this.DeleteLog(args.Type, args.StartDate, args.EndDate);
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
         //...Private stuff & other methods
         T[] Search<T>(SearchArgs args)
         {
            //Error handling ommitted
            T[] result;
            
            switch(args.SearchType)
            {
                case(SearchType.GetSomething)
                     result = GetSomethingSearch(args.Key);
                     break;
                // and so on
            }     
 
            
            api.Close();
           return result;
        }
Esempio n. 8
0
        public HttpResponseMessage AutomaticMatchConfirmationUsers([FromUri] SearchArgs args)
        {
            if (args.Search == null)
            {
                args.Search = String.Empty;
            }

            User currentUser = userBusiness.GetUserByExternalId(User.Identity.GetUserId()).Data;
            Result <PagedResult <User> > res =
                userBusiness.SearchAndExcludeByAutomaticConfirmation(args.Page, args.Count, currentUser.UserID, args.Search);

            HttpResponseMessage response = res.Success ?
                                           Request.CreateResponse(HttpStatusCode.OK, res.Data) :
                                           Request.CreateResponse(HttpStatusCode.InternalServerError, res.Message);

            return(response);
        }
Esempio n. 9
0
        /// <summary>
        /// 获取分页
        /// </summary>
        /// <returns></returns>
        public static List <NoticesModel> GetNoticesListByPage(Hashtable where, SearchArgs args)
        {
            if (args == null || args.PageSize <= 0 || args.CurrentIndex <= 0)
            {
                return(null);
            }
            List <NoticesModel> list = Common.Instance._Notices.GetNoticesListByPage(where, args);

            if (list != null && list.Count > 0)
            {
                foreach (var item in list)
                {
                    item.NCreaterName = BusinessLogic.Cache.UsersCache.GetName(item.NCreater);
                }
            }
            return(list);
        }
        /// <summary>
        /// This will take input (url) from the search pipeline and try to bring back an item.
        /// </summary>
        /// <param name="args"></param>
        public void Process(SearchArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            //validate argument's properties
            if (string.IsNullOrEmpty(args.TextQuery) || args.Database == null)
            {
                return;
            }

            SiteUrl siteUrlItem = SiteUrl.GetSiteInfo_ByUrl(args.TextQuery);
            if(siteUrlItem == null)
            {
                return;
            }

            SiteInfo siteInfo = SiteContextFactory.GetSiteInfo(siteUrlItem.Name);
            if (siteInfo == null)
            {
                return;
            }

            string sitePath = siteInfo.RootPath + siteInfo.StartItem;

            //try and get the item from the passed text query and database
            Item item = args.TextQuery.GetItemByUrlParts(args.Database, true, sitePath);
            if (item != null)
            {
                //we have a hit, set the search result and abort from the search pipeline
                SearchResult result = SearchResult.FromItem(item);
                args.Result.AddResultToCategory(result, Translate.Text("Direct Hit"));
                args.AbortPipeline();
                return;
            }

            //first attempt failed, it could be due to the dashes in the url
            item = args.TextQuery.GetItemByUrlParts(args.Database, false);
            if (item != null)
            {
                //we have a hit, set the search result and abort from the search pipeline
                SearchResult result = SearchResult.FromItem(item);
                args.Result.AddResultToCategory(result, Translate.Text("Direct Hit"));
                args.AbortPipeline();
            }
        }
Esempio n. 11
0
        public string Execute([NotNull] string queryText)
        {
            Assert.ArgumentNotNull(queryText, nameof(queryText));

            var args = new SearchArgs(queryText)
            {
                Type  = SearchType.ContentEditor,
                Limit = 30,
            };

            using (new LongRunningOperationWatcher(250, "Search pipeline from instant search for '{0} query", queryText))
            {
                CorePipeline.Run("search", args);
            }

            var results = args.Result;

            if (results.Count == 0)
            {
                return(string.Empty);
            }

            var writer = new StringWriter();
            var output = new XmlTextWriter(writer);

            output.WriteStartElement("hits");

            foreach (var category in results.Categories)
            {
                foreach (var hit in category)
                {
                    var item = hit.GetObject <Item>();
                    if (item == null)
                    {
                        continue;
                    }

                    output.WriteItemHeader(item, category.Name);
                }
            }

            output.WriteEndElement();

            return(writer.ToString());
        }
Esempio n. 12
0
        /// <summary>
        /// 検索条件を取得する
        /// </summary>
        /// <returns></returns>
        private SearchArgs GetSearchArgs()
        {
            SearchArgs args = new SearchArgs();
            //Type
            EnumNameAttribute selectedItem = (EnumNameAttribute)this.cmbLogType.SelectedItem;

            args.Type = (LogType)selectedItem.EnumValue;
            //開始日
            if (dtpStartDate.Checked)
            {
                args.StartDate = dtpStartDate.Value.Date;
            }
            //終了日
            if (dtpEndDate.Checked)
            {
                args.EndDate = DateTime.Parse(dtpEndDate.Value.ToString("yyyy/MM/dd") + " 23:59:59");
            }
            return(args);
        }
        public string SearchPersons(SearchArgs searchArgs)
        // replace this to trigger searchArgs error - public JsonResult SearchPersons(string searchArgs)
        {
            string caller     = "HttpPost SearchPersons";
            string jsonResult = string.Empty;

            try
            {
                jsonResult = agentFactory.personAgent.SearchPersons(searchArgs, caller, dbCtx);
            }
            catch (Exception ex)
            {
                // All exceptions should be caught in called method and returned in jsonResult above - but!!
                jsonResult = JsonConvert.SerializeObject(new { Error = ex.Message });
                return(jsonResult);
            }

            return(jsonResult);
        }
Esempio n. 14
0
        public PageResult <IDictionary <string, object> > SearchDic(SearchArgs <Material> searchArgs)
        {
            var result = Search(searchArgs);
            var list   = new List <IDictionary <string, object> >();

            foreach (var item in result.Items)
            {
                var brand           = BrandRepository.FindById(item.BrandId);
                var typeDTO         = MaterialTypeService.GetById(item.TypeId);
                var materialConfigs = ConfigRepository.Find(x => x.MaterialId == item.Id).ToDictionary(x => x.ConfigKey);
                var configs         = typeDTO.Configs.Select(x => new MaterialConfigDTO()
                {
                    ConfigKey       = x.ConfigKey,
                    ConfigKeyDesc   = x.ConfigKeyDesc,
                    ConfigValueType = x.ConfigValueType,
                    ConfigValue     = materialConfigs.ContainsKey(x.ConfigKey) ? materialConfigs[x.ConfigKey].ConfigValue : x.ConfigDefaultValue,
                    MaterialId      = item.Id,
                    Remark          = x.Remark,
                    Sort            = x.Sort
                }).ToList();
                item.Configs      = configs;
                item.BrandName    = brand.Name;
                item.CategoryId   = typeDTO.CategoryId;
                item.CategoryName = typeDTO.CategoryName;
                item.TypeName     = typeDTO.Name;
                var dic = item.ToDictionary();
                foreach (var c in item.Configs)
                {
                    dic.Add(c.ConfigKey, c.ConfigValue);
                }
                list.Add(dic);
            }
            var p = new PageResult <IDictionary <string, object> >()
            {
                Items     = list,
                PageCount = result.PageCount,
                PageIndex = result.PageIndex,
                PageSize  = result.PageSize,
                TotalRows = result.TotalRows
            };

            return(p);
        }
Esempio n. 15
0
        private void gridSearchClicked(object view, SearchArgs searchArgs)
        {
            var query  = GetFieldValueQuery(searchArgs.FieldName, searchArgs.FieldValue, searchArgs.UseAndOperator);
            var source = getSearchInputState();

            int queryStartIndex = source.Text.IndexOf(query, Str.Comparison);

            if (queryStartIndex >= 0)
            {
                removeQueryFromInput(queryStartIndex, query, source);
            }
            else
            {
                var token = new MtgTolerantTokenizer(source.Text).GetTokenForTermInsertion(source.Caret);
                pasteText(query, TokenType.None, source, token, positionCaretToNextValue: true);
            }

            Apply();
        }
Esempio n. 16
0
        public async Task <IList <SearchableSupplier> > GetSuppliers(SearchArgs searchArgs)
        {
            var fieldsToSearch = new Collection <TextSearchField <SupplierIndexItem> >
            {
                new() { Field = field => field.CompanyName }
            };

            var request = await ElasticSearchRequest <SupplierIndexItem> .Init(_elasticSearchService)
                          .CreateSearchRequestQuery(searchArgs, fieldsToSearch)
                          .CreateSort(searchArgs)
                          .PipeAsync(async searchRequest => await searchRequest.BuildAsync());

            var response = await _elasticSearchService.SearchAsync(request);

            var suppliers = response.SearchResults.Documents;

            var dtos = _mapper.Map <IList <SearchableSupplier> >(suppliers);

            return(dtos);
        }
Esempio n. 17
0
        private void gridSearchClicked(object view, SearchArgs searchArgs)
        {
            string query             = GetFieldValueQuery(searchArgs.FieldName, searchArgs.FieldValue);
            var    preProcessedQuery = removeExtraWhitespaces(query);
            var    source            = getSearchInputState();

            int queryStartIndex = source.Text.IndexOf(preProcessedQuery, Str.Comparison);

            if (queryStartIndex >= 0)
            {
                removeQueryFromInput(queryStartIndex, preProcessedQuery, source);
            }
            else
            {
                var token = new MtgTolerantTokenizer(source.Text).GetTokenForTermInsertion(source.Caret);
                pasteText(preProcessedQuery, TokenType.Field, source, token, positionCaretToNextValue: true);
            }

            Apply();
        }
        public override PageResult <MaterialTypeDTO> Search(SearchArgs <MaterialType> searchArgs)
        {
            var result = base.Search(searchArgs);

            foreach (var item in result.Items)
            {
                var typeConfigs = MaterialTypeConfigRepository.Find(x => x.MaterialTypeId == item.Id).OrderBy(x => x.Sort);
                var categoryDTO = MaterialCategoryService.GetById(item.CategoryId);
                item.Configs = categoryDTO.Configs.Select(x => new MaterialTypeConfigDTO()
                {
                    ConfigKey          = x.ConfigKey,
                    ConfigKeyDesc      = x.ConfigKeyDesc,
                    ConfigValueType    = x.ConfigValueType,
                    ConfigDefaultValue = typeConfigs.FirstOrDefault(y => y.ConfigKey == x.ConfigKey) == null ? null :
                                         typeConfigs.FirstOrDefault(y => y.ConfigKey == x.ConfigKey).ConfigDefaultValue,
                    MaterialTypeId = item.Id,
                    Remark         = x.Remark,
                    Sort           = x.Sort
                }).OrderBy(x => x.Sort).ToList();
            }
            return(result);
        }
Esempio n. 19
0
        static void RetrieveProps(string level, out LevelPermission visit,
                                  out LevelPermission build, out bool loadOnGoto)
        {
            visit      = LevelPermission.Guest;
            build      = LevelPermission.Guest;
            loadOnGoto = true;

            string     propsPath = LevelInfo.PropsPath(level);
            SearchArgs args      = new SearchArgs();

            if (!PropertiesFile.Read(propsPath, ref args, ProcessLine))
            {
                return;
            }

            visit = Group.ParsePermOrName(args.Visit, visit);
            build = Group.ParsePermOrName(args.Build, build);
            if (!bool.TryParse(args.LoadOnGoto, out loadOnGoto))
            {
                loadOnGoto = true;
            }
        }
Esempio n. 20
0
        private List <JaviModel> SearchHanViet(SearchArgs searchArgs)
        {
            if (_isLoadingCache)
            {
                return(new List <JaviModel>());
            }
            var key         = searchArgs.SearchKey;
            var arr         = key.Split(' ');
            var kanjiOfWord = arr.Length;
            var result      = new List <JaviModel>();

            using (var db = new JazeDatabaseContext())
            {
                foreach (var simpleJavi in _javiHanVietCaches)
                {
                    if (simpleJavi.HanViet.Count == kanjiOfWord)
                    {
                        bool flag = true;
                        for (int i = 0; i < kanjiOfWord; i++)
                        {
                            if (simpleJavi.HanViet2[i].All(hv => hv != arr[i]))
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (flag)
                        {
                            var javi = db.JaVis.Find(simpleJavi.DbId);
                            if (javi != null)
                            {
                                result.Add(JaviModel.Create(javi));
                            }
                        }
                    }
                }
                return(result);
            }
        }
Esempio n. 21
0
        private List <object> Search(SearchArgs args)
        {
            var dictionaryType = args.Dictionary;
            var key            = args.SearchKey;
            var searchOption   = args.Option;
            var result         = new List <object>();

            switch (dictionaryType)
            {
            case DictionaryType.JaVi:
                result.AddRange(_javiService.Search(new SearchArgs(key, searchOption)));
                break;

            case DictionaryType.HanViet:
                result.AddRange(_hanvietService.Search(new SearchArgs(key, searchOption)));
                break;

            case DictionaryType.Kanji:
                result.AddRange(_kanjiService.Search(new SearchArgs(key, searchOption)));
                break;

            case DictionaryType.ViJa:
                result.AddRange(_vijaService.Search(new SearchArgs(key, searchOption)));
                break;

            case DictionaryType.Grammar:
                result.AddRange(_grammarService.Search(new SearchArgs(key, searchOption)));
                break;

            case DictionaryType.JaEn:
                result.AddRange(_jaenService.Search(new SearchArgs(key, searchOption)));
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(dictionaryType), dictionaryType, null);
            }

            return(result);
        }
Esempio n. 22
0
        /// <inheritdoc/>
        public virtual async Task <SearchResultStream> SearchOneShotAsync(string search, int count = 0,
                                                                          JobArgs args             = null, CustomJobArgs customArgs = null)
        {
            var resourceName = JobCollection.ClassResourceName;

            var arguments = new SearchArgs
            {
                Search        = search,
                Count         = count,
                ExecutionMode = ExecutionMode.OneShot
            }
            .AsEnumerable();

            if (args != null)
            {
                arguments = arguments.Concat(args.Where(arg => arg.Name != "exec_mode"));
            }

            if (customArgs != null)
            {
                arguments = arguments.Concat(customArgs);
            }

            Response response = await this.Context.PostAsync(this.Namespace, resourceName, arguments).ConfigureAwait(false);

            try
            {
                await response.EnsureStatusCodeAsync(HttpStatusCode.OK).ConfigureAwait(false);

                var stream = await SearchResultStream.CreateAsync(response).ConfigureAwait(false); // Transfers response ownership

                return(stream);
            }
            catch
            {
                response.Dispose();
                throw;
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        string apiUrl = ConfigurationManager.AppSettings["Earth911.ApiUrl"];
        string apiKey = ConfigurationManager.AppSettings["Earth911.ApiKey"];

        Earth911.Api api = new Earth911.Api(apiUrl, apiKey);

        searchArgs = new SearchArgs(Request, api);

        string type = Request.QueryString["type"];
        string id   = Request.QueryString["id"];

        JsonObject args   = new JsonObject();
        string     method = null;

        if (type == "location")
        {
            method = "earth911.getLocationDetails";
            args["location_id"] = id;
        }
        else if (type == "program")
        {
            method             = "earth911.getProgramDetails";
            args["program_id"] = id;
        }

        details = null;

        if (method != null)
        {
            JsonObject result = (JsonObject)api.Call(method, args);
            details = (JsonObject)result[id];
        }

        if (details == null)
        {
            Response.StatusCode = 404;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string apiUrl = ConfigurationManager.AppSettings["Earth911.ApiUrl"];
        string apiKey = ConfigurationManager.AppSettings["Earth911.ApiKey"];
        Earth911.Api api = new Earth911.Api(apiUrl, apiKey);

        searchArgs = new SearchArgs(Request, api);

        string type = Request.QueryString["type"];
        string id = Request.QueryString["id"];
        
        JsonObject args = new JsonObject();
        string method = null;

        if (type == "location")
        {
            method = "earth911.getLocationDetails";
            args["location_id"] = id;
        }
        else if (type == "program")
        {
            method = "earth911.getProgramDetails";
            args["program_id"] = id;
        }
        
        details = null;
        
        if (method != null)
        {
            JsonObject result = (JsonObject)api.Call(method, args);
            details = (JsonObject)result[id];
        }

        if (details == null)
        {
            Response.StatusCode = 404;
        }
    }
Esempio n. 25
0
        public override List <JaviModel> Search(SearchArgs searchArgs)
        {
            var rawKey = searchArgs.SearchKey;

            if (string.IsNullOrWhiteSpace(rawKey))
            {
                return(new List <JaviModel>());
            }
            var key = rawKey.Contains("-") ? StringUtil.ConvertRomaji2Katakana(rawKey) : StringUtil.ConvertRomaji2Hiragana(rawKey);
            List <JaviModel> resultJv = new List <JaviModel>();
            List <JaviModel> resultHv = new List <JaviModel>();

            if (StringUtil.IsJapanese(key))
            {
                resultJv = base.Search(new SearchArgs(key, searchArgs.Option));
            }

            if (rawKey.Split(' ').All(StringUtil.IsVietnameseWord))
            {
                resultHv = SearchHanViet(searchArgs);
            }
            return(resultJv.Union(resultHv).ToList());
        }
Esempio n. 26
0
        public override List <KanjiModel> Search(SearchArgs searchArgs)
        {
            var key = searchArgs.SearchKey;

            //
            if (string.IsNullOrWhiteSpace(key))
            {
                return(GetAll());
            }
            //if search key contain multi kanji
            var arr = StringUtil.FilterCharsInString(key, CharSet.Kanji);

            if (arr.Count > 0)
            {
                return(LoadKanji(arr));
            }
            //if search key is vietnamese sentence
            if (key.Contains(" "))
            {
                return(SearchVietNameseSentence(key));
            }

            return(base.Search(searchArgs));
        }
        public async Task <IActionResult> SearchProductsAsync([FromBody] DtParameters dtParameters)
        {
            var searchArgs = new SearchArgs
            {
                Offset          = dtParameters.Start,
                Limit           = dtParameters.Length,
                SearchText      = dtParameters.Search?.Value,
                FiltersCriteria = dtParameters.FiltersCriteria,
                SortOptions     = new List <SortOptionArgs>()
                {
                    ComposeSort(dtParameters)
                }
            };

            var products = await _productSearchService.SearchProducts(searchArgs);

            return(new JsonResult(new DtResult <SearchableProduct>
            {
                Draw = dtParameters.Draw,
                RecordsTotal = products.Count,
                RecordsFiltered = products.Count,
                Data = products.Values
            }));
        }
    void SearchOnCompleted(SearchArgs state)
    {
      if (state.Success)
      {
        grdResults.ItemsSource = state.resultTable.DefaultView;
        grdResults.Columns.Where(c => c.SortMemberPath == "GoodsServicesID").Single().Visibility = Visibility.Hidden;

      }
      else
        lblSearchError.Text = state.Text;
    }
Esempio n. 29
0
        /// <summary>
        /// 获取分页
        /// </summary>
        /// <returns></returns>
        public List <RolesModel> GetRolesListByPage(Hashtable where, SearchArgs args)
        {
            {
                List <RolesModel>   list = new List <RolesModel>();
                StringBuilder       sb = new StringBuilder();
                List <SqlParameter> pms = new List <SqlParameter>();
                string condition = string.Empty, orderBy = string.Empty;
                if (where != null)
                {
                    foreach (DictionaryEntry item in where)
                    {
                        RolesArgs arg = (RolesArgs)item.Key;
                        switch (arg)
                        {
                        case RolesArgs.rname:
                            sb.Append(" and rname like @rname ");
                            pms.Add(new SqlParameter("@rname", "%" + item.Value + "%"));
                            break;

                        case RolesArgs.state:
                            sb.Append(" and state =@state ");
                            pms.Add(new SqlParameter("@state", item.Value));
                            break;

                        case RolesArgs.OrderBy:
                            orderBy = item.Value.ToString();
                            break;

                        default:
                            break;
                        }
                    }
                    condition = sb.ToString();
                    sb.Length = 0;
                }
                //count
                sb.AppendLine("select count(1) as totalCount from roles where 1=1 ");
                sb.AppendLine(condition);
                args.TotalRecords = FGA_NUtility.Convertor.ToInt32(Base.SQLServerHelper.Query(sb.ToString(), pms.ToArray()).Tables[0].Rows[0][0]);
                if (args.TotalRecords <= 0)
                {
                    return(null);
                }
                sb.Length = 0;
                //query
                if (!string.IsNullOrEmpty(orderBy))
                {
                    sb.Append("SELECT * FROM(SELECT ROW_NUMBER()OVER(ORDER BY " + orderBy + " DESC)Indexs,* FROM roles where 1=1 ");
                }
                else
                {
                    sb.Append("SELECT * FROM(SELECT ROW_NUMBER()OVER(ORDER BY rid DESC)Indexs,* FROM roles where 1=1 ");
                }

                sb.AppendLine(condition);
                sb.AppendLine(")Tab WHERE Tab.Indexs BETWEEN ((" + args.StartIndex + ")*" + args.PageSize + ")+1 AND " + (args.StartIndex + 1) + "*" + args.PageSize);
                DataSet ds = Base.SQLServerHelper.Query(sb.ToString(), pms.ToArray());
                if (ds == null || ds.Tables.Count < 0 || ds.Tables[0].Rows.Count < 0)
                {
                    return(null);
                }
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    list.Add(new RolesModel(row));
                }
                return(list);
            }
        }
Esempio n. 30
0
 /// <summary>
 /// 获取分页
 /// </summary>
 /// <returns></returns>
 public static List <UsersModel> GetUsersListByPage(Hashtable where, SearchArgs args)
 {
     return(Common.Instance._Users.GetUsersListByPage(where, args));
 }
Esempio n. 31
0
        public static string SearchData(string containertype, string customercode, string typeno, string barcodeno, string status, string bol, string dr, string ftime, string ttime, string CurrentPageIndex, string PageSize)
        {
            //分页查询
            SearchArgs args = new SearchArgs();

            args.CurrentIndex = int.Parse(CurrentPageIndex);
            args.PageSize     = int.Parse(PageSize);
            int begin = args.StartIndex + 1;
            int end   = args.StartIndex + args.PageSize;

            string res = string.Empty;

            try
            {
                //获取记录总数
                string sql_total = "select count(*) Indexs from [FGA_Container_Trans_t] IR left join [FGAContainerInfos] fci  " +
                                   "on IR.Barcode = fci.barcode where 1=1 ";
                //查询条件
                if (!String.IsNullOrEmpty(containertype))
                {
                    sql_total = sql_total + " and fci.ContainerType like '%" + containertype + "%'";
                }
                if (!String.IsNullOrEmpty(customercode))
                {
                    sql_total = sql_total + " and fci.CustomerCode like  '%" + customercode + "%'";
                }
                if (!String.IsNullOrEmpty(typeno))
                {
                    sql_total = sql_total + " and fci.TypeNO like '%" + typeno + "%'";
                }
                if (!String.IsNullOrEmpty(barcodeno))
                {
                    sql_total = sql_total + " and IR.Barcode like  '%" + barcodeno + "%'";
                }
                if (!String.IsNullOrEmpty(bol))
                {
                    sql_total = sql_total + " and IR.ReceiptNO like  '%" + bol + "%'";
                }
                if (!String.IsNullOrEmpty(status))
                {
                    if (!"All".Equals(status))
                    {
                        sql_total = sql_total + " and IR.Status = '" + status + "'";
                    }
                }
                if (!String.IsNullOrEmpty(dr))
                {
                    if (!"All".Equals(dr))
                    {
                        sql_total = sql_total + " and IR.dr = '" + dr + "'";
                    }
                }
                if (!String.IsNullOrEmpty(ftime) || !String.IsNullOrEmpty(ttime))
                {
                    sql_total = sql_total + " and IR.TranscationTime >= '" + ftime + "' and IR.TranscationTime <='" + ttime + "'";
                }

                DataSet dst = new DataSet();
                dst = FGA_DAL.Base.SQLServerHelper_WMS.Query(sql_total);

                if (dst != null && dst.Tables.Count > 0 && dst.Tables[0].Rows.Count > 0)
                {
                    args.TotalRecords = Convert.ToInt32(dst.Tables[0].Rows[0][0]);
                }
                else
                {
                    return(res);
                }

                string sql = "select * from (select ROW_NUMBER()OVER(ORDER BY IR.ContainerType,IR.Barcode,IR.dr,IR.TranscationTime DESC) Indexs,IR.TranscationID,IR.Barcode,IR.CustomerPartNO,IR.TranscationUser,IR.TranscationTime,IR.Status,IR.SerialNO,IR.ReceiptNO," +
                             "IR.CustomerCode,IR.ContainerType,IR.TypeNO,IR.dr  " +
                             "from (select fct.TranscationID,fct.Barcode,fci.CustomerPartNO,fct.TranscationUser,fct.TranscationTime,fct.Status,fct.SerialNO,fct.ReceiptNO, " +
                             "FCI.CustomerCode,fci.ContainerType,fci.TypeNO,fct.dr from [FGA_Container_Trans_t] fct left join [FGAContainerInfos] fci  " +
                             "on  fct.Barcode = fci.barcode) IR WHERE 1=1  ";


                //查询条件
                if (!String.IsNullOrEmpty(containertype))
                {
                    sql = sql + " and IR.ContainerType like '%" + containertype + "%'";
                }
                if (!String.IsNullOrEmpty(customercode))
                {
                    sql = sql + " and IR.CustomerCode like  '%" + customercode + "%'";
                }
                if (!String.IsNullOrEmpty(typeno))
                {
                    sql = sql + " and IR.TypeNO like '%" + typeno + "%'";
                }
                if (!String.IsNullOrEmpty(barcodeno))
                {
                    sql = sql + " and IR.Barcode like  '%" + barcodeno + "%'";
                }
                if (!String.IsNullOrEmpty(bol))
                {
                    sql = sql + " and IR.ReceiptNO like  '%" + bol + "%'";
                }
                if (!String.IsNullOrEmpty(status))
                {
                    if (!"All".Equals(status))
                    {
                        sql = sql + " and IR.Status = '" + status + "'";
                    }
                }
                if (!String.IsNullOrEmpty(dr))
                {
                    if (!"All".Equals(dr))
                    {
                        sql = sql + " and IR.dr = '" + dr + "'";
                    }
                }
                if (!String.IsNullOrEmpty(ftime) || !String.IsNullOrEmpty(ttime))
                {
                    sql = sql + " and IR.TranscationTime >= '" + ftime + "' and IR.TranscationTime <='" + ttime + "'";
                }

                sql = sql + ") AA where AA.indexs between " + begin + " and " + end + " ";

                DataSet ds = new DataSet();
                ds = FGA_DAL.Base.SQLServerHelper_WMS.Query(sql);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    List <ContainerViewObject> luw = new List <ContainerViewObject>();
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        ContainerViewObject ERM = new ContainerViewObject(row);
                        ERM.Recordcnt = args.TotalRecords;

                        luw.Add(ERM);
                    }

                    JavaScriptSerializer jssl = new JavaScriptSerializer();
                    res = jssl.Serialize(luw);
                    res = res.Replace("\\/Date(", "").Replace(")\\/", "");
                }
            }
            catch (Exception e)
            {
            }
            return(res);
        }
Esempio n. 32
0
 public Search(EngineRequest request, SearchArgs args)
     : base(request)
 {
     _args = args;
 }
Esempio n. 33
0
 public override void Search(EngineRequest request, SearchArgs args)
 {
     CheckInitialization();
     Logger.Storage.Debug("Performing search...");
     EngineMethods.Search act = new EngineMethods.Search(request, args);
     act.Execute();
 }
Esempio n. 34
0
        public override async Task Do(SearchArgs args)
        {
            var searchResult = await LavaRestClient.SearchSoundcloud(args.Query);

            await HandleSearchResult(searchResult);
        }
 //this happens off the UI thread
 void SearchOnExecute(SearchArgs state)
 {
   using (Proc GoodsAndServices_Search = new Proc("GoodsAndServices_Search"))
   {
     GoodsAndServices_Search.AssignValues(state.values);
     state.resultTable = GoodsAndServices_Search.ExecuteDataTable(state);
   }
 }
 public SearchCategoriesQuery(SearchArgs args)
 {
     Args = args;
 }
Esempio n. 37
0
 public Search(EngineRequest request, SearchArgs args)
     : base(request)
 {
     _args = args;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        string apiUrl = ConfigurationManager.AppSettings["Earth911.ApiUrl"];
        string apiKey = ConfigurationManager.AppSettings["Earth911.ApiKey"];
        Earth911.Api api = new Earth911.Api(apiUrl, apiKey);

        searchArgs = new SearchArgs(Request, api);
        baseUrl = "Search.aspx?" + searchArgs.QueryString;

        JsonArray locations = new JsonArray();
        JsonArray programs = new JsonArray();

        JsonObject args;

        // Perform search queies

        if (searchArgs.What != "" && searchArgs.FoundWhere)
        {
            // Find matching materials

            args = new JsonObject();
            args["query"] = searchArgs.What;
            JsonArray materials = (JsonArray)api.Call("earth911.searchMaterials", args);

            JsonArray materialIds = new JsonArray();
            foreach (JsonObject material in materials)
            {
                materialIds.Add((JsonNumber)material["material_id"]);
            }
            
            // If materials were found, run the query

            if (materialIds.Count > 0)
            {
                args = new JsonObject();
                args["latitude"] = searchArgs.Latitude;
                args["longitude"] = searchArgs.Longitude;
                args["material_id"] = materialIds;
                locations = (JsonArray)api.Call("earth911.searchLocations", args);
                programs = (JsonArray)api.Call("earth911.searchPrograms", args);
            }
        }

        // Combine locations and programs, sort by distance

        results = new List<JsonObject>();
        foreach (JsonObject location in locations)
        {
            // Filtering of undesirable locations can be done here,
            // prior to pagination.
            //
            // if (location["description"].ToString() == "Company X")
            // {
            //     continue;
            // }

            location["type"] = "location";
            location["id"] = location["location_id"];
            results.Add(location);
        }
        foreach (JsonObject program in programs)
        {
            program["type"] = "program";
            program["id"] = program["program_id"];
            results.Add(program);
        }
        results.Sort(new DistanceComparer());

        // Paginate results

        int page = Convert.ToInt32(Request.QueryString["page"]);
        searchPager = new SearchPager<JsonObject>(results, page);
        results = searchPager.Result();

        // Load details for this page of results

        JsonArray locationIds = new JsonArray();
        JsonArray programIds = new JsonArray();

        foreach (JsonObject result in results)
        {
            if (result["type"] == "location")
            {
                locationIds.Add(result["id"]);
            }
            if (result["type"] == "program")
            {
                programIds.Add(result["id"]);
            }
            result["url"] =
                "Details.aspx?type="
                + result["type"]
                + "&id="
                + result["id"]
                + "&" + searchArgs.QueryString;
        }

        locationDetails = new JsonObject();
        if (locationIds.Count > 0)
        {
            args = new JsonObject();
            args["location_id"] = locationIds;
            locationDetails = (JsonObject)api.Call("earth911.getLocationDetails", args);
        }

        programDetails = new JsonObject();
        if (programIds.Count > 0)
        {
            args = new JsonObject();
            args["program_id"] = programIds;
            programDetails = (JsonObject)api.Call("earth911.getProgramDetails", args);
        }
    }
Esempio n. 39
0
        public static string SearchData(string sn, string fn, string ln, string department, string itno, string finno, string status, string fd, string td,
                                        string ITInv, string CurrentPageIndex, string PageSize)
        {
            //分页查询
            SearchArgs args = new SearchArgs();

            args.CurrentIndex = int.Parse(CurrentPageIndex);
            args.PageSize     = int.Parse(PageSize);
            int begin = args.StartIndex + 1;
            int end   = args.StartIndex + args.PageSize;

            string res = string.Empty;

            try
            {
                //获取记录总数
                string sql_total = "select count(*) Indexs from [FGA_ITAssetInfos_T] where 1=1 and isnull(active,'0') ='0' ";
                //查询条件
                if ("0".Equals(ITInv))
                {
                    sql_total = sql_total + " and [PlexID] <> 'FY.IFGA'";
                }

                DataSet dst = new DataSet();
                dst = FGA_DAL.Base.SQLServerHelper_WMS.Query(sql_total);

                if (dst != null && dst.Tables.Count > 0 && dst.Tables[0].Rows.Count > 0)
                {
                    args.TotalRecords = Convert.ToInt32(dst.Tables[0].Rows[0][0]);
                }
                else
                {
                    return(res);
                }

                string sql = "SELECT * FROM " +
                             "(SELECT ROW_NUMBER()OVER(ORDER BY BB.Last_Name,BB.First_Name DESC) Indexs,BB.* " +
                             "FROM (SELECT FIA.*, FAT.IT_AssetNO, FAT.SerialNO,FAT.FIN_AssetNO, FAT.AssetName,FAT.Brand,FAT.Category," +
                             "FAT.MacAddress, FPT.FirstName AS First_Name, FPT.LastName AS Last_Name, FPT.Department,FPT.Manager " +
                             "FROM FGA_ITAssetInfos_T FIA LEFT JOIN FGA_AssetCard_T FAT ON FIA.AssetKey = FAT.AssetKey " +
                             "LEFT JOIN FGA_PlexUser_T FPT ON FIA.PlexID = FPT.PlexID) BB where 1=1 and isnull(BB.active,'0') ='0'";

                //查询条件
                if ("0".Equals(ITInv))
                {
                    sql = sql + " and BB.PlexID <> 'FY.IFGA'";
                }

                if (!String.IsNullOrEmpty(fn))
                {
                    sql = sql + " and upper(BB.First_Name) like '%" + fn.ToUpper() + "%'";
                }
                if (!String.IsNullOrEmpty(ln))
                {
                    sql = sql + " and upper(BB.Last_Name) like '%" + ln.ToUpper() + "%'";
                }
                if (!"All".Equals(department) && !"null".Equals(department))
                {
                    sql = sql + " and BB.Department = '" + department + "'";
                }
                if (!"All".Equals(status) && !"null".Equals(status))
                {
                    sql = sql + " and BB.Status = '" + status + "'";
                }
                if (!String.IsNullOrEmpty(sn))
                {
                    sql = sql + " and BB.SerialNO like '%" + sn + "%'";
                }
                if (!String.IsNullOrEmpty(itno))
                {
                    sql = sql + " and BB.IT_AssetNO like '%" + itno + "%'";
                }
                if (!String.IsNullOrEmpty(finno))
                {
                    sql = sql + " and BB.FIN_AssetNO like '%" + finno + "%'";
                }
                if (!String.IsNullOrEmpty(fd))
                {
                    sql = sql + " and BB.Issue_Date >= '" + fd + "'";
                }
                if (!String.IsNullOrEmpty(td))
                {
                    sql = sql + " and BB.Issue_Date <= '" + td + "'";
                }

                sql = sql + ") AA where AA.indexs between " + begin + " and " + end + " ";

                DataSet ds = new DataSet();
                ds = FGA_DAL.Base.SQLServerHelper_WMS.Query(sql);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    List <IT_AssetInfoModel> luw = new List <IT_AssetInfoModel>();
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        IT_AssetInfoModel ERM = new IT_AssetInfoModel(row);
                        ERM.RecordCnt = args.TotalRecords;
                        luw.Add(ERM);
                    }

                    JavaScriptSerializer jssl = new JavaScriptSerializer();
                    res = jssl.Serialize(luw);
                    res = res.Replace("\\/Date(", "").Replace(")\\/", "");
                }
            }
            catch (Exception e)
            {
            }
            return(res);
        }
Esempio n. 40
0
        public static string DoLogsSearch(string txtFullName, string CurrentPageIndex, string PageSize, string type, string type1)
        {
            string json = string.Empty;

            try
            {
                if (HttpContext.Current.Session[SysConst.S_LOGIN_USER] == null)
                {
                    return("");
                }
                //string where = "";
                //DataTable dt = FGA_BLL.Sys_LogBLL.GetSys_LogInfoByWhere(where);
                //List<ReLogModel> list = new List<ReLogModel>();
                //foreach (DataRow item in dt.Rows)
                //{
                //    ReLogModel model = new ReLogModel();
                //    string typeName = Enum.GetName(typeof(FGA_BLL.Common.modularTypeOne), item["type"]);
                //    if (item["type1"].ToString() != "")
                //    {
                //        typeName +="-"+ Enum.GetName(typeof(FGA_BLL.Common.modularTypeOne), item["type1"]);
                //    }
                //    model.typeName = typeName;
                //    model.time = item["add_time"].ToString();
                //    model.result = item["result"].ToString();
                //    model.uName = item["uid"].ToString();
                //}

                Hashtable where = new Hashtable();
                if (!string.IsNullOrEmpty(txtFullName))
                {
                    where.Add(Sys_logArgs.fullName, txtFullName);
                }


                where.Add(Sys_logArgs.OrderBy, "add_time desc");
                SearchArgs args = new SearchArgs();
                args.CurrentIndex = int.Parse(CurrentPageIndex);
                args.PageSize     = int.Parse(PageSize);
                var               list      = FGA_BLL.Sys_LogBLL.GetUsersListByPage(where, args);
                DataLogReWrite    datausers = new DataLogReWrite();
                List <ReLogModel> reList    = new List <ReLogModel>();
                if (list != null && list.Count > 0)
                {
                    datausers.totalRecord = args.TotalRecords;
                    foreach (Sys_LogModel item in list)
                    {
                        ReLogModel model    = new ReLogModel();
                        string     typeName = "";
                        model.typeName = typeName;
                        model.time     = item.add_time;
                        model.result   = item.result;
                        model.uName    = item.fullName.Trim() == "" && item.uid == 0 ? "未知用户" : item.fullName;
                        model.id       = item.id + "";
                        model.ip       = item.ip;
                        reList.Add(model);
                    }
                    datausers.sysLoglist = reList;
                    JavaScriptSerializer jssl = new JavaScriptSerializer();
                    json = jssl.Serialize(datausers);
                }
            }
            catch (Exception ex)
            {
                FGA_NUtility.SysLog.WriteException("DoLogsSearch", ex);
            }
            return(json);
        }
        protected void TreeSearch_Click()
        {
            Assert.IsNotNull(SearchManager.SystemIndex, "index");
            HtmlTextWriter output = new HtmlTextWriter(new StringWriter());
            QueryBase query = this.GetQuery();
            if (query != null)
            {
                try
                {
                    SearchArgs args2 = new SearchArgs(query)
                    {
                        Type = SearchType.ContentEditor,
                        Limit = 0x19,
                        Root = this.ContentEditorDataContext.GetFolder()
                    };
                    SearchArgs args = args2;

                    using (new LongRunningOperationWatcher(200, "search pipeline", new string[0]))
                    {
                        CorePipeline.Run("search", args);
                    }

                    if (args.Result.Count == 0)
                    {
                        output.Write("<div style=\"padding:8px 0px 0px;font-style:italic\" align=\"center\">");
                        output.Write(Sitecore.Globalization.Translate.Text("There are no matches."));
                    }
                    else
                    {
                        output.Write("<table cellpadding='0' cellspacing='0' height='100%' width='100%'>");
                        string descendantsTitle = Sitecore.Globalization.Translate.Text("Subitems");
                        SearchResultCategoryCollection category = Enumerable.SingleOrDefault<SearchResultCategoryCollection>(args.Result.Categories, (Func<SearchResultCategoryCollection, bool>)(c => (c.Name == descendantsTitle)));
                        if (category != null)
                        {
                            this.RenderCategory(output, category);
                        }
                        foreach (SearchResultCategoryCollection categorys2 in args.Result.Categories)
                        {
                            if ((categorys2.Count != 0) && !(categorys2.Name == descendantsTitle))
                            {
                                this.RenderCategory(output, categorys2);
                            }
                        }
                        output.Write("<tr class='filler'><td height='100%' class='scSearchCategory'></td><td class='scSearchResults'></td></tr>");
                        output.Write("</table>");
                    }
                }
                catch (Exception exception)
                {
                    output = new HtmlTextWriter(new StringWriter());
                    output.Write(Sitecore.Globalization.Translate.Text("An error occured while searching. Rephrase the query."));
                    output.Write("<br/><br/>");
                    output.Write(exception.Message);
                }
            }
            else
            {
                output.Write(Sitecore.Globalization.Translate.Text("Enter a search query."));
            }
            Item folder = this.ContentEditorDataContext.GetFolder();
            Assert.IsNotNull(folder, "current item");
            string str = StringUtil.Clip(folder.DisplayName, 40, true);
            SheerResponse.SetInnerHtml("SearchResultsHeader", Sitecore.Globalization.Translate.Text("Search Results ({0})", new object[] { str }));
            SheerResponse.SetInnerHtml("SearchResult", output.InnerWriter.ToString());
            SheerResponse.SetStyle("ContentTreeHolder", "display", "none");
            SheerResponse.SetStyle("SearchResultHolder", "display", string.Empty);
        }