/// <summary> /// 获取团购数量 /// </summary> /// <param name="type">团购类型</param> /// <param name="status">团购状态</param> /// <param name="startTime">起始时间</param> /// <param name="endTime">结束时间</param> /// <returns>团购数量</returns> /// <remarks>2013-09-04 杨晗 创建</remarks> public override int GetCount(GroupShoppingStatus.团购类型 type, GroupShoppingStatus.团购状态 status, DateTime?startTime, DateTime?endTime) { #region sql条件 const string sqlWhere = @"(@GroupType is null or ggs.GroupType =@GroupType) and (@Status is null or ggs.Status =@Status) and (@StartTime is null or ggs.StartTime >= @StartTime) and (@EndTime is null or ggs.EndTime <= @EndTime)"; #endregion return(Context.Select <int>("count(1)") .From("GsGroupShopping ggs") .Where(sqlWhere) .Parameter("GroupType", (int)type) //.Parameter("GroupType", (int) type) //.Parameter("Status", (int) status) .Parameter("Status", (int)status) //.Parameter("StartTime", startTime) .Parameter("StartTime", startTime) //.Parameter("EndTime", endTime) .Parameter("EndTime", endTime) .QuerySingle()); }
/// <summary> /// 获取团购数量 /// </summary> /// <param name="type">团购类型</param> /// <param name="status">团购状态</param> /// <param name="startTime">起始时间</param> /// <param name="endTime">结束时间</param> /// <returns>团购数量</returns> /// <remarks>2013-09-04 杨晗 创建</remarks> public abstract int GetCount(GroupShoppingStatus.团购类型 type, GroupShoppingStatus.团购状态 status, DateTime?startTime, DateTime?endTime);
/// <summary> /// 根据截至时间获取已审核团购分页列表 /// </summary> /// <param name="pageIndex">分页索引</param> /// <param name="pageSize">每页数量</param> /// <param name="startTime">开始时间</param> /// <param name="endTime">结束时间</param> /// <param name="groupType"></param> /// <returns>分页</returns> /// <remarks>2013-09-16 苟治国 创建</remarks> public PagedList <GsGroupShopping> GetGroupShoppingList(int pageIndex, int pageSize, DateTime?startTime, DateTime?endTime, GroupShoppingStatus.团购类型 groupType) { var list = new PagedList <GsGroupShopping>(); var pager = new Pager <GsGroupShopping>(); pager.CurrentPage = pageIndex; pager.PageFilter = new GsGroupShopping { GroupType = (int)groupType, Status = (int)PromotionStatus.促销状态.已审, StartTime = startTime, EndTime = endTime }; pager.PageSize = pageSize; pager = IGsGroupShoppingDao.Instance.GetGroupShoppingList(pager); list = new PagedList <GsGroupShopping> { PageSize = pageSize, TData = pager.Rows, CurrentPageIndex = pager.CurrentPage, TotalItemCount = pager.TotalRows }; return(list); }