/// <summary> /// 分页获取按钮列表 /// </summary> /// <param name="search"></param> /// <returns></returns> public static PagedList <SYSButton> GetButtonList(ButtonListSearchModel search) { string table = string.Empty, fields = string.Empty, orderby = string.Empty, where = string.Empty; //定义结构 fields = @" * "; //输出字段 table = @" SYS_Button "; //表或者视图 orderby = "BTN_Id"; //排序信息 StringBuilder sb = new StringBuilder(); //构建where条件 sb.Append(" 1=1 "); if (!string.IsNullOrWhiteSpace(search.BTN_Name)) //按钮中文名称 { sb.AppendFormat(" and BTN_Name like '%{0}%' ", search.BTN_Name); } if (!string.IsNullOrWhiteSpace(search.BTN_Name_En))//城市 { sb.AppendFormat(" and BTN_Name_En like '%{0}%' ", search.BTN_Name_En); } where = sb.ToString(); int allcount = 0; var list = CommonPage <SYSButton> .GetPageList( out allcount, table, fields : fields, where : where.Trim(), orderby : orderby, pageindex : search.CurrentPage, pagesize : search.PageSize, connect : DBKeys.PRX); return(new PagedList <SYSButton>(list, search.CurrentPage, search.PageSize, allcount)); }
// // GET: /ButtonList/ /// <summary> /// 按钮查询 /// </summary> /// <param name="search"></param> /// <returns></returns> public ActionResult ButtonList(ButtonListSearchModel search) { ButtonListViewModel model = new ButtonListViewModel(); //页面模型 model.search = search; //页面的搜索模型 model.search.PageSize = 15; //每页显示 model.search.CurrentPage = Convert.ToInt32(Request["pageindex"]) <= 0 ? 1 : Convert.ToInt32(Request["pageindex"]); //当前页 //按钮下拉项 List <CommonEntity> ButtonIL = CommonData.GetDictionaryList(1); //1是字典类型值,仅供测试参考 model.buttonIL = CommonData.Instance.GetBropDownListData(ButtonIL); model.buttonlist = ButtonData.GetButtonList(search); //填充页面模型数据 return(View(model)); //返回页面模型 }