public CommonPagedDataViewModel <ResourceModel> GetDataGridDataByCondition(int page, int rows, string name, string code)
        {
            CommonPagedDataViewModel <ResourceModel> result = new CommonPagedDataViewModel <ResourceModel>();

            try
            {
                result = Resourcebll.GetResourceByCondition(page, rows, name, code);
            }
            catch (Exception ex)
            {
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <param name="name">业务系统名称</param>
        /// <param name="code">业务系统编码</param>
        /// <returns></returns>
        public ActionResult GetDataGridDataByCondition(int page, int rows, string name, string code)
        {
            AjaxViewModel <CommonPagedDataViewModel <ResourceModel> > result = new AjaxViewModel <CommonPagedDataViewModel <ResourceModel> >();

            try
            {
                CommonPagedDataViewModel <ResourceModel> data = ResourceBll.GetResourceByCondition(page, rows, name, code);
                result = new AjaxViewModel <CommonPagedDataViewModel <ResourceModel> >
                {
                    isSuccess = true,
                    obj       = data
                };
            }
            catch (Exception ex)
            {
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public CommonPagedDataViewModel <ResourceModel> GetResourceByCondition(int pageIndex, int pageSize, string name, string code)
        {
            CommonPagedDataViewModel <ResourceModel> pageResult = new CommonPagedDataViewModel <ResourceModel>();

            try
            {
                StringBuilder sql       = new StringBuilder();
                StringBuilder condition = new StringBuilder();
                if (!string.IsNullOrEmpty(name))
                {
                    condition.Append(" and ResourceName like '%' + @ResourceName + '%'");
                }
                sql.AppendFormat(@" 
                          set @coun=(select count(id) from Resource where 1=1 );
                         SELECT 
                           ID,
                           ResourceName 
                          ,ResourceLink
                          ,ResourcePassword,
                          ResourceImg
                          ,IsEnable
                          ,Remark
                          ,CreateTime
                          ,LastUpdateTime,@coun as Coun
                           FROM Resource bs
                            WHERE 1 = 1 {2} LIMIT {0},{1}", (pageIndex - 1) * pageSize, pageSize, condition.ToString());
                var result = EBDapperHelper.Query <ResourceModel>(sql.ToString(), new { Resource = name }).ToList();
                pageResult.Items       = result;
                pageResult.CurrentPage = pageIndex;
                if (result != null && result.Count > 0)
                {
                    pageResult.TotalNum       = result[0].Coun;
                    pageResult.TotalPageCount = result[0].Coun;
                }
            }
            catch (Exception ex)
            {
            }
            return(pageResult);
        }