public ActionResult PeopleSearch(int?SenderId, string LampId, string PersonName, int?PersonId, int?DeptId, int?RankId, DateTime?ReportForTime, WorkPlace?WorkPlace)
        {
            var model = new PeopleSearchModel();

            if (Request.Form.Count == 0)
            {
                PopulatePeopleSearchListItems(model);
                return(View(model));
            }

            var criteria = new PeopleSearchCriteria {
                SenderId      = SenderId,
                LampId        = LampId,
                PersonName    = PersonName,
                PersonId      = PersonId,
                DeptId        = DeptId,
                RankId        = RankId,
                ReportForTime = ReportForTime,
                WorkPlace     = WorkPlace.Value
            };
            var list = _dao.GetPeopleSearchReport(criteria);

            model.ReportItems = list;
            if (Request.IsAjaxRequest())
            {
                return(PartialView("PeopleSearchList", model));
            }
            else
            {
                PopulatePeopleSearchListItems(model);
            }
            return(View(model));
        }
        public ActionResult ConvertToQuery()
        {
            var m = new PeopleSearchModel();

            UpdateModel(m);
            UpdateModel(m.m);
            Session["FindPeopleInfo"] = m.m;
            return(Content("/QueryBuilder/Main/" + m.ConvertToQuery()));
        }
        public ActionResult Results()
        {
            var m = new PeopleSearchModel();

            UpdateModel(m);
            UpdateModel(m.m);
            Session["FindPeopleInfo"] = m.m;
            return(View(m));
        }
Beispiel #4
0
 public void FetchPeople_ApostropheSearch_Test(string name)
 {
     using (var db = CMSDataContext.Create(DatabaseFixture.Host))
     {
         ContextTestUtils.CreateMockHttpContext();
         var m = new PeopleSearchModel(db);
         var p = MockPeople.CreateSavePerson(db, lastName: name);
         m.m.name = name.Replace("'", string.Empty);
         var people = m.FetchPeople().Any();
         people.ShouldBeTrue();
     }
 }
 private void PopulatePeopleSearchListItems(PeopleSearchModel model)
 {
     model.Departments = ControlHelper.GetListItems(_dao.GetDepartments());
     model.Departments.Insert(0, new SelectListItem()
     {
         Value = "", Text = "所有部门", Selected = true
     });
     model.Ranks = ControlHelper.GetListItems(_dao.GetRanks());
     model.Ranks.Insert(0, new SelectListItem()
     {
         Value = "", Text = "所有职务", Selected = true
     });
 }
Beispiel #6
0
        public ActionResult Search(string name, string comm, string addr)
        {
            if (!Authenticate(checkOrgLeadersOnly: true))
            {
                return(Content("not authorized"));
            }
            Response.NoCache();

            var m = new PeopleSearchModel();

            m.m.name          = name;
            m.m.communication = comm;
            m.m.address       = addr;
            return(new SearchResult0(m.FetchPeople()));
        }
        public ActionResult SearchByPhoto(PeopleSearchModel model, string returnUrl)
        {
            if (!Request.IsAuthenticated)
            {
                return(RedirectToAction("LogOnByUserName", "Account"));
            }
            Session["ComparedPhoto"] = null;
            byte[] userPhoto = (byte[])Session["ContentStream"];
            double runTime   = -1;

            try
            {
                if (Request.Form["Algorithm"] == null)
                {
                    throw new Exception();
                }
                support.Algorithm alg = support.Algorithm.EigenFaces;
                if (!Enum.TryParse <support.Algorithm>(Request.Form["Algorithm"].ToString(), out alg))
                {
                    throw new Exception();
                }
                AccountMembershipService service = new AccountMembershipService();
                MembershipPerson         person  = null;
                if (service.ValidatePerson(userPhoto, out person, alg, out runTime))
                {
                    Session["LastRecognitionAlgorithm"] = Enum.GetName(typeof(support.Algorithm), alg);
                    Session["LastRecognitionTime"]      = runTime;
                    if (person != null)
                    {
                        Session["PersonForReview"] = person;
                        Session["ComparedPhoto"]   = userPhoto;
                        return(View("PersonSearch"));
                    }
                }
            }
            catch
            { }
            finally
            {
//                 Session["ContentStream"] = null;
//                 Session["ContentLength"] = null;
//                 Session["ContentType"] = null;
            }
            ModelState.AddModelError("", "No record found.");
            return(View("PersonSearch"));
        }
        public ActionResult Index(string name)
        {
            var m = new PeopleSearchModel();

            if (name.HasValue())
            {
                m.m.name = name;
            }
            else
            {
                var i = Session["FindPeopleInfo"] as PeopleSearchInfo;
                if (i != null)
                {
                    m.m = i;
                }
            }

            return(View(m));
        }
Beispiel #9
0
        public ActionResult Index(string name)
        {
            var m = new PeopleSearchModel(CurrentDatabase);

            if (name.HasValue())
            {
                m.m.name = name;
            }
            else
            {
                var i = RequestManager.SessionProvider.Get <PeopleSearchInfo>("FindPeopleInfo");
                if (i != null)
                {
                    m.m = i;
                }
            }

            return(View(m));
        }
Beispiel #10
0
        public ActionResult SearchResults(string name, string comm, string addr)
        {
            if (!Authenticate(checkOrgLeadersOnly: true))
            {
                return(Content("not authorized"));
            }
            if (!CMSRoleProvider.provider.IsUserInRole(AccountModel.UserName2, "Access"))
            {
                return(Content("not authorized"));
            }
            Response.NoCache();

            DbUtil.LogActivity($"iphone search '{name}'");
            var m = new PeopleSearchModel();

            m.m.name          = name;
            m.m.communication = comm;
            m.m.address       = addr;
            return(new SearchResult(m.FetchPeople()));
        }
        public ActionResult Index(string name)
        {
            var m = new PeopleSearchModel();

            if (name.HasValue())
            {
                m.m.name = name;
//                if (m.Count() == 1)
//                {
//                    var pid = m.FetchPeople().Single().PeopleId;
//                    return Redirect("/Person/Index/" + pid);
//                }
            }
            else
            {
                var i = Session["FindPeopleInfo"] as PeopleSearchInfo;
                if (i != null)
                {
                    m.m = i;
                }
            }

            return(View(m));
        }
 public ActionResult ConvertToQuery(PeopleSearchModel m)
 {
     UpdateModel(m.m);
     Session["FindPeopleInfo"] = m.m;
     return(Content(m.ConvertToSearch()));
 }
 public ActionResult Results(PeopleSearchModel m)
 {
     UpdateModel(m.m);
     Session["FindPeopleInfo"] = m.m;
     return(View(m));
 }
Beispiel #14
0
 public ActionResult ConvertToQuery(PeopleSearchModel m)
 {
     UpdateModel(m.m);
     RequestManager.SessionProvider.Add("FindPeopleInfo", m.m);
     return(Content(m.ConvertToSearch()));
 }
Beispiel #15
0
 public ActionResult Results(PeopleSearchModel m)
 {
     UpdateModel(m.m);
     RequestManager.SessionProvider.Add("FindPeopleInfo", m.m);
     return(View(m));
 }