Esempio n. 1
0
        /// <summary>
        /// 联系人的搜索
        /// </summary>
        /// <returns></returns>
        public ActionResult SearchMember()
        {
            string searchText = Request.QueryString["appendedInputButtons"];

            MODEL.ViewModel.PageModelInMsg pageModel = new MODEL.ViewModel.PageModelInMsg();
            int    pageIndex = 1;
            int    count     = 1;
            string flage     = Request.QueryString["flage"] == null ? null : Request.QueryString["flage"].ToString();

            if (flage == "next")
            {
                pageIndex = Request.QueryString["pageIndex"] == null ? 1 : int.Parse(Request.QueryString["pageIndex"]) + 1;
            }
            else if (flage == "front")
            {
                pageIndex = Request.QueryString["pageIndex"] == null ? 1 : int.Parse(Request.QueryString["pageIndex"]) - 1;
            }

            pageModel.PageIndex = pageIndex;
            count = OperateContext.Current.BLLSession.IMemberInformationBLL.GetListBy(u => u.StuNum.Length > 0).Count();
            pageModel.MessageCount = count;
            pageModel.PageCount    = (int)Math.Ceiling(count / 5f) == 0 ? 1 : (int)Math.Ceiling(count / 5f);

            if (pageModel.PageIndex > pageModel.PageCount)
            {
                pageModel.PageIndex = pageModel.PageCount;
            }


            List <MODEL.T_MemberInformation> list = OperateContext.Current.BLLSession.IMemberInformationBLL.GetPagedList(pageModel.PageIndex, 5, u => u.StuName.Contains(searchText) || u.StuNum.Contains(searchText) || u.QQNum.Contains(searchText), u => u.StuNum);

            List <MODEL.ViewModel.MenberInfo> listToJson = new List <MODEL.ViewModel.MenberInfo>();

            foreach (MODEL.T_MemberInformation mi in list)
            {
                MODEL.ViewModel.MenberInfo model = new MODEL.ViewModel.MenberInfo();
                model.StuNum  = mi.StuNum;
                model.StuName = mi.StuName;
                model.QQNum   = mi.QQNum;
                model.TelNum  = null;
                model.Email   = mi.Email;
                listToJson.Add(model);
            }

            return(Json(listToJson, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 联系人的搜索
        /// </summary>
        /// <returns></returns>
        public ActionResult SearchMember()
        {
            string searchText = Request.QueryString["appendedInputButtons"];

            MODEL.ViewModel.PageModelInMsg pageModel = new MODEL.ViewModel.PageModelInMsg();
            int pageIndex = 1;
            int count = 1;
            string flage = Request.QueryString["flage"] == null ? null : Request.QueryString["flage"].ToString();
            if (flage == "next")
            {
                pageIndex = Request.QueryString["pageIndex"] == null ? 1 : int.Parse(Request.QueryString["pageIndex"]) + 1;
            }
            else if (flage == "front")
            {
                pageIndex = Request.QueryString["pageIndex"] == null ? 1 : int.Parse(Request.QueryString["pageIndex"]) - 1;
            }

            pageModel.PageIndex = pageIndex;
            count = OperateContext.Current.BLLSession.IMemberInformationBLL.GetListBy(u => u.StuNum.Length > 0).Count();
            pageModel.MessageCount = count;
            pageModel.PageCount = (int)Math.Ceiling(count / 5f) == 0 ? 1 : (int)Math.Ceiling(count / 5f);

            if (pageModel.PageIndex > pageModel.PageCount)
            {
                pageModel.PageIndex = pageModel.PageCount;
            }

            List<MODEL.T_MemberInformation> list = OperateContext.Current.BLLSession.IMemberInformationBLL.GetPagedList(pageModel.PageIndex, 5, u => u.StuName.Contains(searchText) || u.StuNum.Contains(searchText) || u.QQNum.Contains(searchText), u => u.StuNum);

            List<MODEL.ViewModel.MenberInfo> listToJson = new List<MODEL.ViewModel.MenberInfo>();
            foreach (MODEL.T_MemberInformation mi in list)
            {
                MODEL.ViewModel.MenberInfo model = new MODEL.ViewModel.MenberInfo();
                model.StuNum = mi.StuNum;
                model.StuName = mi.StuName;
                model.QQNum = mi.QQNum;
                model.TelNum = null;
                model.Email = mi.Email;
                listToJson.Add(model);
            }

            return Json(listToJson, JsonRequestBehavior.AllowGet);
        }