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;
        }
Exemplo n.º 2
0
        /// <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);
            }
        }