public PageModel <ActivityInfo> GetNotEndActivityList(EffectiveActivityQuery page)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("1=1");
            if (page.ActivityType != 0)
            {
                stringBuilder.AppendFormat("and ActivityType={0}", (int)page.ActivityType);
            }
            if (!string.IsNullOrEmpty(page.ActivityName))
            {
                stringBuilder.AppendFormat("and ActivityName  like  '%{0}%'", page.ActivityName);
            }
            stringBuilder.AppendFormat(" and EndDate>=getdate()");
            return(DataHelper.PagingByRownumber <ActivityInfo>(page.PageIndex, page.PageSize, page.SortBy, page.SortOrder, page.IsCount, "Hishop_Activity", "ActivityId", stringBuilder.ToString(), "*"));
        }
Exemple #2
0
        public string GetModelJson(HttpContext context)
        {
            LotteryActivityType lotteryActivityType = (LotteryActivityType)Enum.ToObject(typeof(LotteryActivityType), (context.Request.Form["type"] == null) ? 1 : context.Request.Form["type"].ToInt(0));

            if (lotteryActivityType == LotteryActivityType.Wheel || lotteryActivityType == LotteryActivityType.Scratch || lotteryActivityType == LotteryActivityType.SmashEgg)
            {
                EffectiveActivityQuery page = new EffectiveActivityQuery
                {
                    ActivityType = lotteryActivityType,
                    PageIndex    = ((context.Request.Form["p"] == null) ? 1 : Convert.ToInt32(context.Request.Form["p"])),
                    SortOrder    = SortAction.Desc,
                    SortBy       = "ActivityId",
                    PageSize     = 10
                };
                PageModel <ActivityInfo> notEndActivityList = ActivityHelper.GetNotEndActivityList(page);
                int pageCount = TemplatePageControl.GetPageCount(notEndActivityList.Total, 10);
                if (notEndActivityList.Models.Count() > 0)
                {
                    string str = "{\"status\":1,";
                    str = str + this.GetActivityListJosn(notEndActivityList.Models.ToList()) + ",";
                    str = str + "\"page\":\"" + this.GetPageHtml(pageCount, context) + "\"";
                    return(str + "}");
                }
                return("{\"status\":1,\"list\":[],\"page\":\"\"}");
            }
            DbQueryResult gamesTable = this.GetGamesTable(context);
            int           pageCount2 = TemplatePageControl.GetPageCount(gamesTable.TotalRecords, 10);

            if (gamesTable != null)
            {
                string str2 = "{\"status\":1,";
                str2 = str2 + this.GetGamesListJson(gamesTable, context) + ",";
                str2 = str2 + "\"page\":\"" + this.GetPageHtml(pageCount2, context) + "\"";
                return(str2 + "}");
            }
            return("{\"status\":1,\"list\":[],\"page\":\"\"}");
        }
 public static PageModel <ActivityInfo> GetNotEndActivityList(EffectiveActivityQuery page)
 {
     return(new ActivityDao().GetNotEndActivityList(page));
 }