public static ImageInfoModel NewArtList(ArtInfoParams artInfoParams) { Tk_GalleryDetailBLL tk_GalleryDetailBLL = new Tk_GalleryDetailBLL(); string json = artInfoParams.TryToJson(); List <Tk_GalleryDetail> list = tk_GalleryDetailBLL.GetPageList(new Pagination() { page = 1, rows = 1, sidx = "PeriodsNumber", sord = "desc" }, json).ToList(); ImageInfoModel rtdata = new ImageInfoModel(); if (list.Count > 0) { rtdata = new ImageInfoModel() { PeriodsNumber = list[0].PeriodsNumber }; } // rtdata = rtdata.OrderBy(s => s.GalleryNumber).ToList();//升序排序 return(rtdata); }
/// <summary> /// 查询图谜实体 /// </summary> /// <param name="artInfoParams"></param> /// <returns></returns> public static ImageInfoModel QueryArtInfo(ArtInfoParams artInfoParams) { Tk_GalleryDetailBLL tk_GalleryDetailBLL = new Tk_GalleryDetailBLL(); string json = artInfoParams.TryToJson(); List <Tk_GalleryDetail> list = tk_GalleryDetailBLL.GetPageList(new Pagination() { page = 1, rows = 1, sidx = "PeriodsNumber", sord = "desc" }, json).ToList(); ImageInfoModel rtdata = new ImageInfoModel(); if (list.Count > 0) { rtdata = new ImageInfoModel() { galleryId = list[0].GalleryId, SortCode = list[0].SortCode.Value, ID = list[0].ID, ImageUrl = list[0].ImageUrl, PeriodsNumber = list[0].PeriodsNumber }; } return(rtdata); }
public static List <QueryAllDataModel> QueryAll(int page, int rows, string queryjson, out int totalrows, out int totalpage, int periodsNumber) { List <QueryAllDataModel> rtdata = new List <QueryAllDataModel>(); Tk_GalleryBLL tk_GalleryBLL = new Tk_GalleryBLL(); Tk_GalleryDetailBLL tk_GalleryDetailBLL = new Tk_GalleryDetailBLL(); Pagination pageparam = new Pagination() { page = page, rows = rows, sidx = "GalleryNumber", sord = "asc" }; List <Tk_Gallery> list = tk_GalleryBLL.GetPageList(pageparam, queryjson).ToList(); List <string> gallid = list.Select(s => s.ID).ToList(); List <Tk_GalleryDetail> qDetailList = new List <Tk_GalleryDetail>(); if (periodsNumber == 0) { periodsNumber = getNewperoidNumber(); } if (gallid.Count > 0) { qDetailList = tk_GalleryDetailBLL.QueryDetailByGalleryId(gallid, periodsNumber); } totalrows = pageparam.records; totalpage = pageparam.total; string[] aryname = new string[] { "A", "B", "C" }; for (int i = 0; i < aryname.Length; i++) { List <ImageMenuInfoModel> tlist = new List <ImageMenuInfoModel>(); IEnumerator <Tk_Gallery> tmp = list.Where(t => t.AreaCode == aryname[i]).GetEnumerator(); while (tmp.MoveNext()) { ImageMenuInfoModel tmpImg = new ImageMenuInfoModel() { GalleryNumStr = tmp.Current.AreaCode + GetGallerNum(tmp.Current.GalleryNumber.Value), AreaCode = tmp.Current.AreaCode, CreateTime = tmp.Current.CreateTime.Value.ToString(), GalleryName = tmp.Current.GalleryName, GalleryNumber = tmp.Current.GalleryNumber.Value, HotNumber = tmp.Current.HotNumber.Value, ID = tmp.Current.ID, Reamrk = tmp.Current.Reamrk, HasImage = 0 }; List <Tk_GalleryDetail> qtmp = qDetailList.Where(w => w.GalleryId == tmpImg.ID && w.PeriodsNumber == periodsNumber.ToString()).ToList(); if (qtmp.Count > 0) { tmpImg.ImageUrl = qtmp[0].ImageUrl; tmpImg.HasImage = 1; } tlist.Add(tmpImg); } tlist = tlist.OrderBy(s => s.GalleryNumber).ToList();//升序排序 rtdata.Add(new QueryAllDataModel() { AreaName = aryname[i], list = tlist, PeriodsNumber = periodsNumber }); } return(rtdata); }
public static int MenuNewPeriodsNumber(string menuname) { Tk_GalleryDetailBLL tk_GalleryDetailBLL = new Tk_GalleryDetailBLL(); return(tk_GalleryDetailBLL.MenuNewPeriodsNumber(menuname)); }
/// <summary> /// 查询最新的 /// </summary> /// <returns></returns> public static List <ImageMenuInfoModel> QueryNew(int page, int rows, out int totalrows, out int totalpage, int periodsNumber) { Tk_GalleryDetailBLL tk_GalleryDetailBLL = new Tk_GalleryDetailBLL(); Tk_GalleryBLL tk_GalleryBLL = new Tk_GalleryBLL(); Pagination pageparam = new Pagination() { page = page, sidx = "GalleryNumber", rows = rows, sord = "asc" }; List <Tk_Gallery> list = tk_GalleryBLL.GetPageList(pageparam, "").ToList(); IEnumerator <Tk_Gallery> enumerator = list.GetEnumerator(); totalrows = pageparam.records; totalpage = pageparam.total; List <string> gallid = list.Select(s => s.ID).ToList(); List <Tk_GalleryDetail> qDetailList = new List <Tk_GalleryDetail>(); if (periodsNumber == 0) { periodsNumber = tk_GalleryDetailBLL.NewPeriodsNumber(); } if (gallid.Count > 0) { qDetailList = tk_GalleryDetailBLL.QueryDetailByGalleryId(gallid, periodsNumber); } List <ImageMenuInfoModel> rtdata = new List <ImageMenuInfoModel>(); List <ImageMenuInfoModel> tplist = new List <ImageMenuInfoModel>(); while (enumerator.MoveNext()) { ImageMenuInfoModel tmp = new ImageMenuInfoModel() { GalleryNumStr = enumerator.Current.AreaCode + GetGallerNum(enumerator.Current.GalleryNumber.Value), GalleryName = enumerator.Current.GalleryName, AreaCode = enumerator.Current.AreaCode, CreateTime = enumerator.Current.CreateTime.ToString(), GalleryNumber = enumerator.Current.GalleryNumber.Value, HotNumber = enumerator.Current.HotNumber.Value, ID = enumerator.Current.ID, Reamrk = enumerator.Current.Reamrk }; List <Tk_GalleryDetail> qtmp = qDetailList.Where(w => w.GalleryId == tmp.ID && w.PeriodsNumber == periodsNumber.ToString()).ToList(); if (qtmp.Count > 0) { tmp.ImageUrl = qtmp[0].ImageUrl; tmp.HasImage = 1; } tplist.Add(tmp); } List <ImageMenuInfoModel> alist = tplist.Where(w => w.AreaCode == "A").OrderBy(o => o.GalleryNumber).ToList(); List <ImageMenuInfoModel> blist = tplist.Where(w => w.AreaCode == "B").OrderBy(o => o.GalleryNumber).ToList(); List <ImageMenuInfoModel> clist = tplist.Where(w => w.AreaCode == "C").OrderBy(o => o.GalleryNumber).ToList(); rtdata.AddRange(alist); rtdata.AddRange(blist); rtdata.AddRange(clist); return(rtdata); // rtdata = rtdata.OrderBy(s => s.GalleryNumber).ToList();//升序排序 }