/// <summary> /// 获取年度计划列表 /// </summary> /// <returns></returns> public JsonResult GetApprovalShowList(int planType = 0, string name = "", string creater = "", int year = -1, int sort = -1, int updateType = -1, string deptids = "", int pageIndex = 1, int pageSize = 10) { try { var totalCount = 0; var cCount = 0; var dCount = 0; var zCount = 0; #region 条件 var where = " 1=1 "; if (!string.IsNullOrEmpty(name)) { where += " and TrainName like '%" + name.ReplaceSql() + "%'"; } if (!string.IsNullOrEmpty(creater)) { where += " and Realname like '%" + creater.ReplaceSql() + "%'"; } if (year > -1) { where += " and Year=" + year; } if (sort > -1) { where += " and SortID=" + sort; } #endregion var list = _planManager.GetApprovalShowList(CurrentUser.UserId, where, pageIndex, pageSize); if (list.Any()) { cCount = list.Count(p => p.PlanType == 0); dCount = list.Count(p => p.PlanType == 1); zCount = list.Count(p => p.PlanType == 2); } list = list.Where(p => p.PlanType == planType); if (updateType != -1) { if (updateType == 0) { list = list.Where(p => p.UpdateType == 0); } else { list = list.Where(p => p.UpdateType > 0); } } totalCount = list.Count(); list = list.Skip((pageIndex - 1) * pageSize).Take(pageSize); return(Json(new { dataList = list, recordCount = totalCount, cCount = cCount, dCount = dCount, zCount = zCount }, JsonRequestBehavior.AllowGet)); } catch { return(Json(new { dataList = new List <PlanClassShow>(), recordCount = 0, cCount = 0, dCount = 0, zCount = 0 }, JsonRequestBehavior.AllowGet)); } }