Example #1
0
        private string CreateReferralHtmlPages(PrintReferral referral)
        {
            var handleBars = Handlebars.Create();

            handleBars.RegisterTemplate("stylePartial", GetCSSPartialView());

            var partialViewType = MapToReferralType(referral.Type);

            var partialItemsSource = GetItemsPartialView(partialViewType);

            handleBars.RegisterTemplate("itemsPartial", partialItemsSource);

            handleBars.RegisterTemplate("itemsDetailTitle", string.Empty);

            var partialSupplierSource = GetSupplierPartialView(partialViewType);

            handleBars.RegisterTemplate("supplierPartial", partialSupplierSource);

            var partialChecklistSource = GetChecklistPartialView(partialViewType);

            handleBars.RegisterTemplate("checklistPartial", partialChecklistSource);

            var template = handleBars.Compile(TemplateLoader.LoadTemplate(ReferalMainViews.Referral.ToString()));

            var result = template(referral);

            return($"{result}{pageBreak}");
        }
Example #2
0
        private string CreateReferralHtmlPages(PrintReferral referral)
        {
            var handleBars = Handlebars.Create();

            handleBars.RegisterTemplate("stylePartial", GetCSSPartialView());

            var partialViewType = MapToReferralType(referral.Type);

            var partialItemsSource = GetItemsPartialView(partialViewType);

            handleBars.RegisterTemplate("itemsPartial", partialItemsSource);

            handleBars.RegisterTemplate("itemsDetailTitle", string.Empty);

            var partialSupplierSource = GetSupplierPartialView(partialViewType);

            handleBars.RegisterTemplate("supplierPartial", partialSupplierSource);

            var partialChecklistSource = GetChecklistPartialView(partialViewType);

            handleBars.RegisterTemplate("checklistPartial", partialChecklistSource);

            var template = handleBars.Compile(TemplateLoader.LoadTemplate(ReferalMainViews.Referral.ToString()));

            referral.VolunteerDisplayName = userService.GetDisplayName();
            // If we're in prod, we don't want the watermark
            referral.DisplayWatermark = !env.IsProduction();

            var result = template(referral);

            return($"{result}{pageBreak}");
        }