public JsonResult Index(LoadWebCommandListRequest req)
        {
            ViewBag.commandid = req.CommandId.ToString();

            ResponseBase <PageInfoResponse <List <tb_commandlibdetail> > > list = PostToServer <PageInfoResponse <List <tb_commandlibdetail> >, LoadWebCommandListRequest>(ClientProxy.LoadWebCommandList_Url, new LoadWebCommandListRequest()
            {
                CommandId = req.CommandId, iDisplayLength = req.iDisplayLength, iDisplayStart = req.iDisplayStart, sEcho = req.sEcho, Source = Source.Web
            });

            if (list.Status != ResponesStatus.Success)
            {
                return(Json(new
                {
                    sEcho = 0,
                    iTotalRecords = 0,
                    iTotalDisplayRecords = 0,
                    aaData = new List <string>()
                }));
            }
            return(Json(list.Data));
        }
Example #2
0
 public ResponseBase <PageInfoResponse <List <tb_commandlibdetail> > > LoadWebCommandList(LoadWebCommandListRequest req)
 {
     try
     {
         int pageIndex  = (req.iDisplayStart / req.iDisplayLength) + 1;
         int totalCount = 0;
         List <tb_commandlibdetail> lib = cmdlibdetailrepository.Find(out totalCount, pageIndex, req.iDisplayLength, x => x.id.ToString(),
                                                                      x => x.isdel == 0 &&
                                                                      x.id == (req.CommandId <= 0 ?x.id:req.CommandId)
                                                                      ).ToList();
         if (lib.Count <= 0)
         {
             return(ResponseToClient <PageInfoResponse <List <tb_commandlibdetail> > >(ResponesStatus.Failed, "当前暂无命令列表"));
         }
         return(ResponseToClient <PageInfoResponse <List <tb_commandlibdetail> > >(ResponesStatus.Success, "", new PageInfoResponse <List <tb_commandlibdetail> >()
         {
             aaData = lib, iTotalDisplayRecords = totalCount, iTotalRecords = totalCount, sEcho = req.sEcho
         }));
     }
     catch (Exception ex)
     {
         return(ResponseToClient <PageInfoResponse <List <tb_commandlibdetail> > >(ResponesStatus.Exception, JsonConvert.SerializeObject(ex)));
     }
 }