コード例 #1
0
 public BetListController()
 {
     _dataService = new DataService();
     var ticketHelper = new TicketHelper();
     var test = ticketHelper.GetLeagueNameById(1073741825);
     var test1 = ticketHelper.GetTeamNameById(1073741825);
     var test2 = ticketHelper.GetTeamNameById(1073741826);
 }
コード例 #2
0
        /// <summary>
        /// Exports the excel.
        /// </summary>
        public void ExportExcel(BetListData query)
        {
            GetCachePropertyById funcGetOddsTypeName = CacheRef.GetOddsTypeName;
            var factory = new BetListExcelFactory();
            BetListExcelBuilder builder = factory.CreateBuilder();
            ITicketHelper ticketHelper = new TicketHelper();
            const short excelColumns = 7;
            builder.BuildWorksheet("BetList", excelColumns);
            var index = 0;

            var model = GetDataSource(query, sourcePath: DataSourcePath);

            _tickets = model.Tickets;
            _ticketData = model.TicketData;

            if (_tickets != null)
            {
                foreach (ITicket ticket in _tickets)
                {
                    index++;
                    ticketHelper.Index = index;

                    builder.AddNo(index)
                           .AddTrans(ticket, ticketHelper)
                           .AddUsername(ticket, ticketHelper)
                           .AddChoice(ticket, ticketHelper, _ticketData)
                           .AddOdds(ticket, _ticketData, funcGetOddsTypeName)
                           .AddStatus(ticket, ticketHelper, _ticketData, true)
                           .AddStake(ticket);
                }

                var ms = new MemoryStream();
                var resultWorkbook = builder.GetBetList();
                resultWorkbook.Write(ms);
                ExportToExcel(ms, "BetList.xls");
            }
        }