public virtual JsonResult DropList(string filterExpression, string pySearch) { try { ClearClientPageCache(Response); IEntry rep = EntryRepository; CacheInit.RefreshCache(HttpContext, rep, ControllerName + "DropList", DateTime.Now.AddMinutes(CacheExpiryMinute), CachePriority, CacheCreateType.IfNoThenGenerated); DataTable source = (DataTable)HttpContext.Cache[ControllerName + "DropList"]; filterExpression = DFT.HandleExpress(filterExpression); List <DropListSource> dropList = rep.DropList(source, filterExpression); if (DataConvert.ToString(pySearch) != "") { List <DropListSource> filterDrop = new List <DropListSource>(); foreach (var obj in dropList) { string pyf = PinYin.GetFirstPinyin(DataConvert.ToString(obj.Text)).ToUpper(); string[] pyfs = pyf.Split(','); foreach (string py in pyfs) { if (py.StartsWith(pySearch.ToUpper()) && !filterDrop.Contains(obj)) { filterDrop.Add(obj); } } } return(DropListJson(filterDrop)); } return(DropListJson(dropList)); } catch (Exception ex) { AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "MasterController.DropList", ControllerName + "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace); return(new JsonResult()); } }
public NodesFragment() { InitializeComponent(); var loaded = Observable.FromEventPattern <RoutedEventArgs>(AllNodesFragment, nameof(AllNodesFragment.Loaded)) .SelectMany(x => ApiClient.GetNodes()) .Retry(10) .Select(x => { return(x.GroupBy(y => { var begin = y.Title.Trim().First(); if (begin >= 'A' && begin <= 'Z') { return $"{begin}"; } if (begin >= 'a' && begin <= 'z') { return $"{(char)(begin + 'A' - 'a')}"; } if (begin >= 0 && begin <= 256) { return "0-9"; } var first = PinYin.GetFirstPinyin(begin.ToString()); return string.IsNullOrEmpty(first) ? "其他" : first; }) .Select(y => new NodeInGroup { Key = y.Key, NodeContent = y.ToList() }) .OrderBy(y => y.Key)); }) .ObserveOnCoreDispatcher() .Subscribe(x => { SortNodesCVS.Source = x; OutView.ItemsSource = SortNodesCVS.View.CollectionGroups; InView.ItemsSource = SortNodesCVS.View; }); var click = Observable.FromEventPattern <ItemClickEventArgs>(InView, nameof(InView.ItemClick)) .Select(x => x.EventArgs.ClickedItem as NodeModel) .ObserveOnCoreDispatcher() .Subscribe(x => PageStack.Next("Left", "Right", typeof(OneNodeTopicsView), x)); this.Unloaded += (s, e) => { loaded.Dispose(); click.Dispose(); }; }