protected virtual IRichTextString RTFRender(RTFHelper rtfHelper) { IRichTextString rtfStatus = rtfHelper.RTFRenderer.Render(); rtfHelper.RTFRenderer.Clear(); return rtfStatus; }
/// <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="isShowVNIP">If set to <c>true</c> [VNIP is shown].</param> /// <param name="rtfHelper">The RTF helper.</param> /// <returns> /// IRichTextString represents the Status block. /// </returns> public override IRichTextString RenderRTF(ITicket ticket, ITicketHelper ticketHelper, List<ITicketData> ticketData, bool isShowVNIP, RTFHelper rtfHelper) { Render(ticket, ticketHelper, ticketData, isShowVNIP); // Status != Win/Lose if (Template.result.Length < 80) { rtfHelper.RTFRenderer.AddText(Template.result, rtfHelper.PosFont); } else { int breakPos = Template.result.IndexOf("<br/>"); string status_WinString = Template.result.Substring(0, breakPos); string status_PlaceString = Template.result.Replace(status_WinString, string.Empty); string status_Win = ExtractStringBetweenTag("b", status_WinString); string status_Place = ExtractStringBetweenTag("b", status_PlaceString); string[] status = new string[] { CoreBetList.win, ": ", status_Win, "\n", CoreBetList.place, ": ", status_Place }; rtfHelper.RTFRenderer.AddText(string.Join(null, status), rtfHelper.PosFont); } if (Template.ShowIP.Visible) { string status = string.Join(null, new string[] { "\n", Template.ShowIP.betIp }); rtfHelper.RTFRenderer.AddText(status); } var rtfStatus = rtfHelper.RTFRenderer.Render(); rtfHelper.RTFRenderer.Clear(); return rtfStatus; }
/// <summary> /// Builds the RTF odds. /// </summary> /// <param name="rtfHelper">The RTF helper.</param> /// <returns>IRichTextString object.</returns> protected override IRichTextString BuildRTFOdds(RTFHelper rtfHelper) { if (Template.odds == "-") { return new HSSFRichTextString("-"); } int breakPos = Template.odds.IndexOf("<br>"); string oddsWinString = Template.odds.Substring(0, breakPos); string oddsPlaceString = Template.odds.Replace(oddsWinString, string.Empty); string oddsWinVal = ExtractStringBetweenTag("b", oddsWinString); string oddsPlaceVal = ExtractStringBetweenTag("b", oddsPlaceString); var rtfNumberRenderer = new RTFNumber(rtfHelper.RTFRenderer, rtfHelper.PosFont, rtfHelper.NegFont); // Add Win rtfHelper.RTFRenderer.AddText(string.Join(null, new string[] { CoreBetList.win, ": " }), rtfHelper.PosFont); rtfNumberRenderer.Render(oddsWinVal); // Add Place rtfHelper.RTFRenderer.AddText(string.Join(null, new string[] { "\n", CoreBetList.place, ": " }), rtfHelper.PosFont); rtfNumberRenderer.Render(oddsPlaceVal); var rtfOdds = rtfHelper.RTFRenderer.Render(); rtfHelper.RTFRenderer.Clear(); return rtfOdds; }
public override IRichTextString RenderRTF(ITicket ticket, List<ITicketData> ticketData, GetCachePropertyById funcGetOddsTypeName, RTFHelper rtfHelper) { Render(ticket, ticketData, funcGetOddsTypeName); var rtfOdds = BuildRTFOddsCasino(rtfHelper); return rtfOdds; }
protected override void BuildResultLRF(string status, RTFHelper rtfHelper) { status = status.Replace("<br/><div style='font-weight: normal;'>", "\n"); status = status.Replace("</div>", string.Empty); rtfHelper.RTFRenderer.AddText(status, rtfHelper.PosFont); }
protected override IRichTextString BuildRTFChoice(ITicket ticket, RTFHelper rtfHelper, ITicketHelper ticketHelper) { rtfHelper.RTFRenderer.AddText(CoreBetList.p2pGame, rtfHelper.PosFont); var choiceRtf = rtfHelper.RTFRenderer.Render(); rtfHelper.RTFRenderer.Clear(); return choiceRtf; }
protected virtual void BuildResultIpRTF(ITicket ticket, ITicketHelper ticketHelper, RTFHelper rtfHelper) { string status = Template.result; if (Template.ShowIP != null && Template.ShowIP.Visible) { status = string.Join(null, new string[] { "\n", Template.ShowIP.betIp }); rtfHelper.RTFRenderer.AddText(status); } }
public override IRichTextString RenderRTF(ITicket ticket, ITicketHelper ticketHelper, List<ITicketData> ticketData, bool isShowVNIP, RTFHelper rtfHelper) { Render(ticket, ticketHelper, ticketData, isShowVNIP); BuildResultWinPlaceLRF(rtfHelper); BuildResultIpRTF(ticket, ticketHelper, rtfHelper); return RTFRender(rtfHelper); }
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; }
public List<IRichTextString> RenderRTF(ITicket ticket, ITicketHelper ticketHelper, List<ITicketData> ticketData, bool isShowScoreMap, RTFHelper rtfHelper) { var bettypeId = ticket.BetTypeId; ticket.BetTypeId = (int)ticket.BetId; var choice = CreateChoice(ticket.BetTypeId); var template = choice.RenderRTF(ticket, ticketHelper, ticketData, isShowScoreMap, rtfHelper); ticket.BetTypeId = bettypeId; return template; }
/// <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="isShowVNIP">If set to <c>true</c> [VNIP is shown].</param> /// <param name="rtfHelper">The RTF helper.</param> /// <returns>IRichTextString represents the Status block.</returns> public virtual IRichTextString RenderRTF(ITicket ticket, ITicketHelper ticketHelper, List<ITicketData> ticketData, bool isShowVNIP, RTFHelper rtfHelper) { Render(ticket, ticketHelper, ticketData, isShowVNIP); string status = Template.result; BuildResultLRF(status, rtfHelper); BuildResultIpRTF(ticket, ticketHelper, rtfHelper); return RTFRender(rtfHelper); }
public virtual List<IRichTextString> RenderRTF( ITicket ticket, ITicketHelper ticketHelper, List<ITicketData> ticketData, bool isShowScoreMap, RTFHelper rtfHelper) { Render(ticket, ticketHelper, ticketData, isShowScoreMap); var choiceData = BuildRTFChoice(ticket, rtfHelper, ticketHelper); var rtfChoice = new List<IRichTextString> { choiceData }; return rtfChoice; }
/// <summary> /// Clones this instance. /// </summary> /// <returns>RTFHelper object.</returns> public RTFHelper Clone() { RTFHelper tmp = new RTFHelper(); tmp.PosFont = PosFont; tmp.NegFont = NegFont; tmp.NormalFont = NormalFont; tmp.NormalFontCrossed = NormalFontCrossed; tmp.PosFontCrossed = PosFontCrossed; tmp.NegFontCrossed = NegFontCrossed; tmp.RTFRenderer = new RtfTextRender(); return tmp; }
public override List<IRichTextString> RenderRTF( ITicket ticket, ITicketHelper ticketHelper, List<ITicketData> ticketData, bool isShowScoreMap, RTFHelper rtfHelper) { RTFHelper tmpRtfHelper = rtfHelper.Clone(); string betTypeName = ticketHelper.GetBetTypeNameById(ticket.BetTypeId); tmpRtfHelper.RTFRenderer.AddText(betTypeName, tmpRtfHelper.PosFont); var choice = tmpRtfHelper.RTFRenderer.Render(); tmpRtfHelper.RTFRenderer.Clear(); return new List<IRichTextString>() { choice }; }
/// <summary> /// Build Result string for Win/Place betType /// </summary> /// <param name="rtfHelper"></param> protected virtual void BuildResultWinPlaceLRF(RTFHelper rtfHelper) { // Status != Win/Lose if (Template.result.Length < 80) { rtfHelper.RTFRenderer.AddText(Template.result, rtfHelper.PosFont); } else { int breakPos = Template.result.IndexOf("<br/>"); string status_WinString = Template.result.Substring(0, breakPos); string status_PlaceString = Template.result.Replace(status_WinString, string.Empty); string status_Win = ExtractStringBetweenTag("b", status_WinString); string status_Place = ExtractStringBetweenTag("b", status_PlaceString); string[] status = new string[] { CoreBetList.win, ": ", status_Win, "\n", CoreBetList.place, ": ", status_Place }; rtfHelper.RTFRenderer.AddText(string.Join(null, status), rtfHelper.PosFont); } }
public void RenderRTF_WhenCalled_RemoveHtmlTag() { var betTypeName = "Baccarat"; _ticketHelper.GetBetTypeNameById(Arg.Any<int>()).Returns(betTypeName); 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() }; _choice.RenderRTF(_ticket, _ticketHelper, null, false, rtfHelper); Assert.AreEqual(_choice.Template.League.LeagueName.leagueName, betTypeName); }
public void RenderRTF_SubTicket_RemoveHtmlTag() { //// Arrange _ticket.BetTypeId = 1801; _ticket.TransDesc = "round=DSP*tableCode=va21*game=BAC*type=1*val="; 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() }; //// Act _choice.RenderRTF(_ticket, _ticketHelper, null, false, rtfHelper); //// Assert Assert.IsTrue(!_choice.Template.League.LeagueName.leagueName.Contains("<span class='ag-casino-bet-type'>")); }
protected virtual void BuildResultLRF(string status, RTFHelper rtfHelper) { rtfHelper.RTFRenderer.AddText(status, rtfHelper.PosFont); }
/// <summary> /// Builds the RTF choice. /// </summary> /// <param name="ticket">The ticket.</param> /// <param name="rtfHelper">The RTF helper.</param> /// <param name="ticketHelper">The ticket helper.</param> /// <returns>Return RichTextString.</returns> protected virtual IRichTextString BuildRTFChoice(ITicket ticket, RTFHelper rtfHelper, ITicketHelper ticketHelper) { var isMixParlay = false; AdjustBetTeamToRTF(); // the 1st line BuildBetFigure(ticket, ref rtfHelper, isMixParlay); // the 2nd line BuildBetTypeName(ref rtfHelper); // the 3rd line BuildBetTeamsInfo(ticket, ref rtfHelper); // the 4th line BuildMatchInfo(ref rtfHelper); var choiceRtf = rtfHelper.RTFRenderer.Render(); rtfHelper.RTFRenderer.Clear(); return choiceRtf; }
protected virtual void BuildBetTeamsInfo(ITicket ticket, ref RTFHelper rtfHelper) { if (Template.Match != null) { bool isAddNewLine = false; string choice = string.Empty; if (!string.IsNullOrEmpty(Template.Match.homeTeam)) { choice = Template.Match.homeTeam.Replace(HtmlCharacters.NoneBreakingSpace, Space); } if (!string.IsNullOrEmpty(choice)) { isAddNewLine = true; rtfHelper.RTFRenderer.AddText("\n" + choice); choice = string.Empty; } BuildTicketFG_LG(ticket); if (!string.IsNullOrEmpty(Template.Match.home_firstGoal_lastGoal)) { choice = string.Join(null, new string[] { Space, Template.Match.home_firstGoal_lastGoal }); } if (!string.IsNullOrEmpty(choice)) { isAddNewLine = true; choice = choice.Replace(HtmlCharacters.NoneBreakingSpace, Space); rtfHelper.RTFRenderer.AddText(choice, rtfHelper.PosFont); choice = string.Empty; } if (Template.Match.VS != null && Template.Match.VS.Visible) { choice = "- vs -"; } if (!string.IsNullOrEmpty(Template.Match.awayTeam)) { choice += string.Join(null, new string[] { Space, Template.Match.awayTeam }); } if (!string.IsNullOrEmpty(choice)) { isAddNewLine = true; choice = choice.Replace(HtmlCharacters.NoneBreakingSpace, Space); rtfHelper.RTFRenderer.AddText(choice); choice = string.Empty; } if (!string.IsNullOrEmpty(Template.Match.away_firstGoal_lastGoal)) { choice = Space + Template.Match.away_firstGoal_lastGoal; } if (!string.IsNullOrEmpty(choice) || isAddNewLine) { choice = choice.Replace(HtmlCharacters.NoneBreakingSpace, Space); rtfHelper.RTFRenderer.AddText(choice, rtfHelper.PosFont); } } }
protected virtual void BuildMatchInfo(ref RTFHelper rtfHelper) { if (Template.League != null) { string choice = string.Empty; if (!string.IsNullOrEmpty(Template.League.sportTypeName)) { choice = Template.League.sportTypeName; } if (Template.League.LeagueName != null && !string.IsNullOrEmpty(Template.League.LeagueName.leagueName)) { if (!string.IsNullOrEmpty(choice)) { choice += Space; } choice += Template.League.LeagueName.leagueName; } if (!string.IsNullOrEmpty(choice)) { choice = choice.Replace(HtmlCharacters.NoneBreakingSpace, Space); rtfHelper.RTFRenderer.AddText("\n" + choice); } } }
/// <summary> /// Builds the name of the bet type. /// </summary> /// <param name="rtfHelper">The RTF helper.</param> protected virtual void BuildBetTypeName(ref RTFHelper rtfHelper) { var choice = string.Empty; if (Template.BetType != null && !string.IsNullOrEmpty(Template.BetType.betTypeName)) { choice = Template.BetType.betTypeName.Replace(HtmlCharacters.NoneBreakingSpace, Space); rtfHelper.RTFRenderer.AddText("\n" + choice); } }
/// <summary> /// Builds the bet figure. /// </summary> /// <param name="ticket">The ticket.</param> /// <param name="rtfHelper">The RTF helper.</param> /// <param name="isMixParlay">If set to <c>true</c> [is mix parlay].</param> protected virtual 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) { 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 (!string.IsNullOrEmpty(choice)) { choice = choice.Replace(HtmlCharacters.NoneBreakingSpace, Space); rtfHelper.RTFRenderer.AddText(choice, rtfHelper.PosFont); } }
public void RenderRTF_MainTicket_RemoveHtmlTag() { //// Arrange _ticket.TransDesc = string.Empty; var betTypeName = "Baccarat"; _ticketHelper.GetBetTypeNameById(Arg.Any<int>()).Returns(betTypeName); 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() }; //// Act _choice.RenderRTF(_ticket, _ticketHelper, null, false, rtfHelper); //// Assert Assert.AreEqual(betTypeName, _choice.Template.League.LeagueName.leagueName); }
/// <summary> /// Builds the RTF odds. /// </summary> /// <param name="rtfHelper">The RTF helper.</param> /// <returns>IRichTextString represents excel-formatted Odds string.</returns> protected virtual IRichTextString BuildRTFOdds(RTFHelper rtfHelper) { string odds = Template.odds; var rtfNumberRenderer = new RTFNumber(rtfHelper.RTFRenderer, rtfHelper.PosFont, rtfHelper.NegFont); rtfNumberRenderer.Render(odds); if (!string.IsNullOrEmpty(Template.oddsType)) { odds = "\n" + Template.oddsType; rtfHelper.RTFRenderer.AddText(odds, rtfHelper.PosFont); } var rtfOdds = rtfHelper.RTFRenderer.Render(); rtfHelper.RTFRenderer.Clear(); return rtfOdds; }
public void RenderRTF_SubTicket_RemoveHtmlTag() { //// Arrange _ticket.TransDesc = "1"; var gameName = "Game Name"; _ticketHelper.GetResourceData("MG_Casino", "1").Returns(gameName); var betTypeName = "Baccarat"; _ticketHelper.GetBetTypeNameById(Arg.Any<int>()).Returns(betTypeName); 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() }; //// Act _choice.RenderRTF(_ticket, _ticketHelper, null, false, rtfHelper); //// Assert var expectedLeagueName = string.Format("{0} {1}", betTypeName, gameName); Assert.AreEqual(expectedLeagueName, _choice.Template.League.LeagueName.leagueName); }