protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("Invitation", _invitation); properties.Add("DonationAmount", _donationRequest == null ? string.Empty : _donationRequest.Amount.ToString("C")); properties.Add("DonationRecipient", _donationRecipient == null ? string.Empty : _donationRecipient.Name); properties.Add("MessageText", _invitation.Text); // Current Job if (!_currentJobs.IsNullOrEmpty() && _currentJobs.Count > 0) { // Choose the one with the most recent start date. var currentJob = (from j in _currentJobs where !string.IsNullOrEmpty(j.Title) && j.Dates.Start != null orderby j.Dates.Start.Value descending select j.Title).FirstOrDefault(); properties.Add("CurrentJob", currentJob); } else { properties.Add("CurrentJob", string.Empty); } // ContactCount properties.Add("ContactCount", _contactCount > 0 ? _contactCount : 0); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("Subject", _subject); properties.Add("Content", _content); properties.Add("Organisation", _organisation, typeof(Organisation)); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("Content", _content); properties.Add("PhoneNumber", _phoneNumber); properties.Add("EnquiryType", _subcategory != null ? _subcategory.Name : "Report a site issue"); }
private ReadOnlyUrl GetUrl(TemplateContext context, TemplateProperties properties) { // Get the user id. var user = properties["To"] as IUser; if (user == null) { throw new ApplicationException("No user has been supplied."); } // Get the application path. var applicationPath = "~/communications/definitions/" + context.Definition; var queryString = new QueryString( "userId", user.Id.ToString(), "contextId", context.Id.ToString(), "definition", context.Definition, "category", context.Category); if (context.VerticalId != null) { queryString.Add("verticalId", context.VerticalId.Value.ToString()); } return(_webSiteQuery.GetUrl(WebSite.Management, null, false, applicationPath, queryString)); }
protected virtual void AddProperties(TemplateProperties properties) { properties.Add("Id", Id); properties.Add("Definition", Definition); properties.Add("To", To, typeof(ICommunicationUser)); properties.Add("From", From, typeof(ICommunicationUser)); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("LoginId", _loginId); properties.Add("Password", _password); properties.Add("Candidates", _candidates); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("ReportDate", _dailyReport.Day.Start.Value); properties.Add("MemberReport", _dailyReport.MemberReport); properties.Add("ResumeReport", _dailyReport.ResumeReport); properties.Add("OpenJobAds", _dailyReport.OpenJobAds); properties.Add("JobSearches", _dailyReport.JobSearches); properties.Add("JobApplications", _dailyReport.InternalJobApplications); properties.Add("ExternalJobRedirects", _dailyReport.ExternalJobApplications); properties.Add("WebMemberSearchBreakdownReport", _dailyReport.MemberSearchReports["Web"]); properties.Add("WebMemberViewingBreakdownReport", _dailyReport.MemberViewingReports["Web"]); properties.Add("WebMemberAccessBreakdownReport", _dailyReport.MemberAccessReports["Web"]); properties.Add("ApiMemberSearchBreakdownReport", _dailyReport.MemberSearchReports["API"]); properties.Add("ApiMemberViewingBreakdownReport", _dailyReport.MemberViewingReports["API"]); properties.Add("ApiMemberAccessBreakdownReport", _dailyReport.MemberAccessReports["API"]); properties.Add("ResumeSearchAlerts", _dailyReport.ResumeSearchAlerts); properties.Add("JobSearchAlerts", _dailyReport.JobSearchAlerts); properties.Add("InvitationsSent", _dailyReport.InvitationsSent); properties.Add("InvitationsAccepted", _dailyReport.InvitationsAccepted); // Daily properties.Add("LoggedInUniqueDaily", _dailyReport.DailyLogIns.Values.Sum()); properties.Add("LoggedInUniquePercentageDaily", GetPercentage(_dailyReport.DailyLogIns.Values.Sum())); properties.Add("LoggedInUniqueMembersDaily", _dailyReport.DailyLogIns[UserType.Member]); properties.Add("LoggedInUniqueEmployersDaily", _dailyReport.DailyLogIns[UserType.Employer]); properties.Add("LoggedInUniqueAdministratorsDaily", _dailyReport.DailyLogIns[UserType.Administrator]); properties.Add("LoggedInUniqueCustodiansDaily", _dailyReport.DailyLogIns[UserType.Custodian]); // Weekly properties.Add("LoggedInUniqueWeekly", _dailyReport.WeeklyLogIns.Values.Sum()); properties.Add("LoggedInUniqueWeeklyPercentage", GetPercentage(_dailyReport.WeeklyLogIns.Values.Sum())); properties.Add("LoggedInUniqueMembersWeekly", _dailyReport.WeeklyLogIns[UserType.Member]); properties.Add("LoggedInUniqueEmployersWeekly", _dailyReport.WeeklyLogIns[UserType.Employer]); properties.Add("LoggedInUniqueAdministratorsWeekly", _dailyReport.WeeklyLogIns[UserType.Administrator]); properties.Add("LoggedInUniqueCustodiansWeekly", _dailyReport.WeeklyLogIns[UserType.Custodian]); // Monthly properties.Add("LoggedInUniqueMonthly", _dailyReport.MonthlyLogIns.Values.Sum()); properties.Add("LoggedInUniqueMonthlyPercentage", GetPercentage(_dailyReport.MonthlyLogIns.Values.Sum())); properties.Add("LoggedInUniqueMembersMonthly", _dailyReport.MonthlyLogIns[UserType.Member]); properties.Add("LoggedInUniqueEmployersMonthly", _dailyReport.MonthlyLogIns[UserType.Employer]); properties.Add("LoggedInUniqueAdministratorsMonthly", _dailyReport.MonthlyLogIns[UserType.Administrator]); properties.Add("LoggedInUniqueCustodiansMonthly", _dailyReport.MonthlyLogIns[UserType.Custodian]); properties.Add("AcceptanceRateLast48Hours", _dailyReport.AcceptanceRateLast48Hours); properties.Add("AcceptanceRatePreviousMonth", _dailyReport.AcceptanceRatePreviousMonth); properties.Add("OrderReports", _dailyReport.OrderReports, typeof(IList)); properties.Add("CommunicationReports", new SortedList((IDictionary)_dailyReport.CommunciationReports)); properties.Add("PromotionCodeReports", new SortedList((IDictionary)_dailyReport.PromotionCodeReports)); properties.Add("JobAdIntegrationReports", new SortedList((IDictionary)_dailyReport.JobAdIntegrationReports)); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("AskerEmailAddress", _askerEmailAddress); properties.Add("AskerName", _askerName); properties.Add("ResourceCategory", _category); properties.Add("Question", _question); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("toName", To.FirstName); properties.Add("orgName", _organisation.FullName); properties.Add("reportPeriod", GetReportPeriodDescription(_startDate, _endDate)); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("TotalCandidates", _totalCandidates); properties.Add("TotalJobs", _totalJobs); properties.Add("SuggestedCandidates", _suggestedCandidates, typeof(IList)); properties.Add("Views", GetEmailViews(_suggestedCandidates.SelectMany(s => s.CandidateIds), _views)); }
private CopyItem GetCopyItem(TemplateContext context, TemplateProperties properties) { var url = GetUrl(context, properties); var htmlText = GetCopyText(url, MediaType.Html); var plainText = GetCopyText(url, MediaType.Text); return(CreateCopyItem(htmlText, plainText)); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("JobTitle", _jobAd.Title); properties.Add("ExternalReferenceId", _jobAd.Integration.ExternalReferenceId); properties.Add("ApplicantId", _jobApplication.ApplicantId); properties.Add("Content", _jobApplication.CoverLetterText); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("Representee", _representee, typeof(ICommunicationUser)); properties.Add("Subject", _subject); properties.Add("Content", _content); properties.Add("Organisation", _organisation, typeof(Organisation)); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("ToDisplayName", _toDisplayName); properties.Add("FromDisplayName", _fromDisplayName); properties.Add("MessageText", _messageText); properties.Add("JobAd", _jobAd); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("ThreadId", _threadId); properties.Add("MessageId", _messageId); properties.Add("MessageSubject", _messageSubject); properties.Add("MessageText", _messageText); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("TotalMatches", _totalMatches); properties.Add("Jobs", _emailItems); properties.Add("Timestamp", DateTime.Now.ToLongDateString()); properties.Add("MaxMatches", MaxMatches); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("ContactName", _contactName); properties.Add("ContactPhone", _contactPhone); properties.Add("ContactEmail", _contactEmail); properties.Add("CompanyName", _companyName); properties.Add("Message", _message); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("Subject", _subject); properties.Add("Content", _content); properties.Add("MemberDisplayName", _candidateName); properties.Add("ResumeId", _resumeId); properties.Add("Date", DateTime.Now.ToShortDateString()); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("Matches", _matches); properties.Add("Results", _jobSearchResults); properties.Add("CriteriaText", _criteriaText); properties.Add("CriteriaHtml", _criteriaHtml); properties.Add("CriteriaQueryString", _criteriaQueryString); properties.Add("SavedSearchId", _savedSearchId); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("Order", _order); properties.Add("Products", _products); properties.Add("Credits", _credits); properties.Add("Adjustments", _adjustments); properties.Add("Receipt", _receipt); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("OrgName", _organisation.FullName); properties.Add("ReportPeriod", GetReportPeriodDescription(_startDate, _endDate)); properties.Add("NoActivity", GetNoActivityDisplayString()); properties.Add("HaveAttachments", !GetAttachments().IsNullOrEmpty()); properties.Add("CustomHtmlSnippets", _customHtmlSnippets.Count == 0 ? string.Empty : "<p>" + string.Join("</p><p>", _customHtmlSnippets.ToArray()) + "</p>"); }
protected override string GetCopyText(TemplateContext context, TemplateProperties properties) { // Create the object to keep track of all mappings used when generating the text. var mappings = new TinyUrlMappings(_webSiteQuery, context.Id, context.Definition, MimeType, _webSite, context.UserId, VerticalId); properties.Add("TinyUrls", mappings); // Get the text. var text = base.GetCopyText(context, properties); // Register those mappings. _tinyUrlCommand.CreateMappings(mappings); return(text); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("ToIsActivated", To.IsActivated); properties.Add("Invitation", _invitation); properties.Add("MessageText", _invitation.Text); if (_emailVerification != null) { properties.Add("InviteeVerificationCode", _emailVerification.VerificationCode); properties.Add("InvitationId", string.Empty); } else { properties.Add("InviteeVerificationCode", string.Empty); properties.Add("InvitationId", string.Empty); } }
/// <summary> /// Initializes a new instance of the <see cref="CandleTemplateHost"/> class. /// </summary> /// <param name="currentElement">The current element.</param> /// <param name="properties">The properties.</param> public CandleTemplateHost(ICustomizableElement currentElement, TemplateProperties properties) { s_templateProperties = properties; if (properties == null) { s_templateProperties = new TemplateProperties(); } _currentElement = currentElement; s_instance = this; standardAssemblyReferences = new List <string>(); standardAssemblyReferences.Add("System.dll"); standardAssemblyReferences.Add("Microsoft.VisualStudio.Modeling.SDK, Version=" + ModelConstants.VisualStudioVersion); standardAssemblyReferences.Add("Microsoft.VisualStudio.TextTemplating.VSHost, Version=" + ModelConstants.VisualStudioVersion); //if (type != null && type.Assembly.FullName != this.GetType().Assembly.FullName) // standardAssemblyReferences.Add(type.Assembly.FullName); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("ToIsActivated", To.IsActivated); properties.Add("Invitation", _invitation); properties.Add("MessageText", _invitation.Text); if (_emailVerification != null) { properties.Add("InviteeVerificationCode", _emailVerification.VerificationCode); properties.Add("InvitationId", string.Empty); } else { properties.Add("InviteeVerificationCode", string.Empty); properties.Add("InvitationId", string.Empty); } // Current Job if (!_currentJobs.IsNullOrEmpty() && _currentJobs.Count > 0) { // Choose the one with the most recent start date. var currentJob = (from j in _currentJobs where !string.IsNullOrEmpty(j.Title) && j.Dates.Start != null orderby j.Dates.Start.Value descending select j.Title).FirstOrDefault(); properties.Add("CurrentJob", currentJob); } else { properties.Add("CurrentJob", string.Empty); } // ContactCount properties.Add("ContactCount", _contactCount > 0 ? _contactCount : 0); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("Criteria", _criteriaText); properties.Add("TotalMatches", _results.MemberIds.Count); properties.Add("Header", GetHeader(_results.MemberIds.Count)); var newResults = new List <Guid>(); var updatedResults = new List <Guid>(); var emailViews = new EmployerMemberEmailViews(); GetResults(newResults, updatedResults, emailViews); var newCount = newResults.Count; properties.Add("NewResults", newResults, typeof(IList)); properties.Add("UpdatedResults", updatedResults, typeof(IList)); properties.Add("Views", emailViews); properties.Add("NewCount", newCount); properties.Add("UpdatedCount", _results.MemberIds.Count - newCount); properties.Add("SavedSearchId", _savedSearchId.ToString("B")); // To help debugging. }
public static async Task <RestGuildTemplate> ModifyTemplateAsync(IGuild guild, BaseDiscordClient client, string code, Action <TemplateProperties> func, bool withSnapshot, RequestOptions options) { if (func == null) { throw new ArgumentNullException(paramName: nameof(func)); } TemplateProperties props = new TemplateProperties(); func(props); CreateTemplateParams apiargs = new CreateTemplateParams(); if (props.Name.IsSpecified) { apiargs.Name = props.Name.Value; } if (props.Description.IsSpecified) { apiargs.Description = props.Description.Value; } if (withSnapshot) { GuildTemplateSnapshotJson model = await client.ApiClient.ModifyTemplateAsync <API.GuildTemplateSnapshotJson>(guild.Id, code, apiargs, options).ConfigureAwait(false); return(RestGuildTemplate.Create(client, model, withSnapshot)); } else { GuildTemplateJson model = await client.ApiClient.ModifyTemplateAsync <API.GuildTemplateJson>(guild.Id, code, apiargs, options).ConfigureAwait(false); return(RestGuildTemplate.Create(client, model, withSnapshot)); } }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("Community", _community); properties.Add("Enquiry", _enquiry); }
public Error CreateDocumentPdf(Dictionary <string, string> headerProperties, List <Dictionary <string, string> > records, string templateFile, string outputFile, int maxItems = Int32.MaxValue) { var error = new Error(); try { MediaService.MediaService mediaService = new MediaService.MediaService(db); string tempFile = MediaService.MediaService.GetTempFile(".html"); // Perform the substitutions TemplateService.TemplateService ts = new TemplateService.TemplateService(); var templateProperties = new TemplateProperties { DocumentHeaderClass = "DocumentHeader", PageHeaderClass = "PageHeader", ItemClass = "ItemSection", PageFooterClass = "PageFooter", DocumentFooterClass = "DocumentFooter" }; error = ts.LoadTemplateFile(templateFile, templateProperties); if (!error.IsError) { // Insert the lines int maxItemsPerPage = 0, maxItemsBeforeFooter = ts.MaxItemsBeforeFooter, pageNo = 1, itemsOnPage = 0; headerProperties.AddProperty("PAGENO", pageNo); ts.AddContent(templateProperties.DocumentHeaderClass, headerProperties); ts.AddContent(templateProperties.PageHeaderClass, headerProperties); // Add items Dictionary <string, string> dict = new Dictionary <string, string>(); int itemCount = 1; foreach (var line in records) { maxItemsPerPage = (pageNo == 1 ? ts.MaxItemsOnFirstPage : ts.MaxItemsOnSecondPage); dict = line; if (itemsOnPage >= maxItemsPerPage) { headerProperties.AddProperty("PAGENO", pageNo); ts.AddContent(templateProperties.PageFooterClass, headerProperties); // Includes css page-break pageNo++; headerProperties.AddProperty("PAGENO", pageNo); ts.AddContent(templateProperties.PageHeaderClass, headerProperties); itemsOnPage = 0; } ts.AddContent(templateProperties.ItemClass, dict); itemsOnPage++; itemCount++; if (itemCount > maxItems) { break; } } // End of document if (itemsOnPage > maxItemsBeforeFooter) { // Not enough room left on page, so break ts.AddContent(templateProperties.PageFooterClass, headerProperties); // Includes css page-break pageNo++; headerProperties.AddProperty("PAGENO", pageNo); ts.AddContent(templateProperties.PageHeaderClass, headerProperties); itemsOnPage = 0; } headerProperties.AddProperty("PAGECOUNT", pageNo); ts.AddContent(templateProperties.DocumentFooterClass, headerProperties, dict); // Write the html file StreamWriter sw = new StreamWriter(tempFile); sw.Write(ts.Render(headerProperties)); sw.Close(); // Create a folder for it MediaService.MediaService.CreateDirectory(outputFile.FolderName()); // Convert it error = convertHtmlFileToPDF(tempFile, outputFile); MediaService.MediaService.DeleteFile(tempFile); if (error.IsError) { MediaService.MediaService.DeleteFile(outputFile); } } } catch (Exception e1) { error.SetError(e1); } return(error); }
protected override void AddProperties(TemplateProperties properties) { base.AddProperties(properties); properties.Add("Members", _views); }