using Interface; using Models; using Models.Entity.LottomatBaseDB; using Services; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Business.TK { public static class Tk_GalleryDetailBLL { static BaseInterface service; static Tk_GalleryDetailBLL() { service = new ZXServic(); } public static List QueryDetailByGalleryId(List galleryIds, int periodsNumber) { List listexp = new List(); listexp.Add( new EExpression("periodsNumber", "=", periodsNumber)); listexp.Add(new EExpression("isDelete", "=", 0)); listexp.Add(new EExpression("galleryId", EnumExpression.In, galleryIds)); List list = service.GetList(null, listexp); return list; } /// /// 根据可选条件查询匹配上的最新一条 /// /// key /// 期号 /// 栏目id /// public static Tk_GalleryDetail QueryItem(string ID = null, string PeriodsNumber = null, string pk = null) { List listexp = new List(); if (!string.IsNullOrEmpty(ID)) { listexp.Add(new EExpression("ID", "=", ID)); } if (!string.IsNullOrEmpty(PeriodsNumber)) { listexp.Add(new EExpression("PeriodsNumber", "=", PeriodsNumber)); } if (!string.IsNullOrEmpty(pk)) { listexp.Add(new EExpression("PK", "=", pk)); } var list = service.GetList("PeriodsNumber", listexp, true); if (list.Count>0) { return list[0]; } else { return new Tk_GalleryDetail(); } } /// /// 根据期号和pk查询左右三期 /// /// /// /// public static List Qthreelist( int pk,out int PeriodsNumber) { var data = service.QueryItembyKey(pk); int num = data.PeriodsNumber; PeriodsNumber = num; string lastnum = (num - 1).ToString().PadLeft(3, '0'); string onlinenum = num.ToString().PadLeft(3, '0'); string nextnum = (num + 1).ToString().PadLeft(3, '0'); List listexp = new List(); listexp.Add(new EExpression("GalleryId", "=", data.GalleryId)); listexp.Add(new EExpression("PeriodsNumber", EnumExpression.In, new List() {lastnum,onlinenum,nextnum})); List list = service.GetList(null, listexp); return list; } } }