示例#1
0
 public static string GetDataList(string TabName, string TabType, int PageIndex, int PageSize)
 {
     try
     {
         TabName = TabName.Filter();
         TabType = TabType.Filter();
         string strWhere = " 1=1 ";
         if (!string.IsNullOrEmpty(TabName))
         {
             strWhere += string.Format(" and (TabName like '%{0}%' or Tabindex like '%{0}%') ", TabName);
         }
         if (!string.IsNullOrEmpty(TabType))
         {
             strWhere += string.Format(" and TabType='{0}' ", TabType);
         }
         int           intRecordCount = 0;
         List <object> listReturn     = new List <object>();
         BLL_ClientTab bll            = new BLL_ClientTab();
         DataTable     dt             = bll.GetListByPage(strWhere, "TabType,CreateTime", ((PageIndex - 1) * PageSize + 1), PageIndex * PageSize).Tables[0];
         intRecordCount = bll.GetRecordCount(strWhere);
         foreach (DataRow item in dt.Rows)
         {
             listReturn.Add(new
             {
                 Tabindex   = item["Tabindex"].ToString(),
                 TabName    = item["TabName"].ToString(),
                 TabType    = EnumService.GetDescription <Rc.Model.Resources.ClientTabTypeEnum>(item["TabType"].ToString()),
                 CreateTime = pfunction.ConvertToLongDateTime(item["CreateTime"].ToString())
             });
         }
         if (dt.Rows.Count > 0)
         {
             return(JsonConvert.SerializeObject(new
             {
                 err = "null",
                 PageIndex = PageIndex,
                 PageSize = PageSize,
                 TotalCount = intRecordCount,
                 list = listReturn
             }));
         }
         else
         {
             return(JsonConvert.SerializeObject(new
             {
                 err = "暂无数据"
             }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new
         {
             err = "error"
         }));
     }
 }