Esempio n. 1
0
        public override List<IRichTextString> RenderRTF(
            ITicket ticket,
            ITicketHelper ticketHelper,
            List<ITicketData> ticketData,
            bool isShowScoreMap,
            RTFHelper rtfHelper)
        {
            Render(ticket, ticketHelper, ticketData, isShowScoreMap);
            RTFHelper tmpRtfHelper = rtfHelper.Clone();

            var betTypeName = GetBetTypeName(ticket.BetTypeId, ticketHelper);
            tmpRtfHelper.RTFRenderer.AddText(string.Format("{0} {1}", Template.League.sportTypeName, betTypeName));

            var ticketDetails = GetTicketReference(ticket, ticketData);
            foreach (var ticketDetail in ticketDetails)
            {
                var odds = ConvertByBetType.Odds(ticketDetail.Odds, ticket.BetTypeId, ticket.OddsType);
                var betTeam = ticketHelper.GetResourceData(GetResourceId(), ticketDetail.BetTeam);
                var league = string.Format("{0} {1} {2}", ticketHelper.GetSportNameById(ticket.SportTypeId), betTypeName, GetBetChoice(ticketDetail.TransDesc));

                tmpRtfHelper.RTFRenderer.AddText("\n");
                tmpRtfHelper.RTFRenderer.AddText(string.Format("{0} @ {1}", betTeam, odds), rtfHelper.PosFont);
                tmpRtfHelper.RTFRenderer.AddText("\n");
                tmpRtfHelper.RTFRenderer.AddText(league, rtfHelper.NormalFont);
            }

            var choice = tmpRtfHelper.RTFRenderer.Render();
            tmpRtfHelper.RTFRenderer.Clear();
            return new List<IRichTextString>() { choice };
        }
Esempio n. 2
0
        protected override void BuildResultLRF(string status, RTFHelper rtfHelper)
        {
            var htmlTagMatching = new Regex("</?div[^<>]*[^<>]*>");
            string originalStatus = htmlTagMatching.Replace(status, string.Empty);

            base.BuildResultLRF(originalStatus, rtfHelper);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BetListExcelBuilder" /> class.
        /// </summary>
        public BetListExcelBuilder()
        {
            _workbook = new HSSFWorkbook();

            _isDisposed = false;

            OddCellStyle = _workbook.CreateCellStyle();
            EvenCellStyle = _workbook.CreateCellStyle();
            OddCellStyleCenterAligned = _workbook.CreateCellStyle();
            EvenCellStyleCenterAligned = _workbook.CreateCellStyle();

            _nextCellIndex = -1;

            RTFHelper = new RTFHelper()
            {
                NegFont = _workbook.CreateFont(),
                NormalFont = _workbook.CreateFont(),
                PosFont = _workbook.CreateFont(),
                NegFontCrossed = _workbook.CreateFont(),
                NormalFontCrossed = _workbook.CreateFont(),
                PosFontCrossed = _workbook.CreateFont(),
                RTFRenderer = new RtfTextRender()
            };

            InitDefaultRTFHelper();
            InitDefaultCellStyles();
        }
Esempio n. 4
0
        public override IRichTextString RenderRTF(ITicket ticket, List<ITicketData> ticketData, GetCachePropertyById funcGetOddsTypeName, RTFHelper rtfHelper)
        {
            Render(ticket, ticketData, funcGetOddsTypeName);

            var rtfOdds = BuildRTFOddsWinPlace(rtfHelper);

            return rtfOdds;
        }
Esempio n. 5
0
        public virtual IRichTextString RenderRTF(ITicket ticket, RTFHelper rtfHelper)
        {
            Render(ticket);
            Template.stake = Template.stake.Replace("<br/>&nbsp;", "\n");

            rtfHelper.RTFRenderer.AddText(Template.stake, rtfHelper.PosFont);
            IRichTextString rtfStake = rtfHelper.RTFRenderer.Render();
            rtfHelper.RTFRenderer.Clear();
            return rtfStake;
        }
Esempio n. 6
0
        /// <summary>
        /// Renders the RTF.
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        /// <param name="ticketHelper">The ticket helper.</param>
        /// <param name="ticketData">The ticket data.</param>
        /// <param name="isShowScoreMap">If set to <c>true</c> [is show score map].</param>
        /// <param name="rtfHelper">The rich text rendering helper.</param>
        /// <returns>
        /// Choice_Template object.
        /// </returns>
        public override List<IRichTextString> RenderRTF(
                                                ITicket ticket,
                                                ITicketHelper ticketHelper,
                                                List<ITicketData> ticketData,
                                                bool isShowScoreMap,
                                                RTFHelper rtfHelper)
        {
            List<IRichTextString> lstRTFChoices = new List<IRichTextString>();
            RTFHelper tmpRtfHelper = rtfHelper.Clone();

            tmpRtfHelper.RTFRenderer.AddText(CoreBetList.lblMixParlay, tmpRtfHelper.PosFont);

            if (ticketHelper.GetParlayDetailById != null)
            {
                IList<ITicket> parlayData = ticketHelper.GetParlayDetailById(ticket.TransId);
                bool showOdds = ticketHelper.IsShowOddsWithChoice;
                ticketHelper.IsShowOddsWithChoice = true;
                IFont pos, normal;

                foreach (ITicket tkt in parlayData)
                {
                    IChoice choiceBuilder = CreateChoiceBuilder(tkt.BetTypeId);
                    Template = choiceBuilder.Render(tkt, ticketHelper, null, isShowScoreMap);
                    var choiceData = BuildRTFChoice(tkt, rtfHelper, ticketHelper);
                    List<IRichTextString> tmpRtfChoice;
                    if (choiceData is List<IRichTextString>)
                    {
                        tmpRtfChoice = (List<IRichTextString>)choiceData;
                    }
                    else
                    {
                        tmpRtfChoice = new List<IRichTextString>() { (IRichTextString)choiceData };
                    }

                    if ((tkt.StatusId != null && tkt.StatusId.ToString().Trim() == BetStatusId.Void) || (tkt.Status != null && tkt.Status.Trim().ToLower() == BetStatus.Void))
                    {
                        pos = tmpRtfHelper.PosFontCrossed;
                        normal = tmpRtfHelper.NormalFontCrossed;
                    }
                    else
                    {
                        pos = tmpRtfHelper.PosFont;
                        normal = tmpRtfHelper.NormalFont;
                    }

                    CombineSubRichTextString(tmpRtfChoice, ref tmpRtfHelper, pos, normal);
                }

                ticketHelper.IsShowOddsWithChoice = showOdds;
            }

            var choice = tmpRtfHelper.RTFRenderer.Render();
            tmpRtfHelper.RTFRenderer.Clear();
            return new List<IRichTextString>() { choice };
        }
Esempio n. 7
0
        /// <summary>
        /// Builds the RTF odds.
        /// </summary>
        /// <param name="rtfHelper">The RTF helper.</param>
        /// <returns>
        /// IRichTextString represents excel-formatted Odds string.
        /// </returns>
        protected override IRichTextString BuildRTFOdds(RTFHelper rtfHelper)
        {
            string odds = Template.odds;

            var rtfNumberRenderer = new RTFNumber(rtfHelper.RTFRenderer, rtfHelper.PosFont, rtfHelper.NegFont);

            rtfNumberRenderer.Render(odds);

            var rtfOdds = rtfHelper.RTFRenderer.Render();
            rtfHelper.RTFRenderer.Clear();
            return rtfOdds;
        }
Esempio n. 8
0
        private void RunCommand(string command)
        {
            int objectCount;

            if (!toolStripColoring.Checked)
            {
                var printer = new PrettyPrint();
                var result  = _session.Execute(command, out objectCount, printer);
                rtResult.Text = result;
            }
            else
            {
                var printer   = new RTFPrettyPrinter();
                var rtfResult = _session.Execute(command, out objectCount, printer);
                RTFHelper.SetRTF(rtResult, rtfResult, RTFHelper.COLOR_TABLE);
            }
            toolStripCommandLabel.Text = string.Format("{0} objects", objectCount);
        }
Esempio n. 9
0
        protected override void BuildBetFigure(ITicket ticket, ref RTFHelper rtfHelper, bool isMixParlay)
        {
            string choice = Template.betTeam;

            if (Template.Handicap != null && Template.Handicap.Visible && Template.Handicap.handicap != null)
            {
                choice += string.Join(null, new string[] { Space, Template.Handicap.handicap });
            }

            if (Template.Score != null && Template.Score.Visible && ticket.IsLive)
            {
                choice += string.Join(null, new string[] { " [", Template.Score.homeScore, "-", Template.Score.awayScore, "]" });
            }

            if (isMixParlay)
            {
                choice += string.Join(null, new string[] { " @ ", Formatter.FormatNumber3(ticket.Odds, null) });
            }

            if (BetTeamValue.AOS == ticket.BetTeam.ToLowerInvariant() && !string.IsNullOrEmpty(ticket.TransDesc))
            {
                string[] excluding = new string[]
                {
                    "\n",
                    CoreBetList.Excluding,
                    ": ",
                    FormatTransDesc(ticket.TransDesc)
                };

                choice += string.Join(null, excluding);
            }

            if (!string.IsNullOrEmpty(choice))
            {
                choice = choice.Replace(HtmlCharacters.NoneBreakingSpace, Space);
                rtfHelper.RTFRenderer.AddText(choice, rtfHelper.PosFont);
            }
        }
        private RTFHelper CreateRTFHelperStub()
        {
            var workbook = new HSSFWorkbook();
            var rtfHelper = new RTFHelper()
            {
                NegFont = workbook.CreateFont(),
                NormalFont = workbook.CreateFont(),
                PosFont = workbook.CreateFont(),
                NegFontCrossed = workbook.CreateFont(),
                NormalFontCrossed = workbook.CreateFont(),
                PosFontCrossed = workbook.CreateFont(),
                RTFRenderer = new RtfTextRender()
            };

            return rtfHelper;
        }
Esempio n. 11
0
        /// <summary>
        /// Combines the sub rich text string.
        /// </summary>
        /// <param name="tmpRtfChoice">The temporary RTF choice.</param>
        /// <param name="tmpRtfHelper">The temporary RTF helper.</param>
        /// <param name="posFont">The position font.</param>
        /// <param name="normalFont">The normal font.</param>
        private static void CombineSubRichTextString(List<IRichTextString> tmpRtfChoice, ref RTFHelper tmpRtfHelper, IFont posFont, IFont normalFont)
        {
            foreach (HSSFRichTextString rtfString in tmpRtfChoice)
            {
                // Remove extra line-breaks
                while (rtfString.String.StartsWith("\n", StringComparison.OrdinalIgnoreCase))
                {
                    rtfString.String.Remove(0, 1);
                }

                try
                {
                    int lineBreakIndex = rtfString.String.IndexOf("\n");
                    string eventName = rtfString.String.Substring(0, lineBreakIndex);
                    string theRest = rtfString.String.Remove(0, eventName.Length);
                    tmpRtfHelper.RTFRenderer.AddText("\n" + eventName, posFont);
                    tmpRtfHelper.RTFRenderer.AddText(theRest, normalFont);
                }
                catch
                {
                    throw;
                }
            }
        }