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)); }
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)); }
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; }
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; }
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); }
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); }
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; }
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); }