public HtmlInvestmentProofGenerator(InvestmentUsersPlans userPlan) { this.userPlan = userPlan; user = new Member(userPlan.UserId); fileName = string.Format("{0}.pdf", userPlan.GeneratePlanNumber()); platformPlan = new InvestmentPlatformPlan(userPlan.PlanId); }
string GetHtml() { var defaultColor = platformPlan.Color; var myColor = ColorTranslator.FromHtml(defaultColor); var myBrighterColor = HexConverter(ControlPaint.Light(myColor)); var myDarkerColor = HexConverter(ControlPaint.Dark(myColor)); var watermark = AppSettings.InvestmentPlatform.ProofsWatermarkEnabled ? string.Format("{0}/Images/Misc/WATERMARK.png", AppSettings.Site.Url) : ""; var htmlFromFile = File.ReadAllText(HttpContext.Current.Request.MapPath(TemplateLocation)); string htmlString; if (AppSettings.InvestmentPlatform.LevelsEnabled) { htmlString = htmlFromFile .Replace("[FIRST_COLOR]", defaultColor) .Replace("[SECOND_COLOR]", myDarkerColor) .Replace("[THIRD_COLOR]", myBrighterColor) .Replace("[TICKET_NAME]", platformPlan.Name) .Replace("[DATE_TIME]", ticket.Date.ToString()) .Replace("[TICKET_NO_TEXT]", string.Format("{0}:", U6012.TICKETNO)) .Replace("[TICKET_NO]", ticket.GenerateTicketNumber()) .Replace("[INVESTMENT_TEXT]", string.Format("{0}:", U6006.INVESTMENT)) .Replace("[DEPOSITED_AND_FEE]", string.Format("{0}: {1} + {2}", U6012.TICKETDEPOSITEDFEE, ticket.LevelPrice.ToString(), ticket.LevelFee.ToString())) .Replace("[RECEIVE]", string.Format("{0}: {1}", U6012.TICKETRECEIVE, ticket.LevelEarnings.ToString())) .Replace("[NOTE]", AppSettings.InvestmentPlatform.ProofsNote) .Replace("[IMAGE_PATH]", watermark) .Replace("[SITE_URL]", AppSettings.Site.Url); } else { htmlString = htmlFromFile .Replace("[FIRST_COLOR]", defaultColor) .Replace("[SECOND_COLOR]", myDarkerColor) .Replace("[THIRD_COLOR]", myBrighterColor) .Replace("[TICKET_NAME]", platformPlan.Name) .Replace("[DATE_TIME]", userPlan.PurchaseDate.ToString()) .Replace("[TICKET_NO_TEXT]", string.Format("{0}:", U6012.TICKETNO)) .Replace("[TICKET_NO]", userPlan.GeneratePlanNumber()) .Replace("[INVESTMENT_TEXT]", string.Format("{0}:", U6006.INVESTMENT)) .Replace("[DEPOSITED_AND_FEE]", string.Format("{0}: {1}", L1.PRICE, platformPlan.Price.ToString())) .Replace("[RECEIVE]", string.Format("{0}: {1}", U6012.TICKETRECEIVE, userPlan.MoneyToReturn.ToString())) .Replace("[NOTE]", AppSettings.InvestmentPlatform.ProofsNote) .Replace("[TIME]", string.Format("{0}: {1} {2}", U6006.REPURCHASETIME, platformPlan.Time.ToString(), L1.DAYS)) .Replace("[IMAGE_PATH]", watermark) .Replace("[SITE_URL]", AppSettings.Site.Url); } return(htmlString); }