using Interface; using Models; using Models.Entity.LottomatBaseDB; using Services; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Business.ZX { public static class NewsBLL { private static ZXInterface services; static NewsBLL() { services = new ZXServic(); } public static List GetPageList(int page, int rows, Dictionary queryParam, out int count, string order = null, bool isDesc = true) { List listexp = new List(); if (queryParam!=null&&queryParam.Keys.Count > 0) { if (queryParam.ContainsKey("IsDelete")) { int IsDelete = int.Parse(queryParam["IsDelete"].ToString()); listexp.Add(new EExpression("IsDelete", "=", IsDelete)); } if (queryParam.ContainsKey("TypeId")) { int TypeId = (int)queryParam["TypeId"]; listexp.Add(new EExpression("TypeId", "=", TypeId)); } if (queryParam.ContainsKey("CategoryId")) { List CategoryId = (List)queryParam["CategoryId"]; listexp.Add(new EExpression("CategoryId", EnumExpression.In, CategoryId)); } if (queryParam.ContainsKey("CategoryId")) { List CategoryId = (List)queryParam["CategoryId"]; listexp.Add(new EExpression("CategoryId", EnumExpression.In, CategoryId)); } } var data = services.GetList(page, rows, order, listexp, isDesc); List countexp = new List(listexp); count = services.GetPageListCount(countexp); return data; } /// /// 查询咨询首页的分类下面最新的5条数据 详情看sql语句 /// /// public static List GetHomeNewsList(string code) { string strSql = @"select top 20 * from Base_News where CategoryId in( SELECT d.ItemDetailId FROM Base_DataItemDetail d LEFT JOIN Base_DataItem i ON i.ItemId = d.ItemId WHERE 1 = 1 AND d.EnabledMark = 1 AND d.DeleteMark = 0 and i.ItemCode ='{0}' and d.ItemValue in('3DYC','P3YC','SSQYC','DLT') ) AND IsDelete=0 AND TypeId=1 order by CreateDate desc"; string sql = string.Format(strSql, code); return services.ExSqlGetList(sql); } public static Base_News GetItem(int NewsId) { return services.QueryItembyKey(NewsId); } /// /// 根据newsid查询实体并且前后三条 /// /// /// public static List GetGetNewsDetails(string NewsId) { string sql = @"declare @dd int=1 set @dd=(SELECT PK FROM Base_News where NewsId='{0}') select * from Base_News where PK in ( @dd-1,@dd,@dd+1)"; string strsql = string.Format(sql, NewsId); return services.ExSqlGetList(strsql); } public static List GetList(int page, int rows,List list,string order=null, bool isdesc = false) { return services.GetList(page, rows, order, list, isdesc); } } }