コード例 #1
0
        public ActionResult GetPictureVoteItemList()
        {
            GetCampaign_PictureVoteItemListArgs args = RequestArgs<GetCampaign_PictureVoteItemListArgs>();
            if (args == null)
            {
                return RespondResult(false, "参数无效。");
            }

            string campaignId = Request.QueryString["campaignId"];

            args.CampaignId = Guid.Parse(campaignId);
            args.ApproveStatus = EnumCampaignPictureVoteItemApproveStatus.Approved;

            GetItemListResult result = _campaignManager.PictureVote.GetPictureVoteItemList(args);
            return RespondDataResult(result);
        }
コード例 #2
0
        /// <summary>
        /// 获取指定的最美投票活动的项目列表
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public GetItemListResult GetPictureVoteItemList(GetCampaign_PictureVoteItemListArgs args)
        {
            if (RelationalMappingUnity.IsValidFieldName(args.OrderBy) == false)
            {
                args.OrderBy = GetCampaign_PictureVoteItemListArgs.DefaultOrderBy;
            }

            List <CommandParameter> parameterList = new List <CommandParameter>();

            parameterList.Add(new CommandParameter("@campaignId", args.CampaignId));
            parameterList.Add(new CommandParameter("@page", args.Page));
            parameterList.Add(new CommandParameter("@pageSize", args.PageSize));
            parameterList.Add(new CommandParameter("@approveStatus", args.ApproveStatus));
            parameterList.Add(new CommandParameter("@title", args.Title));
            parameterList.Add(new CommandParameter("@memberName", args.MemberName));
            parameterList.Add(new CommandParameter("@userName", args.UserName));
            parameterList.Add(new CommandParameter("@orderby", args.OrderBy));
            parameterList.Add(new CommandParameter("@sort", "DESC"));


            DataSet dsResult =
                _campaignManager.DataBase.ExecuteDataSet(CommandType.StoredProcedure, "GetCampaign_PictureVoteItemList", parameterList, new string[] { "result" });

            if (dsResult.Tables[0].Rows.Count == 0 && args.Page > 1)
            {
                args.Page--;
                return(GetPictureVoteItemList(args));
            }

            GetItemListResult result = new GetItemListResult();

            result.ItemList = dsResult.Tables[0];

            int totalCount = int.Parse(dsResult.Tables[1].Rows[0][0].ToString());

            result.TotalPage = totalCount / args.PageSize;
            if (totalCount % args.PageSize > 0)
            {
                result.TotalPage++;
            }
            result.Page = args.Page;

            return(result);
        }