protected void RegistersBtnPrint_Click(object sender, EventArgs e) { DocsPaWR.InfoUtente infoUser = UserManager.GetInfoUser(); DocsPaWR.InfoDocumento infoDoc = new InfoDocumento(); DocsPaWR.Ruolo role = RoleManager.GetRoleInSession(); try { DocsPaWR.StampaRegistroResult StpRegRS = GestManager.StampaRegistro(this, infoUser, role, SelectedRegister); if (StpRegRS != null && StpRegRS.errore != null && StpRegRS.errore != "") { string error = StpRegRS.errore; error = error.Replace("'", "\\'"); ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('WarningRegisterPrint', 'warning', '','" + error + "');} else {parent.ajaxDialogModa('ErrorRegisterPrint', 'error', '','" + error + "');}", true); return; } else { infoDoc.docNumber = StpRegRS.docNumber; DocsPaWR.SchedaDocumento schedaDoc = new SchedaDocumento(); schedaDoc = DocumentManager.getDocumentDetails(this, infoDoc.idProfile, infoDoc.docNumber); FileDocPrintRegister = FileManager.getInstance(schedaDoc.systemId).GetFile(this.Page, schedaDoc.documenti[0], false); ScriptManager.RegisterStartupScript(this, this.GetType(), "viewPrintRegister", "ajaxModalPopupViewPrintRegister();", true); return; } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('ErrorRegisterPrint', 'error', '');} else {parent.ajaxDialogModa('ErrorRegisterPrint', 'error', '');}", true); } }
/// <summary> /// Imposta la sessione dell'export /// </summary> public void SetSessionExportFile(FileDocumento file) { if (System.Web.HttpContext.Current.Session[EXPORT_FILE_SESSION] == null) { System.Web.HttpContext.Current.Session.Add(EXPORT_FILE_SESSION, file); } }
private static void addDocsInZip(List <ImportResult> results, ZipBuilder builder, string folder, InfoUtente infoUtente) { foreach (ImportResult temp in results) { try { List <BaseInfoDoc> infos = DocManager.GetBaseInfoForDocument(temp.DocNumber, null, null); BaseInfoDoc doc = infos[0]; FileRequest req = new FileRequest(); if (doc != null && !string.IsNullOrEmpty(doc.VersionLabel)) { logger.Debug("addDocsInZip GetBaseInfoForDocument VersionId " + doc.VersionLabel); } req.versionId = doc.VersionId; req.docNumber = doc.IdProfile; req.versionLabel = doc.VersionLabel; req.path = doc.Path; req.version = doc.VersionLabel; req.fileName = doc.FileName; FileDocumento fileDocumento = BusinessLogic.Documenti.FileManager.getFile(req, infoUtente); string extension = fileDocumento.fullName.Substring(fileDocumento.fullName.LastIndexOf(".") + 1); builder.AddEntry(temp.DocNumber + "." + extension, new string[] { folder }, fileDocumento.content); } catch (Exception e) { } } }
private bool CheckIsPresentCadesAndPades() { bool result = false; FileDocumento signedDocument = this.GetSignedDocument(); bool cades = false; bool pades = false; if (signedDocument != null && signedDocument.signatureResult != null) { VerifySignatureResult signatureResult = signedDocument.signatureResult; foreach (PKCS7Document document in signatureResult.PKCS7Documents) { if (document.SignatureType == SignType.PADES) { pades = true; } if (document.SignatureType == SignType.CADES) { cades = true; } if (cades && pades) { break; } } } result = cades && pades; return(result); }
//meccanismo di caching per evitare di fare la getFile tutte le volte, con conseguente controllo del certificato private FileDocumento DocumentoGetFileCached(DocsPaWR.FileRequest fileRequest) { FileDocumento retval = null; if (HttpContext.Current.Session["FileRequest_Cached"] == null) { HttpContext.Current.Session["FileDocumento_Cached"] = null; } if (HttpContext.Current.Session["FileDocumento_Cached"] == null) { retval = DocumentManager.DocumentoGetFile(fileRequest); HttpContext.Current.Session["FileRequest_Cached"] = fileRequest; HttpContext.Current.Session["FileDocumento_Cached"] = retval; } else { if (HttpContext.Current.Session["FileRequest_Cached"] != fileRequest) { //filerequest è cambiato retval = DocumentManager.DocumentoGetFile(fileRequest); HttpContext.Current.Session["FileRequest_Cached"] = fileRequest; HttpContext.Current.Session["FileDocumento_Cached"] = retval; } else { retval = (FileDocumento)HttpContext.Current.Session["FileDocumento_Cached"]; } } return(retval); }
private static void AcquireFileAndAllegato(AttestatoVO att, SchedaDocumento sd, InfoUtente userInfo) { Templates temp = ProfilazioneDocumenti.getTemplateById(att.IdTemplate); string path = temp.PATH_MODELLO_1; byte[] content = GetFileContent(path); // Creazione dell'oggetto fileDocumento FileDocumento fileDocumento = new FileDocumento(); fileDocumento.name = Path.GetFileName(sd.systemId + ".rtf"); fileDocumento.fullName = sd.systemId + ".rtf"; fileDocumento.estensioneFile = "rtf"; fileDocumento.length = content.Length; fileDocumento.content = content; FileRequest fileRequest = (FileRequest)sd.documenti[0]; try { FileManager.putFile(fileRequest, fileDocumento, userInfo); } catch (Exception e) { throw new Exception("Errore durante l'upload del file."); } FileDocumento fileAll = new FileDocumento(); fileAll.name = Path.GetFileName(att.FileName); fileAll.fullName = att.FileName; fileAll.estensioneFile = att.FileName.Substring(att.FileName.LastIndexOf(".") + 1); fileAll.length = content.Length; fileAll.content = att.Content; FileRequest allRequest = (FileRequest)sd.allegati[0]; FileManager.putFile(allRequest, fileAll, userInfo); }
private static void AcquireFileFromModel(DocumentRowData rowData, InfoUtente userInfo, Ruolo role, bool isSmistamentoEnabled, SchedaDocumento schedaDocumento, string ftpAddress, String ftpUsername, String ftpPassword) { // L'oggetto fileRequest FileRequest fileRequest; // L'oggetto fileDocumento FileDocumento fileDocumento; string tipologia = rowData.DocumentTipology; TemplateManager tempManager = new TemplateManager(userInfo, role, isSmistamentoEnabled, tipologia, TemplateType.RTF); byte[] content = tempManager.BuildDocumentFromTemplate(rowData, schedaDocumento); // Creazione dell'oggetto fileDocumento fileDocumento = new FileDocumento(); // Impostazione del nome del file fileDocumento.name = Path.GetFileName(schedaDocumento.systemId + ".rtf"); // Impostazione del full name fileDocumento.fullName = schedaDocumento.systemId + ".rtf"; fileDocumento.estensioneFile = "rtf"; // Impostazione del path //fileDocumento.path = Path.GetPathRoot(rowData.Pathname); // Impostazione della grandezza del file fileDocumento.length = content.Length; // Impostazione del content del documento fileDocumento.content = content; fileRequest = (FileRequest)schedaDocumento.documenti[0]; try { FileManager.putFile(fileRequest, fileDocumento, userInfo); } catch (Exception e) { // Aggiunta del problema alla lista dei problemi throw new Exception("Errore durante l'upload del file."); } }
public static FileDocumento GetReportRegistroWithFilters( Page page, DocsPaWR.InfoUtente infoUt, Ruolo ruolo, Registro registro, FiltroRicerca[][] filters) { FileDocumento retValue = null; try { // Chiamata Web Service DocsPaWR.StampaRegistroResult result = docsPaWS.RegistriStampaWithFilters(infoUt, ruolo, registro, filters, out retValue); if (result == null) { throw new Exception(); } } catch (Exception es) { ErrorManager.redirect(page, es); } return(retValue); }
/// <summary> /// Esportazione del report /// </summary> protected void btnExport_Click(object sender, EventArgs e) { // Impostazione delle proprietà del report da produrre ReportingUtils.PrintRequest.ReportKey = this.ddlReport.SelectedValue; ReportingUtils.PrintRequest.ReportType = (ReportTypeEnum)Enum.Parse(typeof(ReportTypeEnum), this.ddlExportFormat.SelectedValue, true); ReportingUtils.PrintRequest.SubTitle = String.IsNullOrEmpty(this.txtReportSubtitle.Text) ? this.tbwSubtitle.WatermarkText : this.txtReportSubtitle.Text; ReportingUtils.PrintRequest.Title = this.txtReportTitle.Text; ReportingUtils.PrintRequest.ColumnsToExport = this.ReportRegistry.Where(r => r.ReportKey == this.ddlReport.SelectedValue).First().ExportableFields; FileDocumento temp = null; try { temp = ReportingUtils.GenerateReport(ReportingUtils.PrintRequest); } catch { this.messageBox.ShowMessage("Errore durante la generazione del report richiesto."); } if (temp != null) { CallContextStack.CurrentContext.ContextState["documentFile"] = temp; this.reportContent.Attributes["src"] = "ReportContent.aspx"; } }
public static FileDocumento GetReportRegistroWithFilters( Page page, DocsPaWR.InfoUtente infoUt, Ruolo ruolo, Registro registro, FiltroRicerca[][] filters) { FileDocumento retValue = null; try { // Chiamata Web Service DocsPaWR.StampaRegistroResult result = docsPaWS.RegistriStampaWithFilters(infoUt, ruolo, registro, filters, out retValue); if (result == null) { throw new Exception(); } } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return(null); } return(retValue); }
private void exportGridToExcel(DataSet ds) { if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { FileDocumento fd = DocumentManager.createReport(null, ds, "Excel", "Report sulla verifica dei formati di un'istanza di conservazione", string.Format("Istanza di conservazione = {0}", this.InstanceConservation.SystemID), "VerificaFormatiConservazione", "VerificaFormatiConservazione", UserManager.GetInfoUser()); fd.contentType = "application/vnd.ms-excel"; //fd.name = string.Format("Export_Verifica_{0}.xls", DateTime.Now.ToString("dd-MM-yyyy")); Response.ContentType = fd.contentType; Response.AddHeader("content-disposition", "inline;filename=" + fd.name); Response.AddHeader("content-length", fd.content.Length.ToString()); Response.BinaryWrite(fd.content); Response.Flush(); Response.End(); } else { string msgErrorExportExcel = "msgErrorExportExcel"; ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "ajaxDialogModal('" + msgErrorExportExcel.Replace("'", @"\'") + "', 'warning', '');", true); return; } }
protected void BtnExport_Click(object sender, EventArgs e) { // formato report string formato = this.ddl_format.SelectedValue; string tipoReport = Request.QueryString["tipo"].ToString(); string[] listaID = (string[])this.itemsToExport.ToArray(typeof(string)); AmmUtils.WebServiceLink ws = new AmmUtils.WebServiceLink(); DocsPAWA.DocsPaWR.FileDocumento doc = new FileDocumento(); doc = ws.ExportPolicyPARER(listaID, formato, tipoReport); if (doc != null) { Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "attachment; filename=" + doc.name); Response.BinaryWrite(doc.content); Response.Flush(); Response.End(); } else { } }
//END NEW /// <summary> /// Reperimento dell'estensione completa del file nel caso in cui sia P7M /// </summary> /// <returns></returns> protected string GetP7mFileExtensions() { string extensions = string.Empty; NttDataWA.DocsPaWR.SchedaDocumento schedaDocumento = UIManager.DocumentManager.getSelectedRecord(); /* * DocsPaWR.FileRequest fileInfo =(UIManager.DocumentManager.getSelectedAttachId() != null) ? * UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) : * UIManager.FileManager.GetFileRequest(); */ String selectedVersionId = null; if (DocumentManager.getSelectedNumberVersion() != null && DocumentManager.ListDocVersions != null) { selectedVersionId = (from v in DocumentManager.ListDocVersions where v.version.Equals(DocumentManager.getSelectedNumberVersion()) select v.versionId).FirstOrDefault(); } DocsPaWR.FileRequest fileInfo = (UIManager.DocumentManager.getSelectedAttachId() != null) ? UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) : UIManager.FileManager.GetFileRequest(selectedVersionId); //DocsPaWR.FileDocumento fileInfo = SaveFileServices.GetFileInfo(); FileDocumento doc = FileManager.getInstance(schedaDocumento.systemId).getInfoFile(this.Page, fileInfo); //string fileName = fileInfo.fileName; //string fileName = doc.nomeOriginale != null ? doc.nomeOriginale : string.Empty; //INC000001126833 APSS: problema con riproponi su documenti tipizzati con modelli string fileName = string.Empty; if (doc != null) { fileName = doc.nomeOriginale; if (string.IsNullOrEmpty(fileName)) { fileName = doc.name; } } if (Path.GetExtension(fileName).ToUpperInvariant() == ".P7M") { while (!string.IsNullOrEmpty(Path.GetExtension(fileName))) { string ext = Path.GetExtension(fileName); if (!string.IsNullOrEmpty(ext)) { extensions = ext + extensions; } fileName = Path.GetFileNameWithoutExtension(fileName); } } return(extensions); }
private void initForm() { string confirmScript = "if (confirmAction()) parent.closeAjaxModal('CheckOutDocument','up');"; string setTempFolderScript = "setTempFolder();"; string selectFolderScript = "SelectFolder();"; this.language = NttDataWA.UIManager.UserManager.GetUserLanguage(); this.lblFolderPath.Text = Languages.GetLabelFromCode("CheckInOutSaveLocalFolderPath", language); this.lblFileName.Text = Languages.GetLabelFromCode("CheckInOutSaveLocalFileName", language); this.CheckInOutConfirmButton.Text = Languages.GetLabelFromCode("CheckInOutSaveLocalConfirmButton", language); this.CheckInOutCloseButton.Text = Languages.GetLabelFromCode("CheckInOutSaveLocalCloseButton", language); NttDataWA.DocsPaWR.SchedaDocumento schedaDocumento = UIManager.DocumentManager.getSelectedRecord(); string nomeOriginale = null; if (schedaDocumento != null) { FileRequest fileReq = null; if (FileManager.GetSelectedAttachment() == null) { fileReq = UIManager.FileManager.getSelectedFile(); } else { fileReq = FileManager.GetSelectedAttachment(); } FileDocumento doc = FileManager.getInstance(schedaDocumento.systemId).getInfoFile(this.Page, fileReq); if (doc != null && !string.IsNullOrEmpty(doc.nomeOriginale)) { nomeOriginale = doc.nomeOriginale; } } if (!string.IsNullOrEmpty(nomeOriginale)) { this.txtFileName.Text = cleanFileName(nomeOriginale); } else { this.txtFileName.Text = file_name; } if (this.componentType.Equals(Constans.TYPE_SOCKET)) { confirmScript = "disallowOp('Content1'); confirmActionSocket(function(close){ reallowOp(); if(close)parent.closeAjaxModal('CheckOutDocument','up');})"; setTempFolderScript = "setTempFolderSocket();"; selectFolderScript = "SelectFolderSocket()"; this.pnlAppletTag.Visible = false; } this.CheckInOutConfirmButton.OnClientClick = confirmScript; this.btnBrowseForFolder.OnClientClick = selectFolderScript; ScriptManager.RegisterStartupScript(this, this.GetType(), "InitializeCtrlScript", setTempFolderScript, true); //file_name; }
private DocsPaVO.InstanceAccess.Metadata.Allegato[] getAllegati(DocsPaVO.documento.SchedaDocumento schDoc, InstanceAccessDocument doc, DocsPaVO.utente.InfoUtente infoUtente) { if (schDoc.allegati == null) { return(null); } if (schDoc.allegati.Count == 0) { return(null); } List <DocsPaVO.InstanceAccess.Metadata.Allegato> lstAll = new List <DocsPaVO.InstanceAccess.Metadata.Allegato>(); foreach (object a in schDoc.allegati) { DocsPaVO.InstanceAccess.Metadata.Allegato allegato = new DocsPaVO.InstanceAccess.Metadata.Allegato(); DocsPaVO.documento.Allegato all = a as DocsPaVO.documento.Allegato; if (all != null && (from att in doc.ATTACHMENTS where att.ID_ATTACH.Equals(all.docNumber) select att.ENABLE).FirstOrDefault()) { allegato.Descrizione = all.descrizione; allegato.ID = all.docNumber; //allegato.Tipo = "manuale"; //Cablato , per ora.. poi si vedrà string tipoAllegato = ""; switch (all.TypeAttachment) { case 1: tipoAllegato = "Allegato Utente"; break; case 2: tipoAllegato = "Allegato PEC"; break; case 3: tipoAllegato = "Allegato IS"; break; case 4: tipoAllegato = "Allegato Esterno"; break; default: tipoAllegato = "Non specificato"; break; } allegato.Tipo = tipoAllegato; if (!string.IsNullOrEmpty(all.fileSize) && Convert.ToInt32(all.fileSize) > 0) { FileDocumento fd = BusinessLogic.Documenti.FileManager.getFile(all, infoUtente); allegato.File = getFileDetail(fd, all, infoUtente); } lstAll.Add(allegato); } } return(lstAll.ToArray()); }
private void loadCheckOutData() { string strNomeFile = string.Empty; string strOggetto = string.Empty; CheckInOutApplet.CheckInOutServices.InitializeContext(); NttDataWA.DocsPaWR.SchedaDocumento schedaDoc = CheckInOutApplet.CheckInOutServices.CurrentSchedaDocumento; //FileRequest fileReq = null; fileReq = null; if (UIManager.DocumentManager.getSelectedAttachId() == null) { if (schedaDoc != null) { fileReq = schedaDoc.documenti[0]; //strOggetto = schedaDoc.oggetto.descrizione; //strNomeFile = schedaDoc.documenti[0].path; } } else { if (UIManager.DocumentManager.GetSelectedAttachment() != null) { fileReq = UIManager.DocumentManager.GetSelectedAttachment(); //Allegato allegato = UIManager.DocumentManager.GetSelectedAttachment(); //strOggetto = allegato.descrizione; //strNomeFile = allegato.fileName; } } string details = Utils.Languages.GetMessageFromCode("DigitalVisurelblMessageDetails", language); details = details.Replace("@@", fileReq.version); if (fileReq.GetType().Equals(typeof(DocsPaWR.Documento))) { details = details.Replace("##", Utils.Languages.GetLabelFromCode("DigitalVisureLblMainDocument", UserManager.GetUserLanguage())); } else { details = details.Replace("##", Utils.Languages.GetLabelFromCode("DigitalVisureLblAttachment", UserManager.GetUserLanguage())).Replace("@@", fileReq.versionLabel); } string extensionFile = (fileReq.fileName.Split('.').Length > 1) ? (fileReq.fileName.Split('.'))[fileReq.fileName.Split('.').Length - 1] : string.Empty; details = details.Replace("@#", extensionFile); FileDocumento doc = FileManager.getInstance(schedaDoc.systemId).getInfoFile(this.Page, fileReq); if (doc != null && !string.IsNullOrEmpty(doc.nomeOriginale)) { details = details.Replace("#@", doc.nomeOriginale); } this.lblMessageDetails.Text = details; //this.lblOggetto.Text = strOggetto; //this.lblNomeFile.Text = strNomeFile; }
protected void UploadBtnUploadFile_Click(object sender, EventArgs e) { try { bool conversionePdfServer = this.fileOptions.Items[0].Selected; bool cartaceo = false; // this.fileOptions.Items[1].Selected; //if (this.optUpload.Checked) //{ FileDocumento fileDoc = Session["fileDoc"] as FileDocumento; if (fileDoc != null && fileDoc.content != null) { fileDoc.cartaceo = cartaceo; try { string msgError = FileManager.uploadFile(this, fileDoc, cartaceo, conversionePdfServer, this.PdfConversionSynchronousLC); if (string.IsNullOrEmpty(msgError)) { ScriptManager.RegisterClientScriptBlock(this.upPnlGeneral, this.upPnlGeneral.GetType(), "closeAJM", "parent.closeAjaxModal('UplodadFile','up');", true); } else { if (msgError.Equals("ErrorConversionePdf")) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "parent.ajaxDialogModal('" + msgError.Replace("'", @"\'") + "', 'warning', '');", true); ScriptManager.RegisterClientScriptBlock(this.UpUpdateButtons, this.UpUpdateButtons.GetType(), "closeAJM", "parent.closeAjaxModal('UplodadFile','up');", true); } else { string msg = "ErrorFileUpload_custom"; msgError = msgError.Equals(ERROR_ACQUIRED_DOCUMENT) ? Utils.Languages.GetMessageFromCode(msgError, UserManager.GetUserLanguage()) : msgError; ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('" + utils.FormatJs(msg) + "', 'error', '', '" + utils.FormatJs(msgError) + "');} else {parent.ajaxDialogModal('" + utils.FormatJs(msg) + "', 'error', '', '" + utils.FormatJs(msgError) + "');}; reallowOp();", true); } } } catch (Exception exc) { string msg = "ErrorFileUpload"; ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('" + utils.FormatJs(msg) + "', 'error', '');} else {parent.ajaxDialogModal('" + utils.FormatJs(msg) + "', 'error', '');}; reallowOp();", true); } finally { Session["fileDoc"] = null; Session["UploadDetail"] = null; } } // } } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return; } }
/// <summary> /// Recupera l'export in sessione /// </summary> /// <returns></returns> public FileDocumento GetSessionExportFile() { FileDocumento filePdf = new FileDocumento(); if (System.Web.HttpContext.Current.Session[EXPORT_FILE_SESSION] != null) { filePdf = (FileDocumento)System.Web.HttpContext.Current.Session[EXPORT_FILE_SESSION]; } return(filePdf); }
private Metadata.Documento.Allegato[] getAllegati(DocsPaVO.documento.SchedaDocumento schDoc, DocsPaVO.utente.InfoUtente infoUtente) { if (schDoc.allegati == null) { return(null); } if (schDoc.allegati.Count == 0) { return(null); } List <Metadata.Documento.Allegato> lstAll = new List <Documento.Allegato>(); foreach (object a in schDoc.allegati) { DocsPaConservazione.Metadata.Documento.Allegato allegato = new Metadata.Documento.Allegato(); DocsPaVO.documento.Allegato all = a as DocsPaVO.documento.Allegato; if (all != null) { allegato.Descrizione = all.descrizione; allegato.ID = all.docNumber; //allegato.Tipo = "manuale"; //Cablato , per ora.. poi si vedrà string tipoAllegato = ""; switch (all.TypeAttachment) { case 1: tipoAllegato = "Allegato Utente"; break; case 2: tipoAllegato = "Allegato PEC"; break; case 3: tipoAllegato = "Allegato IS"; break; case 4: tipoAllegato = "Allegato Esterno"; break; default: tipoAllegato = "Non specificato"; break; } allegato.Tipo = tipoAllegato; FileDocumento fd = BusinessLogic.Documenti.FileManager.getFile(all, infoUtente); allegato.File = getFileDetail(fd, all, infoUtente); lstAll.Add(allegato); } } return(lstAll.ToArray()); }
public static FileRequest DocumentoPutFile(FileRequest fileRequest, FileDocumento fileDocument, InfoUtente infoUtente) { try { return(docsPaWS.DocumentoPutFile(fileRequest, fileDocument, infoUtente)); } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return(null); } }
protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; httpFullPath = utils.getHttpFullPath(); if (!this.IsPostBack) { this.FetchFileTypes(); this.schedaDocumento = UIManager.DocumentManager.getSelectedRecord(); if (this.schedaDocumento.documentoPrincipale != null) { rblListSavingOption.Items.RemoveAt(1); } if (UIManager.DocumentManager.getSelectedAttachId() == null && this.schedaDocumento != null && this.schedaDocumento.protocollo != null && !string.IsNullOrEmpty(this.schedaDocumento.protocollo.segnatura)) { file_name = UIManager.UserManager.normalizeStringPropertyValue(this.schedaDocumento.protocollo.segnatura); } else { if (this.schedaDocumento != null && this.schedaDocumento.docNumber != null && !string.IsNullOrEmpty(this.schedaDocumento.docNumber)) { String selectedVersionId = null; if (DocumentManager.getSelectedNumberVersion() != null && DocumentManager.ListDocVersions != null) { selectedVersionId = (from v in DocumentManager.ListDocVersions where v.version.Equals(DocumentManager.getSelectedNumberVersion()) select v.versionId).FirstOrDefault(); } DocsPaWR.FileRequest fileReq = (UIManager.DocumentManager.getSelectedAttachId() != null) ? UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) : UIManager.FileManager.GetFileRequest(selectedVersionId); FileDocumento doc = FileManager.getInstance(this.schedaDocumento.systemId).getInfoFile(this.Page, fileReq); if (doc != null && !string.IsNullOrEmpty(doc.nomeOriginale)) { file_name = cleanFileName(doc.nomeOriginale); } else { file_name = this.schedaDocumento.docNumber; } //file_name = (UIManager.DocumentManager.getSelectedAttachId() != null ? UIManager.DocumentManager.getSelectedAttachId() : this.schedaDocumento.docNumber); } } this.initForm(); } }
/// <summary> /// Metodo per l'aggiunta dell'allegato al documento spedito /// </summary> /// <param name="documentId">Id del documento a aggiungere l'allegato</param> /// <param name="recData">Contenuto della ricevuta</param> /// <param name="userInfo">Informazioni sull'utente da utilizzare per l'aggiunta dell'allegato</param> /// <param name="messageId">Identificativo del messaggio</param> /// <param name="proofDate">Data di generazione della ricevuta</param> /// <param name="receiverCode">Codice del destinatario che ha generato la mancata consegna</param> /// <param name="senderUrl">Url del mittente</param> private static void AddAttachmentToDocument(String documentId, byte[] recData, InfoUtente userInfo, String messageId, DateTime proofDate, String receiverCode, String senderUrl) { // Creazione dell'oggetto allegato Allegato a = new Allegato(); // Impostazione delle proprietà dell'allegato a.descrizione = String.Format("Ricevuta di mancata consegna - " + receiverCode); a.docNumber = documentId; a.version = "0"; a.numeroPagine = 1; a.TypeAttachment = 3; try { // Aggiunta dell'allegato al documento principale a = AllegatiManager.aggiungiAllegato(userInfo, a); // Set del flag in CHA_ALLEGATI_ESTERNO in Versions BusinessLogic.Documenti.AllegatiManager.setFlagAllegati_PEC_IS_EXT(a.versionId, a.docNumber, "I"); // Associazione dell'immagine all'allegato FileDocumento fileDocument = new FileDocumento() { content = recData, length = recData.Length, name = "MancataConsegna.pdf" }; FileRequest request = a as FileRequest; String err; FileManager.putFileRicevuteIs(ref request, fileDocument, userInfo, out err); // Aggiunta della notifica alla tabella delle notifiche SaveProofInRegistry(a, messageId, receiverCode, senderUrl, proofDate, documentId); if (!String.IsNullOrEmpty(err)) { SimplifiedInteroperabilityLogAndRegistryManager.InsertItemInLog(documentId, true, String.Format("Errore durante l'associazione della ricevuta di mancata consegna al documento")); } else { SimplifiedInteroperabilityLogAndRegistryManager.InsertItemInLog(documentId, false, String.Format("Ricevuta di mancata consegna associata correttamente al documento")); } } catch (Exception e) { string message = e.Message + " " + e.StackTrace; message = message.Length > 3700 ? message.Substring(0, 3700) : message; SimplifiedInteroperabilityLogAndRegistryManager.InsertItemInLog(documentId, true, String.Format("Errore durante l'aggiunta dell'allegato con la ricevuta di mancata consegna al documento " + documentId + " : " + message)); } }
/// <summary> /// Funzione per il trasferimento di un documento da ETDocs a WsPia /// </summary> /// <param name="fileRequest">File da trasferire</param> private void TransferFileToWsPia(FileRequest fileRequest) { // Recupero informazioni sull'ultimo file FileDocumento fileDocument = new FileDocumento(); this.GetFile(ref fileDocument, ref fileRequest); // Invio a WS Pia del file if (fileDocument.content != null && fileDocument.content.Length > 0) { this._documentManagerWSPIA.PutFile(fileRequest, fileDocument, Path.GetExtension(fileRequest.fileName)); } }
//END NEW /// <summary> /// Reperimento dell'estensione completa del file nel caso in cui sia P7M /// </summary> /// <returns></returns> protected string GetP7mFileExtensions() { string extensions = string.Empty; String selectedVersionId = null; if (DocumentManager.getSelectedNumberVersion() != null && DocumentManager.ListDocVersions != null) { selectedVersionId = (from v in DocumentManager.ListDocVersions where v.version.Equals(DocumentManager.getSelectedNumberVersion()) select v.versionId).FirstOrDefault(); } DocsPaWR.FileRequest fileInfo = (UIManager.DocumentManager.getSelectedAttachId() != null) ? UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) : UIManager.FileManager.GetFileRequest(selectedVersionId); /* * DocsPaWR.FileRequest fileInfo = (UIManager.DocumentManager.getSelectedAttachId() != null) ? * UIManager.FileManager.GetFileRequest(UIManager.DocumentManager.getSelectedAttachId()) : * UIManager.FileManager.GetFileRequest(); * */ //DocsPaWR.FileDocumento fileInfo = SaveFileServices.GetFileInfo(); FileDocumento doc = FileManager.getInstance(this.schedaDocumento.systemId).getInfoFile(this.Page, fileInfo); //string fileName = fileInfo.fileName; //string fileName = doc.nomeOriginale; string fileName = doc.nomeOriginale; if (string.IsNullOrEmpty(fileName)) { fileName = doc.name; } if (Path.GetExtension(fileName).ToUpperInvariant() == ".P7M") { while (!string.IsNullOrEmpty(Path.GetExtension(fileName))) { string ext = Path.GetExtension(fileName); if (!string.IsNullOrEmpty(ext)) { extensions = ext + extensions; } fileName = Path.GetFileNameWithoutExtension(fileName); } } return(extensions); }
private void Page_Load(object sender, System.EventArgs e) { Response.Expires = -1; this._requestType = (string)Request.QueryString["type"]; this._requestDocumentIndex = Convert.ToInt32(Request.QueryString["documentIndex"]); //this._requestSignerIndex=Convert.ToInt32(Request.QueryString["index"]); this._fileDocument = DocumentManager.GetSignedDocument(); this._signatureResult = this._fileDocument.signatureResult; // Put user code to initialize the page here this.FillTable(); }
public static FileInfo buildInstance(FileDocumento input) { FileInfo res = new FileInfo(); res.Content = input.content; res.ContentType = input.contentType; res.EstensioneFile = input.estensioneFile; res.FullName = input.fullName; res.OriginalFileName = input.nomeOriginale; res.Length = input.length; res.Name = input.name; res.Path = input.path; return(res); }
protected void HistoryVersBtnRapporto_Click(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this, this.GetType(), "reallowOp", "reallowOp();", true); string result = DocumentManager.GetRapportoVersamento(DocumentManager.getSelectedRecord().systemId, UserManager.GetInfoUser()); if (!string.IsNullOrEmpty(result)) { this.PlcHistoryVersXml.Visible = true; this.HistoryVersLblReport.Visible = true; this.HistoryVersLblRecover.Visible = false; string xmlString = this.GetXML(result); if (!string.IsNullOrEmpty(Utils.InitConfigurationKeys.GetValue("0", DBKeys.FE_URL_XSL_RAPPORTO_VERS.ToString()))) { //string urlXSL = Utils.InitConfigurationKeys.GetValue("0", DBKeys.FE_URL_XSL_RAPPORTO_VERS.ToString()); string urlXSL = "../xml/rapporto_versamento.xsl"; string decl = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; string pi = string.Format("<?xml-stylesheet type=\"text/xsl\" href=\"{0}\"?>", urlXSL); xmlString = xmlString.Replace(decl, decl + "\n" + pi); } FileDocumento fd = new FileDocumento(); fd.content = System.Text.Encoding.UTF8.GetBytes(xmlString); fd.length = fd.content.Length; fd.name = "RapportoVersamento.xml"; fd.nomeOriginale = "RapportoVersamento.xml"; fd.estensioneFile = "xml"; if (xmlString.Contains("text/xsl")) { fd.contentType = "text/xsl"; } else { fd.contentType = "text/xml"; } HttpContext.Current.Session["fileDoc"] = fd; this.frame.Attributes["src"] = "../Document/AttachmentViewer.aspx"; } else { string msgDesc = "msgConsRecoveryError"; ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.fra_main) {parent.fra_main.ajaxDialogModal('" + msgDesc.Replace("'", @"\'") + "', 'error', '');} else {parent.ajaxDialogModal('" + msgDesc.Replace("'", @"\'") + "', 'error', '');}", true); } this.UpPnlHistoryVersXml.Update(); }
protected void Page_Load(object sender, EventArgs e) { FileDocumento doc = CallContextStack.CurrentContext.ContextState["documentFile"] as FileDocumento; if (doc != null) { CallContextStack.CurrentContext.ContextState["documentFile"] = null; Response.Clear(); Response.ContentType = doc.contentType; Response.AddHeader("content-disposition", "attachment;filename=" + doc.name); Response.BinaryWrite(doc.content); Response.Flush(); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { // Si prova a prelevare dal call context il report FileDocumento report = CallContextStack.CurrentContext.ContextState["reportImport"] as FileDocumento; // Se il file documento è stato recuperato con successo, si procede alla visualizzazione if (report != null && report.length > 0) { Response.ContentType = report.contentType; Response.AddHeader("content-disposition", "attachment; filename=" + report.name); Response.AddHeader("content-length", report.content.Length.ToString()); Response.BinaryWrite(report.content); Response.Flush(); } }
/// <summary> /// Creazione di una nuova versione del documento /// </summary> /// <param name="idDocument"></param> /// <param name="checkOutStatus"></param> /// <param name="checkedOutFile"></param> /// <param name="checkInComments"></param> /// <returns></returns> protected bool CreateDocumentVersion(CheckOutStatus checkOutStatus, byte[] checkedOutFileContent, string checkInComments, InfoUtente checkOutOwner) { bool retValue = false; DocsPaDB.Query_DocsPAWS.CheckInOut checkInOutDb = new DocsPaDB.Query_DocsPAWS.CheckInOut(); // Reperimento dell'ultima versione del documento FileRequest fileRequest = checkInOutDb.GetFileRequest(checkOutStatus.IDDocument); FileDocumento fileDocument = CreateFileDocument(checkOutStatus.DocumentLocation, checkedOutFileContent); if (checkInOutDb.IsAcquired(fileRequest)) { // Se per l'ultima versione del documento è stato acquisito un file, // viene creata nuova versione per il documento fileRequest = new FileRequest(); fileRequest.fileName = checkOutStatus.DocumentLocation; fileRequest.docNumber = checkOutStatus.DocumentNumber; // Impostazione degli eventuali commenti da aggiungere alla versione fileRequest.descrizione = checkInComments; DocumentManager documentManager = new DocumentManager(this.InfoUtente); retValue = documentManager.AddVersion(fileRequest, false); } else { // Se per l'ultima versione del documento non è stato acquisito un file, // il file viene acquisito per l'ultima versione fileRequest.fileName = fileDocument.fullName; // Impostazione degli eventuali commenti da aggiungere alla versione fileRequest.descrizione = checkInComments; retValue = true; } if (retValue && fileDocument != null && fileDocument.content != null && fileDocument.content.Length > 0) { // Inserimento del nuovo file per la versione DocumentManager documentManager = new DocumentManager(this.InfoUtente); retValue = documentManager.PutFile(fileRequest, fileDocument, fileDocument.estensioneFile); } return(retValue); }