コード例 #1
0
        public ActionResult GetAllEpFamily(string eid)
        {
            //"[{ id: 1, name: \"林三\", sex: \"男\", birthday: \"1989/01/12\", score: 63.3 }]"
            //拿到前台发送来的是当前页面和页的大小
            int pageSize  = Request["pageSize"] == null ? 10 : int.Parse(Request["pageSize"]);
            int pageIndex = Request["page"] == null ? 1 : int.Parse(Request["page"]);
            int total     = 0;

            short delNormal = (short)Model.Enum.DelFlagEnum.Normal;

            #region 分页查询
            int intEid;
            if (eid != "")
            {
                intEid = int.Parse(eid);
            }
            else
            {
                intEid = 0;
            }

            var jtcyList = FamilyService.LoadPageEntities(pageSize, pageIndex, out total, d => d.DelFlag == delNormal && d.EmployeeID == intEid, d => d.ID,
                                                          true);

            var data = new
            {
                Total = total,
                Rows  = (from u in jtcyList
                         select
                         new { u.ID, u.Code, u.Name, u.Relation, u.Phone, u.SubBy
                               , SubTime = u.SubTime.ToString("yyyy-MM-dd")
                               , TakeEffectTime = u.TakeEffectTime.ToString("yyyy-MM-dd")
                               , LoseEffectTime = u.LoseEffectTime.ToString("yyyy-MM-dd")
                               , u.Remark }).ToList()
            };

            return(Json(data, JsonRequestBehavior.AllowGet));

            #endregion
        }