private void LoadRevisions(ModuleRequestForMembership module, CallStandardAction action, int idCommunity, dtoRevisionFilters filters, int pageIndex, int pageSize) { liteCommunity community = CurrentManager.GetLiteCommunity(idCommunity); litePerson person = CurrentManager.GetLitePerson(UserContext.CurrentUserID); Boolean fromAllcommunities = false; PagerBase pager = new PagerBase(); pager.PageSize = pageSize; if (action == CallStandardAction.Manage) { pager.Count = (int)Service.RevisionCount(fromAllcommunities, (idCommunity == 0), community, person, CallForPaperType.RequestForMembership, filters, RevisionType.Manager) - 1; } else { fromAllcommunities = (idCommunity == 0); pager.Count = (int)Service.RevisionCount(fromAllcommunities, (idCommunity == 0), community, person, CallForPaperType.RequestForMembership, filters, RevisionType.UserRequired) - 1; } pager.PageIndex = pageIndex;// Me.View.CurrentPageIndex View.Pager = pager; if (pager.Count < 0) { View.LoadNoRevisionsFound(); } else { View.LoadRevisions(Service.GetRevisionList(module, action, fromAllcommunities, (idCommunity == 0), community, person, filters, pager.PageIndex, pageSize)); } View.SendUserAction(View.IdCallCommunity, ServiceRequest.ServiceModuleID(), ModuleRequestForMembership.ActionType.LoadRevisionsList); }
public void ExportToPdf( Boolean webOnlyRender, long idSubmission, long idRevision, String baseFilePath, String baseDocTemplateImagePath, String clientFileName, Dictionary <SubmissionTranslations, string> translations, System.Web.HttpResponse webResponse, System.Web.HttpCookie cookie, lm.Comol.Core.DomainModel.DocTemplateVers.Domain.DTO.ServiceExport.DTO_Template template) { Int64 IdCall = ServiceCall.CallIdGetFromSubmission(idSubmission); CallPrintSettings sets = new CallPrintSettings(); if (IdCall > 0) { sets = ServiceCall.PrintSettingsGetFromCall(IdCall); template = ServiceCall.DocTemplateUpdate(template, sets.TemplateId, sets.VersionId, baseDocTemplateImagePath); // baseFilePath); } int currentComId = UserContext.CurrentCommunityID; Subscription subs = CurrentManager.GetActiveSubscription(UserContext.CurrentUserID, currentComId); Person currentUser = CurrentManager.GetPerson(UserContext.CurrentUserID); string userType = ""; userType = CurrentManager.GetTranslatedProfileType(currentUser.TypeID, UserContext.Language.Id); CommonPlaceHolderData phData = new CommonPlaceHolderData { Person = currentUser, Community = CurrentManager.GetLiteCommunity(currentComId), InstanceName = "", OrganizationName = CurrentManager.GetOrganizationName(UserContext.CurrentCommunityOrganizationID), Subscription = subs, UserType = userType } ; dtoRevision revision = ServiceCall.GetRevision(idSubmission, idRevision, false); if (revision == null) { View.DisplayNone(); } else { LoadFiles(revision, idSubmission, View.AvailableTypes); } //return exportFile; }
public lm.Comol.Core.DomainModel.DocTemplateVers.Domain.DTO.ServiceExport.DTO_Template FillDataIntoTemplate(Int32 idCommunity, Int32 idUser, long idPath, long idSubActivity, String basePath, String istanceName, ref CertificationError cError) { lm.Comol.Core.DomainModel.DocTemplateVers.Domain.DTO.ServiceExport.DTO_Template template = null; SubActivity subActivity = Service.GetSubActivity(idSubActivity); if (subActivity != null) { template = ServiceTemplates.TemplateGet(subActivity.IdCertificate, subActivity.IdCertificateVersion, basePath); if (template != null) { //litePerson person = CurrentManager.GetLitePerson(idUser); Person person = CurrentManager.GetPerson(idUser); liteCommunity community = CurrentManager.GetLiteCommunity(idCommunity); liteSubscriptionInfo subscription = CurrentManager.GetLiteSubscriptionInfo(idUser, idCommunity); String organization = ""; 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(), idUser, IsEvaluablePath(idPath))); } } 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); } } else { cError = CertificationError.ExternalItemUnknown; } return(template); }
public void InitView(String unknownUser) { Int32 idModule = Service.ServiceModuleID(); int idCommunity = View.PreloadIdCommunity; if (idCommunity == 0 && UserContext.CurrentCommunityID > 0) { idCommunity = UserContext.CurrentCommunityID; } View.IdModuleCommunityDiary = idModule; View.IdModuleRepository = CurrentManager.GetModuleID(lm.Comol.Core.FileRepository.Domain.ModuleRepository.UniqueCode); View.IdCommunityDiary = idCommunity; if (UserContext.isAnonymous) { View.DisplaySessionTimeout(idCommunity); } else { liteCommunity community = CurrentManager.GetLiteCommunity(idCommunity); if (community == null && idCommunity > 0) { View.IdCommunityDiary = -View.PreloadIdCommunity; View.ShowUnkownCommunityDiary(idCommunity, idModule); } else { ModuleCommunityDiary module = Service.GetPermissions(UserContext.CurrentUserID, idCommunity); if (module == null) { module = new ModuleCommunityDiary(); } if (module.Administration || module.DeleteItem || module.Edit || module.ViewDiaryItems) { View.DisplayOrderAscending = View.PreloadAscending; InternalLoadDiaryItems(module, idCommunity, idModule, unknownUser); } else { View.HideItemsForNoPermission(idCommunity, idModule); } } if (community == null && idCommunity == 0) { View.SetTitleName(View.GetPortalNameTranslation()); } else if (community != null && community.Id != UserContext.CurrentCommunityID) { View.SetTitleName(community.Name); } } }
private List <RevisionStatus> LoadAvailableStatus(CallStandardAction action, int idCommunity, CallForPaperType type) { liteCommunity community = CurrentManager.GetLiteCommunity(idCommunity); litePerson person = CurrentManager.GetLitePerson(UserContext.CurrentUserID); Boolean fromAllcommunities = false; dtoRevisionFilters filters = new dtoRevisionFilters() { OrderBy = RevisionOrder.None, Status = RevisionStatus.None, CallType = type }; if (action == CallStandardAction.Manage) { return(Service.GetAvailableRevisionStatus(fromAllcommunities, (idCommunity == 0), community, person, type, filters, RevisionType.Manager)); } else { fromAllcommunities = (idCommunity == 0); return(Service.GetAvailableRevisionStatus(fromAllcommunities, (idCommunity == 0), community, person, type, filters, RevisionType.UserRequired)); } }
//public void SelectCommunityToAdd() //{ // long idVersion = View.IdVersion; // if (UserContext.isAnonymous) // Logout(View.CurrentType, View.IdTemplate, idVersion); // else // { // TemplateDefinitionVersion version = Service.GetVersion(idVersion); // Dictionary<Int32, long> rPermissions = new Dictionary<Int32, long>(); // Boolean forAdmin = (UserContext.UserTypeID == (Int32)UserTypeStandard.SysAdmin) || (UserContext.UserTypeID == (Int32)UserTypeStandard.Administrator) || (UserContext.UserTypeID == (Int32)UserTypeStandard.Administrative); // Core.BaseModules.CommunityManagement.CommunityAvailability availability = (forAdmin) ? Core.BaseModules.CommunityManagement.CommunityAvailability.All : Core.BaseModules.CommunityManagement.CommunityAvailability.Subscribed; // /*if (version!=null && version.Template!= null && version.Template.OwnerInfo.Type== OwnerType.Module) // rPermissions.Add(version.Template.OwnerInfo.IdModule, version.Template.OwnerInfo.); // else*/ // rPermissions.Add(Service.ServiceModuleID(), (long)ModuleTemplateMessages.Base2Permission.Administration | (long)ModuleTemplateMessages.Base2Permission.ManageTemplates); // rPermissions.Add(CommunityService.ServiceModuleID(), (long)lm.Comol.Core.DomainModel.Domain.ModuleCommunityManagement.Base2Permission.Manage | (long)lm.Comol.Core.DomainModel.Domain.ModuleCommunityManagement.Base2Permission.AdminService); // List<Int32> idCommunities = Service.GetIdCommunityAssignments(idVersion); // View.InitializeCommunityToAdd(UserContext.CurrentUserID, forAdmin, rPermissions, idCommunities, availability); // } //} public void AddCommunity(List <Int32> idCommunites) { long idVersion = View.IdVersion; if (UserContext.isAnonymous) { Logout(View.CurrentType, View.IdTemplate, idVersion); } else if (idCommunites.Any()) { Boolean saved = Service.AddCommunityAssignment(idVersion, idCommunites); if (saved) { if (idCommunites.Count > 1) { View.DisplayCommunityAssignmentsAdded(); } else { liteCommunity c = CurrentManager.GetLiteCommunity(idCommunites.First()); if (c != null) { View.DisplayCommunityAssignmentAdded(c.Name); } else { View.DisplayCommunityAssignmentsAdded(); } } LoadAssignments(idVersion, View.GetPermissions(), PermissionType.Base); InitializeCommunitySelector(); } else { View.DisplayCommunityAddingError(); } } }
private dtoProject InitializeContext(long idProject, ref dtoProjectContext cContex) { dtoProject project = Service.GetdtoProject(idProject); View.IdProject = idProject; if (project == null) { Int32 idCommunity = (!cContex.isForPortal && cContex.IdCommunity < 1) ? UserContext.CurrentCommunityID : cContex.IdCommunity; liteCommunity community = (idCommunity > 0) ? CurrentManager.GetLiteCommunity(idCommunity) : null; cContex.IdCommunity = (community != null) ? community.Id : 0; } else { cContex.IdCommunity = project.IdCommunity; View.forPortal = project.isPortal; View.isPersonal = project.isPersonal; } View.ProjectIdCommunity = cContex.IdCommunity; View.forPortal = cContex.isForPortal; View.isPersonal = cContex.isPersonal; return(project); }
/// <summary> /// Esporta una sottomissione FITTIZIA/VUOTA! come bozza /// Al momento NON E' Prevista la stampa di una sottomissione/revisione in bozza!!! /// </summary> /// <param name="idCall">ID call</param> /// <param name="baseDocTemplateImagePath">Path immagini doctemplate (da configurazione)</param> /// <param name="clientFileName">Nome file esportato</param> /// <param name="translations">Translation: dictionary per la traduzione di termini</param> /// <param name="webResponse">Web response</param> /// <param name="cookie">Cookie</param> /// <param name="template">Template default (fake)</param> /// <param name="idSubmitterType">Id submitter Type: dipende dal bando. SE = 0, il primo disponibile. Per sviluppi futuri, al momento lasciato il primo che trova...</param> public void ExportDraftToPdf( String baseDocTemplateImagePath, String clientFileName, Dictionary <SubmissionTranslations, string> translations, System.Web.HttpResponse webResponse, System.Web.HttpCookie cookie, lm.Comol.Core.DomainModel.DocTemplateVers.Domain.DTO.ServiceExport.DTO_Template template) { long idCall = View.IdCall; long idSubmitterType = (View.SubmissionType != null) ? View.SubmissionType.Id : 0; //Pagine "normali" CallPrintSettings sets = new CallPrintSettings(); if (idCall > 0) { sets = CallService.PrintSettingsGetFromCall(idCall); //Solo pagina di EDIT! View.UpdateSettings(ref sets); template = CallService.DocTemplateUpdate( template, sets.TemplateId, sets.VersionId, baseDocTemplateImagePath); // baseFilePath); } int currentComId = UserContext.CurrentCommunityID; Subscription subs = CurrentManager.GetActiveSubscription(UserContext.CurrentUserID, currentComId); Person currentUser = CurrentManager.GetPerson(UserContext.CurrentUserID); string userType = ""; if (currentUser == null) { currentUser = CurrentManager.GetUnknownUser(); } userType = CurrentManager.GetTranslatedProfileType(currentUser.TypeID, UserContext.Language.Id); CommonPlaceHolderData phData = new CommonPlaceHolderData { Person = currentUser, Community = CurrentManager.GetLiteCommunity(currentComId), InstanceName = "", OrganizationName = CurrentManager.GetOrganizationName(UserContext.CurrentCommunityOrganizationID), Subscription = subs ?? new Subscription(), UserType = userType }; long revisionId = View.IdRevision; if (revisionId <= 0) { iTextSharp5.text.Document exportFile = CallService.ExportCallDraftToPDF( idCall, clientFileName, translations, webResponse, cookie, template, sets, phData, idSubmitterType); } else { iTextSharp5.text.Document exportFile = CallService.ExportSubmissionDraftToPDF( true, View.IdSubmission, View.IdRevision, baseDocTemplateImagePath, clientFileName, translations, webResponse, cookie, template, sets, phData); } }
public void InitView(Int32 idCommunity, long idItem, String unknownUser, Boolean isForAdd = false) { idCommunity = (idCommunity == 0 ? UserContext.CurrentCommunityID : idCommunity); if (!UserContext.isAnonymous) { litePerson person = CurrentManager.GetLitePerson(UserContext.CurrentUserID); CommunityEventItem item = (idItem > 0 ? Service.EventItemGet(idItem) :null); if (item != null && idCommunity != item.IdCommunityOwner) { idCommunity = item.IdCommunityOwner; } View.IdCommunityDiary = idCommunity; View.IdModuleCommunityDiary = GetIdModule(); View.IdModuleRepository = ServiceRepository.GetIdModule(); liteCommunity community = CurrentManager.GetLiteCommunity(idCommunity); if ((community == null && idCommunity > 0) || (!isForAdd && idItem == 0)) { View.NoPermission(idCommunity, GetIdModule()); } else { if (item == null && !isForAdd) { View.ShowNoItemWithThisID(idCommunity, GetIdModule(), idItem); } else { long idEvent = ((item != null && item.EventOwner != null)? item.EventOwner.Id : 0); View.CurrentIdItem = idItem; View.CurrentIdEvent = idEvent; ModuleCommunityDiary module = Service.GetPermissions(UserContext.CurrentUserID, idCommunity); if ((module.AddItem && isForAdd) || (module.Administration || module.Edit)) { String description = ""; if (idItem == 0) { item = new CommunityEventItem(); item.Title = ""; item.Note = ""; item.Owner = CurrentManager.GetLitePerson(UserContext.CurrentUserID); item.ModifiedOn = DateTime.Now; item.StartDate = new DateTime(item.ModifiedOn.Year, item.ModifiedOn.Month, item.ModifiedOn.Day, 8, 0, 0); item.EndDate = new DateTime(item.ModifiedOn.Year, item.ModifiedOn.Month, item.ModifiedOn.Day, 11, 0, 0); item.IsVisible = true; item.Link = ""; item.Place = ""; item.Title = ""; item.IdCommunityOwner = idCommunity; item.ShowDateInfo = true; } else { description = Service.EventItemGetDescription(item); } lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier identifier = lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier.Create((idCommunity > 0 ? lm.Comol.Core.FileRepository.Domain.RepositoryType.Community : lm.Comol.Core.FileRepository.Domain.RepositoryType.Portal), idCommunity); View.RepositoryIdentifier = identifier; String communityName = (community != null ? community.Name : View.GetPortalNameTranslation()); List <dtoAttachmentItem> attachments = null; if (idItem > 0) { lm.Comol.Core.FileRepository.Domain.ModuleRepository moduleRepository = ServiceRepository.GetPermissions(identifier, UserContext.CurrentUserID); List <lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions> availableActions = Service.GetAvailableUploadActions(module, moduleRepository); lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions dAction = (availableActions == null || !availableActions.Any()) ? lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions.none : availableActions.FirstOrDefault(); View.InitializeAttachmentsControl(idEvent, idItem, availableActions, dAction); attachments = Service.AttachmentsGet(person, item, true, Service.GetItemPermission(person, item, module, moduleRepository), moduleRepository, unknownUser); View.AllowEdit = true; View.AllowFileManagement = availableActions.Any(); } else { View.AllowEdit = module.Administration || module.AddItem; View.AllowFileManagement = false; } View.LoadItem(item, description, communityName, attachments); } else { View.NoPermission(idCommunity, GetIdModule()); } } View.SetBackToDiary(idCommunity, idItem); } } else { View.DisplaySessionTimeout(idCommunity, idItem); } }