public lm.Comol.Core.DomainModel.DocTemplateVers.Domain.DTO.ServiceExport.DTO_Template FillDataIntoTemplate(Int32 idCommunity, Int32 idUser, long idPath, long idSubActivity, String basePath, long idTemplate, long idVersion, String istanceName, ref CertificationError cError) { lm.Comol.Core.DomainModel.DocTemplateVers.Domain.DTO.ServiceExport.DTO_Template template = ServiceTemplates.TemplateGet(idTemplate, idVersion, basePath); if (template != null) { Person person = CurrentManager.GetPerson(idUser); liteCommunity community = CurrentManager.GetLiteCommunity(idCommunity); liteSubscriptionInfo subscription = CurrentManager.GetLiteSubscriptionInfo(idUser, idCommunity); String organization = ""; SubActivity subActivity = Service.GetSubActivity(idSubActivity); if (community != null) { organization = CurrentManager.GetOrganizationName(community.IdOrganization); } List <String> pHolders = TemplateEduPathPlaceHolders.PlaceHolders().Values.Select(v => v).ToList(); pHolders.AddRange(lm.Comol.Core.DomainModel.Helpers.TemplateCommonPlaceHolders.PlaceHolders().Values.Select(v => v).ToList()); if (template.Modules != null && template.Modules.Where(m => m.IdModule == Service.ServiceModuleID()).Any() && subActivity != null) { // DEVO RIEmPIRE I PLACE HOLDERS ! List <lm.Comol.Modules.EduPath.Domain.DTO.dtoSubActivityLink> links = Service.GetDtoSubactivityActiveLinks(idSubActivity); if (links == null || links.Count == 0) { template.Body.Text = TemplateEduPathPlaceHolders.Translate(template.Body.Text, AppContext, idPath, idUser, subActivity); } else { template.Body.Text = TemplateEduPathPlaceHolders.Translate(template.Body.Text, AppContext, idPath, idUser, subActivity, View.GetQuizInfos(links.Where(l => l.Visible).Select(l => l.IdObject).ToList())); } } Int32 idLanguage = (person == null) ? UserContext.Language.Id : person.LanguageID; template.Body.Text = lm.Comol.Core.DomainModel.Helpers.TemplateCommonPlaceHolders.Translate(template.Body.Text, person, community, (subscription == null) ? null : subscription.SubscribedOn, organization, CurrentManager.GetTranslatedRole(subscription.IdRole, idLanguage), CurrentManager.GetTranslatedProfileType((person == null) ? (int)UserTypeStandard.Guest : person.TypeID, idLanguage), istanceName); Int32 missingPlaceHolders = pHolders.Where(p => template.Body.Text.Contains(p)).Count(); cError = (missingPlaceHolders == 0) ? CertificationError.None : ((missingPlaceHolders == 1) ? CertificationError.EmptyTemplateItem: CertificationError.EmptyTemplateItems); } return(template); }
public lm.Comol.Core.DomainModel.DocTemplateVers.Domain.DTO.ServiceExport.DTO_Template FillDataIntoTemplate(long idSubActivity, String basePath, String istanceName, ref CertificationError cError) { return(FillDataIntoTemplate(View.IdCommunityContainer, View.ForUserId, View.IdPath, idSubActivity, basePath, View.IdTemplate, View.IdTemplateVersion, istanceName, ref cError)); }