public ActionResult GetPageReportList() { //need group id GridRequest req = new GridRequest(Request); Expression <Func <PageReport, bool> > predicate = FilterHelper.GetExpression <PageReport>(req.FilterGroup); int iCount = req.PageCondition.RowCount; var id = 0; if (Int32.TryParse(Request["groupId"], out id)) { var appName = string.Empty; var pageGroup = _objService.Repository.GetByKey(id); var corpId = CommonService.GetSysConfig("WeixinCorpId", string.Empty); appName = WeChatCommonService.lstSysWeChatConfig.Where(a => a.WeixinCorpId == corpId).SingleOrDefault(p => p.WeixinAppId.Equals(pageGroup.AppId.ToString())).AppName; List <string> strs = new List <string>(pageGroup.PageUrl.ToLower().Split(',')); predicate = predicate.AndAlso(a => a.Appid == pageGroup.AppId && strs.Contains(a.PageUrl.ToLower())); var list = _pageReportService.GetReportList(predicate, req.PageCondition); list.ForEach(item => { item.AppName = appName; item.GroupName = pageGroup.GroupName; }); return(GetPageResult(list, req)); } else { return(GetPageResult(null, req)); } }
public ActionResult GetPageReportList() { //need group id GridRequest req = new GridRequest(Request); Expression <Func <PageReport, bool> > predicate = FilterHelper.GetExpression <PageReport>(req.FilterGroup); int iCount = req.PageCondition.RowCount; var id = 0; if (Int32.TryParse(Request["groupId"], out id)) { var appName = string.Empty; var pageGroup = _objService.Repository.GetByKey(id); var corpId = CommonService.GetSysConfig("WeixinCorpId", string.Empty); //appName = CommonService.lstSysWeChatConfig.Where(a => a.WeixinCorpId == corpId).SingleOrDefault(p => p.WeixinAppId.Equals(pageGroup.AppId.ToString())).AppName; List <string> strs = new List <string>(pageGroup.PageUrl.ToLower().Split(',')); //predicate = predicate.AndAlso(a => a.Appid == pageGroup.AppId && strs.Contains(a.PageUrl.ToLower())); predicate = predicate.AndAlso(a => strs.Contains(a.PageUrl.ToLower())); string strStartTime = Request["StartTime"]; string strEndTime = Request["EndTime"]; if (!CheckDate(strStartTime, strEndTime)) { return(Json(GetErrorJson(), JsonRequestBehavior.AllowGet)); } if (!string.IsNullOrEmpty(strStartTime) && !string.IsNullOrEmpty(strEndTime)) { strStartTime = strStartTime + " 00:00:00"; strEndTime = strEndTime + " 23:59:59"; DateTime strtime = Convert.ToDateTime(strStartTime); DateTime endtime = Convert.ToDateTime(strEndTime); predicate = predicate.AndAlso(a => a.CreatedDate >= strtime && a.CreatedDate <= endtime); } var list = _pageReportService.GetReportList(predicate, req.PageCondition); list.ForEach(item => { //item.AppName = appName; item.GroupName = pageGroup.GroupName; }); return(GetPageResult(list, req)); } else { return(GetPageResult(null, req)); } }