public ActionResult NodeIndex(LoadNodePerformancelistRequest req) { ViewBag.NodeId = req.NodeId.ToString(); ViewBag.NodeRunStatus = req.NodeRunStatus.ToString(); ResponseBase <PageInfoResponse <LoadNodePerformancelistResponse> > result = PostToServer <PageInfoResponse <LoadNodePerformancelistResponse>, LoadNodePerformancelistRequest>(ClientProxy.LoadNodePerformanceList_Url, new LoadNodePerformancelistRequest() { NodeId = req.NodeId, Source = Model.Source.Web, sEcho = 1, iDisplayLength = 10, iDisplayStart = 1, NodeRunStatus = req.NodeRunStatus }); if (result.Status != ResponesStatus.Success) { return(View(new LoadNodePerformancelistResponse())); } return(View(result.Data.aaData)); }
public ResponseBase <PageInfoResponse <LoadNodePerformancelistResponse> > LoadNodePerformancelist(LoadNodePerformancelistRequest req) { try { int pageIndex = (req.iDisplayStart / req.iDisplayLength) + 1; int totalCount = 0; LoadNodePerformancelistResponse performanceDetail = new LoadNodePerformancelistResponse(); List <int> nodeidlist = noderep.Find(out totalCount, pageIndex, req.iDisplayLength, m => m.id.ToString(), x => x.nodestatus == (req.NodeRunStatus <= 0?x.nodestatus:req.NodeRunStatus) && x.id == (req.NodeId <= 0?x.id:req.NodeId)).Select(k => k.id).ToList(); nodeidlist.ForEach(m => { var performancelist = nodeperformanceRep.Find(x => m == x.nodeid && x.nodeid == (req.NodeId <= 0?x.nodeid:req.NodeId)).OrderByDescending(x => x.lastupdatetime).Take(15).ToList().OrderBy(x => x.lastupdatetime).ToList(); performancelist.ForEach(x => { if (performanceDetail.NodePerfomance.ContainsKey(x.nodeid.ToString())) { performanceDetail.NodePerfomance[x.nodeid.ToString()].Add(x); } else { performanceDetail.NodePerfomance.Add(x.nodeid.ToString(), new List <tb_nodeperformance>() { x }); } }); }); return(ResponseToClient <PageInfoResponse <LoadNodePerformancelistResponse> >(ResponesStatus.Success, "", new PageInfoResponse <LoadNodePerformancelistResponse>() { aaData = performanceDetail, iTotalDisplayRecords = totalCount, iTotalRecords = totalCount, sEcho = req.sEcho })); } catch (Exception ex) { return(ResponseToClient <PageInfoResponse <LoadNodePerformancelistResponse> >(ResponesStatus.Exception, JsonConvert.SerializeObject(ex))); } }