public DataTable GetPageList(string sqlstr, int pageindex, int pagesize) { Model.PageInfo pages = new Model.PageInfo(); pages.PageIndex = pageindex; pages.PageSize = pagesize; pages.SqlWhere = sqlstr; pages.ReturnFileds = "t.*"; pages.TableName = " Codes "; pages.JoinTable = " left join SupplierInfo s on s.SupplierId=a.SupplierId left join Policy p on p.Id=a.PyId "; pages.CountFields = " a.Id "; pages.OrderString = " order by t.Id desc"; pages.SelectFileds = " a.*,s.SupplierName,p.Title "; pages.doCount = 0; PageHelper p = new PageHelper(); DataTable dt = p.GetList(pages); return(dt); }
public DataTable GetList(string sqlstr, int pageindex, int pagesize) { Model.PageInfo pages = new Model.PageInfo(); pages.PageIndex = pageindex; pages.PageSize = pagesize; pages.SqlWhere = sqlstr; pages.ReturnFileds = "t.*"; pages.TableName = "AwardsStatistics"; pages.JoinTable = " "; pages.CountFields = " a.Id "; pages.OrderString = " order by a.Id "; pages.SelectFileds = " a.* "; pages.doCount = 0; PageHelper p = new PageHelper(); DataTable dt = p.GetList(pages); return(dt); }
public DataTable GetList(string sqlstr, int pageindex, int pagesize, string joinString) { Model.PageInfo pages = new Model.PageInfo(); pages.PageIndex = pageindex; pages.PageSize = pagesize; pages.SqlWhere = sqlstr; pages.ReturnFileds = "t.*"; pages.TableName = " UserInfo "; pages.JoinTable = " left join UserInfo_Group b on a.groupid=b.groupid " + joinString; pages.CountFields = " a.userId "; pages.OrderString = " order by t.userId desc"; pages.SelectFileds = " a.*,b.groupName "; pages.doCount = 0; PageHelper p = new PageHelper(); DataTable dt = p.GetList(pages); return(dt); }
public DataTable GetPageList(string sqlstr, int pageindex, int pagesize) { Model.PageInfo pages = new Model.PageInfo(); pages.PageIndex = pageindex; pages.PageSize = pagesize; pages.SqlWhere = sqlstr; pages.ReturnFileds = "t.*"; pages.TableName = " Crm_User "; pages.JoinTable = " left join S_Province sp on sp.ProvinceId=a.PId left join S_City sc on sc.CityId=a.CId "; pages.CountFields = " a.Id "; pages.OrderString = " order by t.Id desc"; pages.SelectFileds = " a.*,sp.ProvinceName,sc.CityName "; pages.doCount = 0; PageHelper p = new PageHelper(); DataTable dt = p.GetList(pages); return(dt); }
public DataTable GetList(string sqlstr, int pageindex, int pagesize) { Model.PageInfo pages = new Model.PageInfo(); pages.PageIndex = pageindex; pages.PageSize = pagesize; pages.SqlWhere = sqlstr; pages.ReturnFileds = "t.*"; pages.TableName = " MovieInfo "; pages.JoinTable = " left join SupplierInfo si on si.SupplierId =a.SupplierId left join S_Province sp on sp.provinceid=a.PId " + "left join S_City sc on sc.CityId=a.CId left join S_District sd on sd.DistrictId=a.DId"; pages.CountFields = " a.movieId "; pages.OrderString = " order by t.movieId desc"; pages.SelectFileds = " a.* ,si.SupplierName,sp.ProvinceName as P_name,sc.CityName as C_Name,sd.DistrictName as D_name "; pages.doCount = 0; PageHelper p = new PageHelper(); DataTable dt = p.GetList(pages); return(dt); }
public NewsViewModel GetAll(string sortOrder, string searchString, int pageSize, int page) { if (!string.IsNullOrEmpty(searchString)) { var foundNews = dbProv.GetAll(sortOrder, searchString, pageSize, page); Schedule.BLL.Model.PageInfo foundPageInfo = new Model.PageInfo { PageNumber = foundNews.PageInfo.PageNumber, PageSize = foundNews.PageInfo.PageSize, TotalItems = foundNews.PageInfo.TotalItems }; return(MapViewModel(foundNews, foundPageInfo)); } var dbNews = dbProv.GetAll(sortOrder, searchString, pageSize, page); Schedule.BLL.Model.PageInfo pageInfo = new Model.PageInfo { PageNumber = dbNews.PageInfo.PageNumber, PageSize = dbNews.PageInfo.PageSize, TotalItems = dbNews.PageInfo.TotalItems }; return(MapViewModel(dbNews, pageInfo)); }
private NewsViewModel MapViewModel(NewsDtoModel dbItem, Model.PageInfo pageInfo) { List <NewsViewModelItem> convert = new List <NewsViewModelItem>(); if (dbItem != null) { convert = dbItem.News.ConvertAll(x => new NewsViewModelItem { Id = x.Id, ShortTitle = x.ShortTitle, FullTitle = x.FullTitle, ShortArticle = x.ShortArticle, FullArticle = x.FullArticle, NewsImages = x.NewsImages.Select(i => new NewsImageModelItem { Id = i.Id, ImageItem = i.ImageItem, NewsId = i.NewsId }).ToList() }); return(new NewsViewModel { News = convert, PageInfo = pageInfo }); } return(null); }
public int GetCount(string sqlstr, string joinString) { Model.PageInfo pages = new Model.PageInfo(); pages.SqlWhere = sqlstr; pages.ReturnFileds = "Id"; pages.SqlWhere = sqlstr; pages.TableName = "AwardsStatistics"; pages.JoinTable = " "; pages.CountFields = " a.Id "; pages.OrderString = " "; pages.SelectFileds = " a.* "; pages.doCount = 1; PageHelper p = new PageHelper(); DataTable dt = p.GetList(pages); if (dt.Rows.Count > 0) { return(Convert.ToInt32(dt.Rows[0][0].ToString())); } else { return(0); } }
/// <summary> /// 分页计算总数 /// </summary> /// <param name="sqlstr"></param> /// <param name="joinString"></param> /// <returns></returns> public int GetCountMit(string sqlstr) { Model.PageInfo pages = new Model.PageInfo(); pages.SqlWhere = sqlstr; pages.ReturnFileds = "GroupCode"; pages.TableName = " v_message "; pages.JoinTable = ""; pages.CountFields = " a.GroupCode "; pages.OrderString = " "; pages.SelectFileds = " a.* "; pages.doCount = 1; PageHelper p = new PageHelper(); DataTable dt = p.GetList(pages); if (dt.Rows.Count > 0) { return(Convert.ToInt32(dt.Rows[0][0].ToString())); } else { return(0); } }
/// <summary> /// 分页计算总数 /// </summary> /// <param name="sqlstr"></param> /// <param name="joinString"></param> /// <returns></returns> public int GetCount(string sqlstr, string joinString) { Model.PageInfo pages = new Model.PageInfo(); pages.SqlWhere = sqlstr; pages.ReturnFileds = "userid"; pages.TableName = " UserInfo "; pages.JoinTable = " left join UserInfo_Group b on a.groupid=b.groupid " + joinString; pages.CountFields = " a.userid "; pages.OrderString = " "; pages.SelectFileds = " a.*,b.groupName "; pages.doCount = 1; PageHelper p = new PageHelper(); DataTable dt = p.GetList(pages); if (dt.Rows.Count > 0) { return(Convert.ToInt32(dt.Rows[0][0].ToString())); } else { return(0); } }
public DataTable GetList(Model.PageInfo pmodel) { SqlParameter[] parameters = { new SqlParameter("@tblName", SqlDbType.NVarChar, 100), new SqlParameter("@SelectFileds", SqlDbType.NVarChar, 2000), new SqlParameter("@PageSize", SqlDbType.Int, 4), new SqlParameter("@PageIndex", SqlDbType.Int, 4), new SqlParameter("@doCount", SqlDbType.Int, 2), new SqlParameter("@JoinTable", SqlDbType.NVarChar, 4000), new SqlParameter("@CountFields", SqlDbType.VarChar, 1000), new SqlParameter("@ReturnFileds", SqlDbType.NVarChar, 4000), new SqlParameter("@strWhere", SqlDbType.NVarChar, 2000), new SqlParameter("@OrderString", SqlDbType.NVarChar, 1000) }; parameters[0].Value = pmodel.TableName; if (pmodel.SelectFileds != null) { parameters[1].Value = pmodel.SelectFileds; } else { parameters[1].Value = ""; } parameters[2].Value = pmodel.PageSize; parameters[3].Value = pmodel.PageIndex; parameters[4].Value = pmodel.doCount; if (pmodel.JoinTable != null) { parameters[5].Value = pmodel.JoinTable; } else { parameters[5].Value = ""; } if (pmodel.CountFields != null) { parameters[6].Value = pmodel.CountFields; } else { parameters[6].Value = " id "; } if (pmodel.ReturnFileds != null) { parameters[7].Value = pmodel.ReturnFileds; } else { parameters[7].Value = "*"; } if (pmodel.SqlWhere != null) { parameters[8].Value = pmodel.SqlWhere; } else { parameters[8].Value = ""; } parameters[9].Value = pmodel.OrderString; DataTable ds = SqlHelper.ExecuteDataTable(SqlHelper.ConnectionString, CommandType.StoredProcedure, "sp_Page", parameters); return(ds); }