/// <summary> /// /// </summary> /// <param name="xmlDom"></param> /// <param name="nodeName"></param> /// <param name="addVersion"></param> /// <param name="cartaceo"></param> private void UploadFile(XmlDocument xmlDom, string nodeName, bool addVersion, bool cartaceo, bool convertiPDF, bool convertiPDFServer, bool conversionePDFServerSincrona) { XmlNode file = xmlDom.SelectSingleNode("root/" + nodeName); if (file != null) { string fileBuf = file.FirstChild.Value; DocsPaWR.FileDocumento fileDoc = new NttDataWA.DocsPaWR.FileDocumento(); fileDoc.name = file.Attributes["FileName"].Value; fileDoc.fullName = fileDoc.name; fileDoc.content = Convert.FromBase64String(fileBuf); fileDoc.length = fileDoc.content.Length; fileDoc.cartaceo = cartaceo; //if(Convert.ToBoolean(NttDataWA.Utils.isEnableConversionePdfLatoServer()) || Boolean.Parse(Utils.IsEbabledConversionePdfLatoServerSincrona())) // Se è richiesta conversione pdf centralizzata if (convertiPDF && convertiPDFServer) { NttDataWA.UIManager.FileManager.uploadFile(this, fileDoc, fileDoc.cartaceo, convertiPDFServer, conversionePDFServerSincrona); //NttDataWA.UIManager.FileManager.getInstance(Session.SessionID). } else { // ...altrimenti si procede con upload del file senza coversione NttDataWA.UIManager.FileManager.uploadFile(this, fileDoc, addVersion); //.getInstance(Session.SessionID).uploadFile(this, fileDoc, addVersion); } } }
/// <summary> /// /// </summary> /// <param name="page"></param> /// <param name="idDocumento"></param> /// <returns></returns> public NttDataWA.DocsPaWR.FileDocumento GetSignedDocumentInfo(System.Web.UI.Page page, DocsPaWR.FileRequest fileRequest) { NttDataWA.DocsPaWR.DocsPaWebService ws = new NttDataWA.DocsPaWR.DocsPaWebService(); NttDataWA.DocsPaWR.FileDocumento retValue = ws.DocumentoGetInfoFile(fileRequest, NttDataWA.UIManager.UserManager.GetInfoUser()); //if (retValue == null) // throw new ApplicationException("Attenzione! il file non è visualizzabile.<br><br>Verificare:<br>• l'esistenza del file in:<br>" + fileRequest.docServerLoc + fileRequest.path + fileRequest.fileName + "<br><br>• la stringa di Impronta sulla base dati."); return(retValue); }
private void Page_Load(object sender, System.EventArgs e) { Response.Expires = -1; NttDataWA.DocsPaWR.FileDocumento theDoc = null; theDoc = (NttDataWA.DocsPaWR.FileDocumento)FileManager.getSelectedFileReport(this); if (theDoc != null) { Response.ContentType = theDoc.contentType; Response.BinaryWrite(theDoc.content); Response.Flush(); } }
protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; NttDataWA.DocsPaWR.FileDocumento theDoc = null; theDoc = (NttDataWA.DocsPaWR.FileDocumento)Session["invoicePreview"]; if (theDoc != null) { Response.ContentType = theDoc.contentType; Response.BinaryWrite(theDoc.content); Response.Flush(); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { Response.Expires = -1; NttDataWA.DocsPaWR.FileDocumento fileDoc = null; fileDoc = (NttDataWA.DocsPaWR.FileDocumento)FileManager.getSelectedFileReport(this); if (fileDoc != null) { Response.ContentType = fileDoc.contentType; Response.AddHeader("Content-Disposition", "filename=" + fileDoc.fullName); Response.BinaryWrite(fileDoc.content); Response.Flush(); Response.End(); } }
private void UploadFile(NttDataWA.Utils.FileJSON file) { DocsPaWR.FileDocumento fileDoc = new NttDataWA.DocsPaWR.FileDocumento(); if (file != null) { fileDoc.name = file.name; fileDoc.fullName = file.fullPath; fileDoc.cartaceo = this.Cartaceo; fileDoc.content = Convert.FromBase64String(file.content); fileDoc.length = fileDoc.content.Length; //FileManager.uploadFile(this,fileDoc,false); FileManager.getInstance(Session.SessionID).uploadFile(this, false, fileDoc); //FileManager.uploadFile(this, fileDoc, false, false, true); } }
private void UploadFile(XmlDocument document) { DocsPaWR.FileDocumento fileDoc = new NttDataWA.DocsPaWR.FileDocumento(); XmlNode rootNode = document.SelectSingleNode("File"); if (rootNode != null) { fileDoc.name = rootNode.Attributes.GetNamedItem("name").Value; fileDoc.fullName = rootNode.Attributes.GetNamedItem("fullPath").Value; fileDoc.cartaceo = this.Cartaceo; string content = rootNode.Attributes.GetNamedItem("content").Value; fileDoc.content = Convert.FromBase64String(content); fileDoc.length = fileDoc.content.Length; //FileManager.uploadFile(this,fileDoc,false); FileManager.getInstance(Session.SessionID).uploadFile(this, false, fileDoc); //FileManager.uploadFile(this, fileDoc, false, false, true); } }
protected void Page_Load(object sender, EventArgs e) { string templateFilePath = Server.MapPath("formatPdfExport.xml"); NttDataWA.DocsPaWR.FileDocumento fileRep = new NttDataWA.DocsPaWR.FileDocumento(); if ((Session["dsData"] != null) && (Session["dsData"].ToString() != "")) { fileRep = global::ProspettiRiepilogativi.Frontend.PdfReport.do_MakePdfReport(global::ProspettiRiepilogativi.Frontend.ReportDisponibili.ReportLogMassiveImport, templateFilePath, (DataSet)Session["dsData"], null); if (fileRep.length > 0) { Response.ContentType = fileRep.contentType; Response.AddHeader("content-disposition", "inline; filename=" + fileRep.name); Response.AddHeader("content-length", fileRep.content.Length.ToString()); Response.BinaryWrite(fileRep.content); Response.Flush(); // Response.End(); } } }
private void Page_Load(object sender, System.EventArgs e) { Response.Expires = -1; if (requestHash) { DocsPaWR.MassSignature massSignature = UIManager.FileManager.getSelectedMassSignature(); if (massSignature != null) { Response.Write(massSignature.base64Sha256); } else { throw new Exception("UIManager.FileManager.getSelectedMassSignature() in errore."); } } else { try { DigitalSignature.DigitalSignManager firmaDigitaleMng = new DigitalSignature.DigitalSignManager(); NttDataWA.DocsPaWR.FileDocumento fileFirmato = firmaDigitaleMng.GetSignedDocument(this); firmaDigitaleMng = null; if (fileFirmato != null) { Response.BinaryWrite(fileFirmato.content); Response.Flush(); } } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return; } } }
protected void Page_Load(object sender, EventArgs e) { try { if (this.IsPostBack) { UploadDetail Upload = Session["UploadDetail"] as UploadDetail; //NttDataWA.DocsPaWR.FileDocumento fileDoc = Session["fileDoc"] as NttDataWA.DocsPaWR.FileDocumento; NttDataWA.DocsPaWR.FileDocumento fileDoc = new NttDataWA.DocsPaWR.FileDocumento(); if (Upload != null && fileDoc != null) { Upload.IsReady = false; //using (StreamWriter log = File.AppendText(HttpContext.Current.Server.MapPath("../UserFiles/debug.log"))) //{ // log.WriteLine(DateTime.Now.ToString() + ": PostedFile is null=" + (this.fileUpload.PostedFile==null).ToString()); //} if (this.fileUpload.PostedFile != null && this.fileUpload.PostedFile.ContentLength > 0 && this.fileUpload.PostedFile.ContentLength <= this.FileAcquisitionSizeMax) { string path = this.Server.MapPath(@"Uploads"); string fileName = Path.GetFileName(this.fileUpload.PostedFile.FileName); string exten = Path.GetExtension(Path.Combine(path, fileName)); Upload.ContentLength = this.fileUpload.PostedFile.ContentLength; Upload.FileName = fileName; Upload.UploadedLength = 0; Upload.IsReady = true; //using (StreamWriter log = File.AppendText(HttpContext.Current.Server.MapPath("../UserFiles/debug.log"))) //{ // log.WriteLine(DateTime.Now.ToString() + ": Upload.FileName=" + Upload.FileName + ", Upload.ContentLength=" + Upload.ContentLength); //} fileDoc.name = fileName;// System.IO.Path.GetFileName(file.FileName); fileDoc.fullName = Path.Combine(path, fileName); fileDoc.contentType = NttDataWA.UIManager.FileManager.GetMimeType(fileName); fileDoc.length = this.fileUpload.PostedFile.ContentLength;// ContentLength;// .FileSize; fileDoc.content = new Byte[fileDoc.length]; int bufferSize = 1; byte[] buffer = new byte[bufferSize]; while (Upload.UploadedLength < Upload.ContentLength) { //Fill the buffer from the input stream int bytes = this.fileUpload.PostedFile.InputStream.Read(buffer, 0, bufferSize); fileDoc.content.SetValue(buffer[0], Upload.UploadedLength); Upload.UploadedLength += bytes; Session["UploadDetail"] = Upload; } Upload.UploadedLength = fileDoc.length; Session["UploadDetail"] = Upload; Session["fileDoc"] = fileDoc; const string js = "window.parent.endProgress('{0}','{1}', '{2}');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "progress", string.Format(js, fileName.Replace("'", " "), Upload.UploadedLength, Upload.ContentLength), true); } else { string msg = "ErrorFileUpload"; if (this.fileUpload.PostedFile.ContentLength > this.FileAcquisitionSizeMax) { msg = "ErrorFileUploadMaxSizeExceeded"; } ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "if (parent.parent.fra_main) {parent.parent.fra_main.ajaxDialogModal('" + utils.FormatJs(msg) + "', 'error', '');} else {parent.parent.ajaxDialogModal('" + utils.FormatJs(msg) + "', 'error', '');}; parent.reallowOp();", true); } Upload.IsReady = false; } } } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return; } }
protected void Page_Load(object sender, EventArgs e) { int statusCode = 0; NttDataWA.Utils.FileJSON file = null; string componentType = UIManager.UserManager.getComponentType(Request.UserAgent); if ((Request.QueryString["Absolutepath"] != null) && (Request.QueryString["Absolutepath"] != "")) { //1. controllo se arriva la path assoluta absolutePath = decodeQueryString(Request.QueryString["Absolutepath"].ToString()); //1.0.1 Controllo della dimensione del file if (!string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings[NttDataWA.Utils.WebConfigKeys.FILE_ACQ_SIZE_MAX.ToString()]) && (Int32.Parse(System.Configuration.ConfigurationManager.AppSettings[NttDataWA.Utils.WebConfigKeys.FILE_ACQ_SIZE_MAX.ToString()].ToString()) * 1024) < Request.ContentLength ) { parseStatusCode(5); if (!String.IsNullOrEmpty(componentType) && componentType.Equals(Constans.TYPE_SOCKET)) { ImportDocManager.setSessionMapImportStatus(absolutePath, this.Response.StatusDescription); } else { HttpContext.Current.Session["ImportStatus"] = this.Response.StatusDescription; } } else { fd = new NttDataWA.DocsPaWR.FileDocumento(); //1.1 Leggo il content del file if (!IsSocket) { byte[] ba = Request.BinaryRead(Request.ContentLength); fd.content = ba; } else { //Stream stream=Request.InputStream; string contentFile = Request["contentFile"]; if (!String.IsNullOrEmpty(contentFile)) { contentFile = contentFile.Replace(' ', '+'); contentFile = contentFile.Trim(); file = JsonConvert.DeserializeObject <NttDataWA.Utils.FileJSON>(contentFile); } if (file != null && !String.IsNullOrEmpty(file.content)) { fd.content = Convert.FromBase64String(file.content); } } //1.2 leggo il codice fascicolo if (Request.QueryString["codFasc"] != null && Request.QueryString["codFasc"] != "") { codFasc = decodeQueryString(Request.QueryString["codFasc"].ToString()); //fasc = FascicoliManager.getFascicoloDaCodice(this.Page, codFasc); fasc = NttDataWA.UIManager.ProjectManager.getFascicoloDaCodice(this.Page, codFasc, Request.QueryString["idTitolario"]); } //1.4. tipo passato if (Request.QueryString["type"] != null && Request.QueryString["type"] != "") { type = Request.QueryString["type"].ToString(); } if (Request.QueryString["foldName"] != null && Request.QueryString["foldName"] != "") { foldName = decodeQueryString(Request.QueryString["foldName"].ToString()); } //1.5. se tutte le condizioni sono ok... procedo if ((codFasc != "") && (absolutePath != "")) { /* prendo la cartella selezionata per l'acquisizione massiva */ DocsPaWR.Folder folder = null; if (UIManager.ProjectManager.getProjectInSession().folderSelezionato != null) { folder = UIManager.ProjectManager.getProjectInSession().folderSelezionato; } statusCode = ImportDocManager.checkORCreateDocFolderFasc(this.Page, fasc, absolutePath, fd, foldName, type, folder, componentType); // parsing degli stati parseStatusCode(statusCode); if (!String.IsNullOrEmpty(componentType) && componentType.Equals(Constans.TYPE_SOCKET)) { ImportDocManager.setSessionMapImportStatus(absolutePath, this.Response.StatusDescription); } else { HttpContext.Current.Session["ImportStatus"] = this.Response.StatusDescription; } } } } }
private void Page_Load(object sender, System.EventArgs e) { Response.Expires = -1; string componentType = UIManager.UserManager.getComponentType(Request.UserAgent); if (Request.QueryString["idDocumento"] != null) { idDocument = Request.QueryString["idDocumento"].ToString(); } if (requestHash) { bool wantcosign = requestCosign; string strResp = ""; DocsPaWR.MassSignature massSignature = UIManager.FileManager.getSelectedMassSignature(idDocument); if (massSignature != null) { strResp = massSignature.base64Sha256; if (!String.IsNullOrEmpty(massSignature.base64Signature)) { strResp += string.Format("#{0}", massSignature.base64Signature); } if (componentType == Utils.Constans.TYPE_SMARTCLIENT || componentType == Utils.Constans.TYPE_ACTIVEX) { byte[] byteResp = System.Text.ASCIIEncoding.ASCII.GetBytes(strResp); Response.BinaryWrite(byteResp); Response.Flush(); } else { Response.Write(strResp); } } else { Response.Write(null); } } else { requestType = Request.QueryString["type"]; SmartClient.FirmaDigitaleMng firmaDigitaleMng = new SmartClient.FirmaDigitaleMng(); NttDataWA.DocsPaWR.FileDocumento fileFirmato = null; if (string.IsNullOrEmpty(idDocument)) { fileFirmato = firmaDigitaleMng.GetSignedDocument(this); } else { fileFirmato = firmaDigitaleMng.GetSignedDocument(this, idDocument); } firmaDigitaleMng = null; if (fileFirmato != null) { if (requestType == "applet") { string base64String = System.Convert.ToBase64String(fileFirmato.content, 0, fileFirmato.content.Length); Response.Write(base64String); } else { Response.BinaryWrite(fileFirmato.content); Response.Flush(); } } else { //Response.End(); //torno una response NULL, quindi l'fso non salvando nulla dovrebbe tornare null Response.Write(null); } } }