Example #1
0
        //Case "PDF"
        public Boolean ExportPDF(Int64 TemplateId, Int64 VersionId, System.Web.HttpResponse webResponse, System.Web.HttpCookie cookie)
        {
            //CHECK PERMISSION!!!

            Helpers.HelperExportPDF _Helper = new Helpers.HelperExportPDF();

            Templ.Domain.DTO.ServiceExport.DTO_Template Template = ServiceGeneric.TemplateGet(TemplateId, VersionId, View.TemplateBaseUrl);

            if (Template == null)
            {
                return(false);
            }

            String clientFileName = Template.Name;

            if (VersionId > 0)
            {
                clientFileName += "v" + Template.Version.ToString();
            }

            if (Template.UseSkinHeaderFooter)
            {
                Template.Header = this.View.GetHeader;
                Template.Footer = this.View.GetFooter;
            }

            return(_Helper.ExportToPdf(Template, clientFileName, webResponse, cookie)); //, View.GetSysHeader(), View.GetSysFooter());
        }
Example #2
0
        public void InitView()
        {
            //String backurl = View.PreloadBackUrl;
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                //if (!String.IsNullOrEmpty(backurl))
                //    View.SetBackUrl(backurl);

                Int32 idUser = UserContext.CurrentUserID;
                //Int32 idCommunity = 0;
                //Int32 idModule = Service.ServiceModuleID();
                Int64 idTemplate = View.PreloadIdTemplate;
                Int64 idVersion  = View.PreloadIdVersion;

                //ModuleDocTemplate module = Service.GetServicePermission(idUser, idCommunity);

                //ModuleDocTemplate.ActionType action = ModuleDocTemplate.ActionType.GenericError;
                View.CurrentIdTemplate = idTemplate;
                View.CurrentIdVersion  = idVersion;

                //Template template = Service.GetDocTemplate(idTemplate);
                Templ.Domain.DTO.ServiceExport.DTO_Template template = Service.TemplateGet(idTemplate, idVersion, View.TemplateBaseUrl);

                if (template == null)
                {
                    View.DisplayUnknownTemplate();
                }
                else
                {
                    //action = ModuleDocTemplate.ActionType.Preview;
                    View.LoadTemplate(template);
                }

                //if (String.IsNullOrEmpty(backurl))
                //    backurl = (View.PreloadFromList) ? rootObject.List(idTemplate) : rootObject.EditTemplate(idTemplate);

                if (Module.ManageTemplates || Module.EditBuiltInTemplates || Module.EditTemplates || Module.AddTemplate)
                {
                    String toListUrl = lm.Comol.Core.DomainModel.DocTemplateVers.rootObject.List(idTemplate);
                    //if (!String.IsNullOrEmpty(toListUrl))
                    //    View.SetBackToListUrl(toListUrl);


                    String toEditUrl = lm.Comol.Core.DomainModel.DocTemplateVers.rootObject.EditTemplate(idTemplate);
                    //if (!String.IsNullOrEmpty(toEditUrl) && template.IsEditable)
                    // View.SetEditUrl(toEditUrl);
                    //else
                    //View.SetEditUrl("");

                    //View.SendUserAction(idCommunity, idModule, idTemplate, action);
                }
                //else
                //{
                //    View.DisplayNoPermission(idCommunity, Service.ServiceModuleID());
                //    View.SendUserAction(idCommunity, idModule, idTemplate, ModuleDocTemplate.ActionType.NoPermission);
                //}
            }
        }