Example #1
0
        public ActionResult Search(string name, string comm, string addr)
        {
            if (!AccountModel.AuthenticateMobile(checkorgmembersonly: true))
            {
                return(Content("not authorized"));
            }
            Response.NoCache();

            var m = new SearchModel(name, comm, addr);

            return(new SearchResult0(m.PeopleList(), m.Count));
        }
Example #2
0
        public ActionResult SearchResults(string name, string comm, string addr)
        {
            if (!AccountModel.AuthenticateMobile(checkorgmembersonly: true))
            {
                return(Content("not authorized"));
            }
            if (!CMSRoleProvider.provider.IsUserInRole(AccountModel.UserName2, "Access"))
            {
                return(Content("not authorized"));
            }
            Response.NoCache();

            DbUtil.LogActivity("iphone search '{0}'".Fmt(name));
            var m = new SearchModel(name, comm, addr);

            return(new SearchResult(m.PeopleList(), m.Count));
        }
Example #3
0
        public ActionResult Search(string name, string comm, string addr)
        {
            BaseReturn br = new BaseReturn();
            List<MobilePerson> mp = new List<MobilePerson>();

            var m = new SearchModel(name, comm, addr);

            br.type = 1;
            br.count = m.Count;

            foreach( var item in m.ApplySearch().OrderBy(p => p.Name2).Take(20) )
            {
                mp.Add(new MobilePerson().populate(item));
            }

            br.data = JSONHelper.JsonSerializer<List<MobilePerson>>(mp);
            return br;
        }
Example #4
0
        public ActionResult DoSearch(string name, string comm, string addr)
        {
            var authError = Authenticate();
            if (authError != null) return authError;

            BaseReturn br = new BaseReturn();
            List<MobilePerson> mp = new List<MobilePerson>();

            var m = new SearchModel(name, comm, addr);

            br.error = 0;
            br.type = 1;
            br.count = m.Count;

            foreach (var item in m.ApplySearch().OrderBy(p => p.Name2).Take(20))
            {
                mp.Add(new MobilePerson().populate(item));
            }

            br.data = JsonConvert.SerializeObject(mp);
            return br;
        }
Example #5
0
        public ActionResult SearchResults(string name, string comm, string addr)
        {
            if (!AccountModel.AuthenticateMobile(checkorgmembersonly: true))
                return Content("not authorized");
            if (!CMSRoleProvider.provider.IsUserInRole(AccountModel.UserName2, "Access"))
                return Content("not authorized");
            Response.NoCache();

            DbUtil.LogActivity("iphone search '{0}'".Fmt(name));
            var m = new SearchModel(name, comm, addr);
            return new SearchResult(m.PeopleList(), m.Count);
        }
Example #6
0
        public ActionResult Search(string name, string comm, string addr)
        {
            if (!AccountModel.AuthenticateMobile(checkorgmembersonly: true))
                return Content("not authorized");
            Response.NoCache();

            var m = new SearchModel(name, comm, addr);
            return new SearchResult0(m.PeopleList(), m.Count);
        }
Example #7
0
        public ActionResult FetchPeople(string data)
        {
            // Authenticate first
            var authError = Authenticate();
            if (authError != null) return authError;

            // Check to see if type matches
            BaseMessage dataIn = BaseMessage.createFromString(data);
            if (dataIn.type != BaseMessage.API_TYPE_PEOPLE_SEARCH)
                return BaseMessage.createTypeErrorReturn();

            // Everything is in order, start the return
            MobilePostSearch mps = JsonConvert.DeserializeObject<MobilePostSearch>(dataIn.data);

            BaseMessage br = new BaseMessage();

            var m = new CmsWeb.Models.iPhone.SearchModel(mps.name, mps.comm, mps.addr);

            br.error = 0;
            br.type = BaseMessage.API_TYPE_PEOPLE_SEARCH;
            br.count = m.Count;

            switch (dataIn.device)
            {
                case BaseMessage.API_DEVICE_ANDROID:
                    {
                        Dictionary<int, MobilePerson> mpl = new Dictionary<int, MobilePerson>();

                        MobilePerson mp;

                        foreach (var item in m.ApplySearch().OrderBy(p => p.Name2).Take(20))
                        {
                            mp = new MobilePerson().populate(item);
                            mpl.Add(mp.id, mp);
                        }

                        br.data = JsonConvert.SerializeObject(mpl);
                        break;
                    }

                case BaseMessage.API_DEVICE_IOS:
                    {
                        List<MobilePerson> mp = new List<MobilePerson>();

                        foreach (var item in m.ApplySearch().OrderBy(p => p.Name2).Take(20))
                        {
                            mp.Add(new MobilePerson().populate(item));
                        }

                        br.data = JsonConvert.SerializeObject(mp);
                        break;
                    }

                default: break;
            }

            return br;
        }
Example #8
0
        public ActionResult FetchPeople(string data)
        {
            // Authenticate first
            var authError = Authenticate();

            if (authError != null)
            {
                return(authError);
            }

            // Check to see if type matches
            BaseMessage dataIn = BaseMessage.createFromString(data);

            if (dataIn.type != BaseMessage.API_TYPE_PEOPLE_SEARCH)
            {
                return(BaseMessage.createTypeErrorReturn());
            }

            // Everything is in order, start the return
            MobilePostSearch mps = JsonConvert.DeserializeObject <MobilePostSearch>(dataIn.data);

            BaseMessage br = new BaseMessage();

            var m = new CmsWeb.Models.iPhone.SearchModel(mps.name, mps.comm, mps.addr);

            br.error = 0;
            br.type  = BaseMessage.API_TYPE_PEOPLE_SEARCH;
            br.count = m.Count;

            switch (dataIn.device)
            {
            case BaseMessage.API_DEVICE_ANDROID:
            {
                Dictionary <int, MobilePerson> mpl = new Dictionary <int, MobilePerson>();

                MobilePerson mp;

                foreach (var item in m.ApplySearch().OrderBy(p => p.Name2).Take(20))
                {
                    mp = new MobilePerson().populate(item);
                    mpl.Add(mp.id, mp);
                }

                br.data = JsonConvert.SerializeObject(mpl);
                break;
            }

            case BaseMessage.API_DEVICE_IOS:
            {
                List <MobilePerson> mp = new List <MobilePerson>();

                foreach (var item in m.ApplySearch().OrderBy(p => p.Name2).Take(20))
                {
                    mp.Add(new MobilePerson().populate(item));
                }

                br.data = JsonConvert.SerializeObject(mp);
                break;
            }

            default: break;
            }

            return(br);
        }