public JsonResult Search(string term)
        {
            term = term.Trim().ToLower();

            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            var searchReturn = new System.Collections.Generic.List<SearchDTO>();
            var searchReturnBoard = new System.Collections.Generic.List<SearchDTO>();
            var searchReturnList = new System.Collections.Generic.List<SearchDTO>();
            var searchReturnCard = new System.Collections.Generic.List<SearchDTO>();

            //Realiza a pesquisa nos boards
            foreach (var board in _userRepo.AllUserBoards(User.Identity.Name))
            {
                if (board.Name.ToLower().Contains(term))
                {
                    searchReturnBoard.Add(new SearchDTO { label = board.Name, category = "Boards", url = string.Format("{0}", Url.Action("Details", "Board", new { id = board.Id })) });
                }

                //Realiza a pesquisa nas listas dos boards
                foreach (var list in _repo.GetAllListsExceptArchive(board.Id))
                {
                    if (list.Name.ToLower().Contains(term))
                    {
                        searchReturnList.Add(new SearchDTO { label = list.Name, category = "Lists", url = string.Format("{0}", Url.Action("Edit", "List", new { board = board.Id, list = list.Id })) });
                    }

                    //Realiza a pesquisa nos cartões das listas dos boards
                    foreach (var card in _repo.GetAllCards(board.Id, list.Id))
                    {
                        if (card.Name.ToLower().Contains(term))
                        {
                            searchReturnCard.Add(new SearchDTO { label = card.Name, category = "Cards", url = string.Format("{0}", Url.Action("Edit", "Card", new { board = board.Id, list = list.Id, id = card.Id })) });
                        }
                    }
                }
            }

            searchReturn.InsertRange(0, searchReturnCard);
            searchReturn.InsertRange(0, searchReturnList);
            searchReturn.InsertRange(0, searchReturnBoard);

            //Constrói resposta em JSON
            JsonResult data = new JsonResult();
            data.ContentEncoding = System.Text.Encoding.UTF8;
            data.ContentType = "json";
            data.JsonRequestBehavior = System.Web.Mvc.JsonRequestBehavior.AllowGet;
            data.Data = serializer.Serialize(searchReturn);
            return data;
        }
示例#2
0
        static int _m_InsertRange(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                System.Collections.Generic.List <string> gen_to_be_invoked = (System.Collections.Generic.List <string>)translator.FastGetCSObj(L, 1);



                {
                    int _index = LuaAPI.xlua_tointeger(L, 2);
                    System.Collections.Generic.IEnumerable <string> _collection = (System.Collections.Generic.IEnumerable <string>)translator.GetObject(L, 3, typeof(System.Collections.Generic.IEnumerable <string>));

                    gen_to_be_invoked.InsertRange(
                        _index,
                        _collection);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
示例#3
0
 private void makeFirst(System.Collections.Generic.List <Vector3> list, int index)
 {
     if (index != 0)
     {
         System.Collections.Generic.List <Vector3> range = list.GetRange(index, list.Count - index);
         list.RemoveRange(index, list.Count - index);
         list.InsertRange(0, range);
     }
 }
示例#4
0
        public RectangleFilter(Rectangle area, ObstacleRepresentation[] platforms, ObstacleRepresentation[] rectanglePlatforms, ObstacleRepresentation[] circlePlatforms) : base(area, platforms, rectanglePlatforms, circlePlatforms)
        {
            //xPlatforms = new List<ObstacleRepresentation>(platforms);
            yPlatforms = new List <ObstacleRepresentation>(platforms);
            yPlatforms.InsertRange(0, circlePlatforms);

            //xPlatforms = xPlatforms.OrderBy(o => o.X).ToList();
            yPlatforms = yPlatforms.OrderBy(o => o.Y).ToList();
        }
示例#5
0
        public void ReisenInsertRange(int index, ICollection range)
        {
            //Generic
            List <Reise> rl = new List <Reise>();

            foreach (Reise r in range)
            {
                rl.Add(r);
            }
            dieReisen.InsertRange(index, rl);             //range
        }
示例#6
0
 static public int InsertRange(IntPtr l)
 {
     try {
         System.Collections.Generic.List <WWWRequest> self = (System.Collections.Generic.List <WWWRequest>)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         System.Collections.Generic.IEnumerable <WWWRequest> a2;
         checkType(l, 3, out a2);
         self.InsertRange(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#7
0
        static int InsertRange(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            System.Collections.Generic.List <int> __cl_gen_to_be_invoked = (System.Collections.Generic.List <int>)translator.FastGetCSObj(L, 1);


            try {
                {
                    int index = LuaAPI.xlua_tointeger(L, 2);
                    System.Collections.Generic.IEnumerable <int> collection = (System.Collections.Generic.IEnumerable <int>)translator.GetObject(L, 3, typeof(System.Collections.Generic.IEnumerable <int>));

                    __cl_gen_to_be_invoked.InsertRange(index, collection);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
示例#8
0
文件: List.cs 项目: sasiit23/smah1
 public void InsertRange(int index, IEnumerable <T> collection)
 {
     list.InsertRange(index, collection); OnCountChanged();
 }