Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="xmlDom"></param>
        /// <param name="nodeName"></param>
        /// <param name="addVersion"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        private bool AppendFile(XmlDocument xmlDom, string nodeName, bool addVersion, bool convertPdfServer, out string errorMessage)
        {
            bool retValue = true;

            errorMessage = string.Empty;

            XmlNode file = xmlDom.SelectSingleNode("root/" + nodeName);

            if (file != null)
            {
                string fileBuf = file.FirstChild.Value;

                DocsPAWA.DocsPaWR.FileDocumento fileDoc = new DocsPAWA.DocsPaWR.FileDocumento();
                fileDoc.name     = file.Attributes["FileName"].Value;
                fileDoc.cartaceo = true;
                fileDoc.fullName = fileDoc.name;
                fileDoc.content  = Convert.FromBase64String(fileBuf);
                fileDoc.length   = fileDoc.content.Length;

                DocumentUploader docUploader = new DocumentUploader(this);
                retValue = docUploader.Upload(fileDoc, convertPdfServer, out errorMessage);
            }

            return(retValue);
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="document"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        private bool UploadFile(XmlDocument document, out string errorMessage)
        {
            bool retValue = false;

            errorMessage = string.Empty;

            SAAdminTool.DocsPaWR.FileDocumento fileDoc = new SAAdminTool.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 = true;

                string content = rootNode.Attributes.GetNamedItem("content").Value;
                fileDoc.content = Convert.FromBase64String(content);

                fileDoc.length = fileDoc.content.Length;

                DocumentUploader docUploader = new DocumentUploader(this);
                retValue = docUploader.Upload(fileDoc, false, out errorMessage);
            }

            return(retValue);
        }