Exemplo n.º 1
0
        public ActionResult Getlist(string pagenum, string onepagecount)
        {
            DBModel.Common.ComResult com = new DBModel.Common.ComResult();
            if (!Regex.IsMatch(pagenum, @"(?i)^[0-9a-z\u4e00-\u9fa5]+$") && !string.IsNullOrEmpty(pagenum))
            {
                com.Msg   = "页数不正确";
                com.State = 0;
                return(Json(com));
            }

            if (!Regex.IsMatch(onepagecount, @"(?i)^[0-9a-z\u4e00-\u9fa5]+$") && !string.IsNullOrEmpty(onepagecount))
            {
                com.Msg   = "每页数量不正确";
                com.State = 0;
                return(Json(com));
            }
            int              totil     = 0;
            int              totilpage = 0;
            string           exmsg     = string.Empty;
            List <myprinter> mylist    = _service.Getpages(Convert.ToInt32(pagenum), Convert.ToInt32(onepagecount), out totil, out totilpage, out exmsg);

            if (!string.IsNullOrEmpty(exmsg))
            {
                com.Msg   = exmsg;
                com.State = 0;
                return(Json(com));
            }
            else
            {
                PrinterViewModel mylistview = new PrinterViewModel();
                mylistview.supplist   = mylist;
                mylistview.totil      = totil.ToString();
                mylistview.totilcount = totilpage.ToString();
                com.DataResult        = mylistview;
                com.State             = 1;
                return(Json(com));
            }
        }