コード例 #1
0
        /// <summary>
        /// Exports a pdf report of the overall info on the site
        /// Includes a list of my hobbies if selected, list of reason I would like to work here and
        /// Sends a text message if selected
        /// </summary>
        /// <param name="IncludeHobby"></param>
        /// <param name="IncludeReason"></param>
        /// <param name="MobileNumber"></param>
        /// <param name="SendText"></param>
        public FileResult ExportReport(bool IncludeHobby, bool IncludeReason, string MobileNumber, bool SendText)
        {
            string template = "";

            if (IncludeReason || IncludeHobby)
            {
                var webUtility = new DemoUtility();
                var model      = new ExportModel();

                if (IncludeReason)
                {
                    model.Interests = InterestManager.GetInterests(null).ToList();
                }

                if (IncludeHobby)
                {
                    model.Hobbies = AboutMeManager.GetHobbies(null, null, null).ToList();
                }

                template = webUtility.RenderViewToString(this.ControllerContext, "~/Views/Home/ExportTemplate.cshtml", model, false);
            }

            //This would go in the Utilities Project normally
            if (SendText)
            {
                TwilioClient.Init(accountSid, authToken);

                var message = MessageResource.Create(
                    body: "Your Export Is Complete",
                    from: new Twilio.Types.PhoneNumber("+14028107013"),
                    to: new Twilio.Types.PhoneNumber($"+1{MobileNumber.Trim('-')}")
                    );
            }

            var         converter   = new HtmlToPdf();
            PdfDocument pdfDocument = converter.ConvertHtmlString(template);

            byte[] pdfFile = pdfDocument.Save();
            pdfDocument.Close();

            FileResult fileResult = new FileContentResult(pdfFile, "application/pdf");

            return(fileResult);
        }
コード例 #2
0
 private void ShowCode()
 {
     DemoUtility.ShowCode(GetComponent <ReadOnlyTransform>());
 }
コード例 #3
0
 private void ShowCode()
 {
     DemoUtility.ShowCode(GetComponent <StickyNote>());
 }
コード例 #4
0
 private void ShowCode()
 {
     DemoUtility.ShowCode(GetComponent <ButtonDemo>());
 }