Пример #1
0
        static void Main(string[] args)
        {
            CompetitionBLL    competitionBLL = new CompetitionBLL();
            CompetitionEntity entity         = new CompetitionEntity()
            {
                GameName = "DZK"
            };

            competitionBLL.InsertCompetition(entity);
        }
Пример #2
0
        /// <summary>
        /// 导出比赛记录
        /// </summary>
        /// <param name="article_state">2:初赛,3是半决赛,4是决赛</param>
        /// <returns></returns>
        public ApiResult ExportCompetitionRecord(int article_state = 2)
        {
            ApiResult apiResult = new ApiResult();
            //赛季
            BaseBLL <competition_notice> notice_bll = new BaseBLL <competition_notice>();
            var notice = notice_bll.Find(o => o.is_delete == 0 && o.is_open == 1);

            if (notice?.competition_season_id > 0)
            {
                CompetitionBLL bll = new CompetitionBLL();
                var            dt  = bll.GetAllArticle(article_state, notice.competition_season_id);
                //导出excel
                string folder = HttpContext.Current.Server.MapPath("/download/");
                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }
                string excel_file = folder + sys.getRandomStr() + ".xls";
                Rays.Utility.NPOIHelper.GridToExcelByNPOI(dt, excel_file, "导出结果");
                if (File.Exists(excel_file))
                {
                    string file = Util.UploadFileToServices(excel_file);
                    apiResult.success = true;
                    apiResult.message = "导出成功";
                    apiResult.data    = file;
                }
                else
                {
                    return(new ApiResult()
                    {
                        success = false,
                        message = "导出失败"
                    });
                }
            }
            else
            {
                return(new ApiPageResult()
                {
                    success = false,
                    message = "当前没有开启的赛季"
                });
            }
            return(apiResult);
        }
Пример #3
0
        /// <summary>
        /// 作品管理查询
        /// </summary>
        /// <param name="keyword">查询的关键字:作品编号/标题/作者</param>
        /// <param name="state">-1全部,0初始,1审核不通过,2审核通过,3半决赛,4决赛</param>
        /// <param name="zone_id">0全部</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="orderby">排序字段:vote按票数顺序排,votedesc按票数倒叙排,date按投稿时间顺序排,datedesc按投稿时间倒叙排</param>
        /// <param name="pageIndex">1</param>
        /// <param name="pageSize">10</param>
        /// <returns></returns>
        public ApiPageResult GetArticleList(string keyword = null, int state = -1, int zone_id = 0, DateTime?start = null, DateTime?end = null, string orderby = null, int pageIndex = GloabManager.PAGEINDEX, int pageSize = GloabManager.PAGESIZE)
        {
            ApiPageResult apiResult = new ApiPageResult();
            //赛季
            BaseBLL <competition_notice> notice_bll = new BaseBLL <competition_notice>();
            var notice = notice_bll.Find(o => o.is_delete == 0 && o.is_open == 1);

            if (notice?.competition_season_id > 0)
            {
                CompetitionBLL bll = new CompetitionBLL();
                return(bll.GetArticleList(keyword, state, notice.competition_season_id, zone_id, start, end, orderby, pageIndex, pageSize));
            }
            else
            {
                return(new ApiPageResult()
                {
                    success = false,
                    message = "当前没有开启的赛季"
                });
            }
        }