public List <UploadingPointData> GetArrayForUpload()
        {
            var  user  = Membership.GetUser();
            Guid myUID = user == null ? new Guid() : (Guid)user.ProviderUserKey;
            var  db    = new DB();
            IQueryable <MapObject> objList = db.MapObjects.AsQueryable();

            if (SearchWord.IsFilled())
            {
                objList = objList.Where(
                    x =>
                    SqlMethods.Like(x.Address ?? "", "%" + SearchWord.Replace(" ", "%") + "%") ||
                    SqlMethods.Like(x.Name ?? "", "%" + SearchWord.Replace(" ", "%") + "%") ||
                    SqlMethods.Like(x.Description ?? "", "%" + SearchWord.Replace(" ", "%") + "%"));
            }
            else
            {
                objList =
                    objList.Where(
                        x =>
                        x.MapCoords.Any(
                            z =>
                            z.XPos >= CurrentMapView.LeftUpperCorner.Lat &&
                            z.XPos <= CurrentMapView.RightBottomCorner.Lat &&
                            z.YPos >= CurrentMapView.RightBottomCorner.Lng &&
                            z.YPos <= CurrentMapView.LeftUpperCorner.Lng));
            }
            if (IsFavorite == 1 && user != null)
            {
                objList = objList.Where(x => x.CreatorID == myUID);
            }

            if (SmokingType.HasValue)
            {
                objList = objList.Where(x => x.ObjectType == SmokingType);
            }

            if (ObjectFilter.SelectedTypes.Any())
            {
                var typeFiltered = (from type in ObjectFilter.SelectedTypes
                                    let qs = objList.Where(x => x.TypeID == type.TypeID)
                                             select
                                             type.ObjectType == 0
                                            ? qs.Where(x => x.MapCoords.All(z => z.IsMarker))
                                            : qs.Where(x => x.MapCoords.Any(z => !z.IsMarker)))
                                   .Aggregate <IQueryable <MapObject>, IQueryable <MapObject> >(null,
                                                                                                (current, qs) =>
                                                                                                current == null ? qs : current.Concat(qs));
                objList = typeFiltered;
            }


            if (LoadedPoints.Any())
            {
                objList = objList.Where(x => !LoadedPoints.Take(500).Contains(x.ID));
            }
            return(objList.Take(100).ToList().Select(x => x.ToUploadData()).ToList());
        }
Example #2
0
        private void Searcher(String str)
        {
            String SearchWord;

            Displayer("けんさくなーう");
            if (str.IndexOf("Youtubeで") >= 0)
            {
                SearchWord = str.Replace("をYoutubeで検索して", "");
                Displayer(SearchWord + "をYoutubeで検索します");
                //SpeeSy.Speak(SearchWord + "を検索します");
                SearchWord = SearchWord.Replace("Youtubeで", "");
                Process.Start("https://www.youtube.com/results?search_query=" + SearchWord);
            }
            else
            {
                SearchWord = str.Replace("を検索して", "");
                Displayer(SearchWord + "を検索します");
                //SpeeSy.Speak(SearchWord + "を検索します");
                Process.Start("https://search.yahoo.co.jp/search?p=" + SearchWord + "&ei=UTF-8");
            }
        }