Ejemplo n.º 1
0
        public void OpenDocument()
        {
            PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false, PdfFontEmbedding.Always);

            pdfRenderer.Document = document;
            pdfRenderer.RenderDocument();

            string fileName         = "";
            string completeFileName = "";

            string path = Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\TempFiles");

            try
            {
                fileName         = "\\TempFile_Epicrisis.pdf";
                completeFileName = path + fileName;
                File.Delete(completeFileName);
            }
            catch
            {
                return;
            }

            pdfRenderer.PdfDocument.Save(completeFileName);
            Process.Start(completeFileName);
        }
Ejemplo n.º 2
0
        public void ReadSettings()
        {
            try
            {
                cmbSSL.SelectedIndex = 0;

                pathXML = Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\UserInfo");

                string fileName = "\\MailSettings.xml";
                pathXML += fileName;

                if (File.Exists(pathXML.Trim()))
                {
                    XmlDocument xmldoc     = new XmlDocument();
                    XmlNodeList m_nodelist = null;

                    xmldoc.Load(pathXML.Trim());

                    m_nodelist     = xmldoc.SelectNodes("/SoftNetMail_Settings/Port");
                    TxtPuerto.Text = Encrypt_Decrypt.Desencriptar(m_nodelist[0].ChildNodes.Item(0).Value.ToString());

                    m_nodelist           = xmldoc.SelectNodes("/SoftNetMail_Settings/EnableSSL");
                    cmbSSL.SelectedIndex = cmbSSL.FindStringExact(Encrypt_Decrypt.Desencriptar(m_nodelist[0].ChildNodes.Item(0).Value.ToString()));

                    m_nodelist = xmldoc.SelectNodes("/SoftNetMail_Settings/ApplicationPwd");
                    txtContraseñaAplicacion.Text = Encrypt_Decrypt.Desencriptar(m_nodelist[0].ChildNodes.Item(0).Value.ToString());
                }
                else
                {
                    TxtPuerto.Text       = "587";
                    cmbSSL.SelectedIndex = 0;
                }
            }
            catch { }
        }
Ejemplo n.º 3
0
        private void btnGuardarCambios_Click(object sender, EventArgs e)
        {
            pathXML = Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\UserInfo");

            try
            {
                string fileName = "\\MailSettings.xml";
                pathXML += fileName;

                File.Delete(pathXML);

                SaveMailSettings();

                HideParentForm();
            }
            catch
            {
                MessageBox.Show(this, "No se puede crear el archivo, por favor vuelva a intentar", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
Ejemplo n.º 4
0
        public void Consultas_CreateRecoveryXMLFile(string pDetalleConsulta, string pDiagnostico, string pTratamiento,
                                                    ArrayList pExamenes, ArrayList pDetalleExamenes, ArrayList pGabinete, ArrayList pDetalleGabinete,
                                                    ArrayList pImagenes, ArrayList pVideos)
        {
            string path = Metodos_Globales.crearCarpetaAppdata("\\RecoveryFiles");

            int         nodeCount = 0;
            XmlDocument xmldoc = new XmlDocument();
            XmlNode     xmlRoot, xmlNode;

            string PathXml = path + "\\Recovery.xml";

            if (!File.Exists(PathXml.Trim()))
            {
                xmlRoot   = xmldoc.CreateElement("Main");
                nodeCount = 0;
            }
            else
            {
                xmldoc.Load(PathXml.Trim());
                xmlRoot   = xmldoc.SelectSingleNode("/Main");
                nodeCount = xmldoc.ChildNodes.Count;
            }

            nodeCount++;

            xmldoc.AppendChild(xmlRoot);
            xmlNode = xmldoc.CreateElement("DetalleConsulta");
            xmlRoot.AppendChild(xmlNode);
            xmlNode.InnerText = Encrypt_Decrypt.Encriptar(pDetalleConsulta.Trim());

            xmldoc.AppendChild(xmlRoot);
            xmlNode = xmldoc.CreateElement("Diagnostico");
            xmlRoot.AppendChild(xmlNode);
            xmlNode.InnerText = Encrypt_Decrypt.Encriptar(pDiagnostico.Trim());

            xmldoc.AppendChild(xmlRoot);
            xmlNode = xmldoc.CreateElement("Tratamiento");
            xmlRoot.AppendChild(xmlNode);
            xmlNode.InnerText = Encrypt_Decrypt.Encriptar(pTratamiento.Trim());


            xmldoc.AppendChild(xmlRoot);
            xmlNode = xmldoc.CreateElement("Examenes");
            xmlRoot.AppendChild(xmlNode);
            string examenes = "";

            foreach (string oString in pExamenes)
            {
                examenes = oString + "/";
            }
            if (examenes.EndsWith("/"))
            {
                examenes = examenes.Substring(0, examenes.Length - 1);
            }
            xmlNode.InnerText = Encrypt_Decrypt.Encriptar(examenes);

            xmldoc.AppendChild(xmlRoot);
            xmlNode = xmldoc.CreateElement("DetalleExamenes");
            xmlRoot.AppendChild(xmlNode);
            string detalle_examenes = "";

            foreach (string oString in pDetalleExamenes)
            {
                detalle_examenes = oString + "/";
            }
            if (detalle_examenes.EndsWith("/"))
            {
                detalle_examenes = detalle_examenes.Substring(0, detalle_examenes.Length - 1);
            }
            xmlNode.InnerText = Encrypt_Decrypt.Encriptar(detalle_examenes);


            xmldoc.AppendChild(xmlRoot);
            xmlNode = xmldoc.CreateElement("Gabinete");
            xmlRoot.AppendChild(xmlNode);
            string gabinete = "";

            foreach (string oString in pGabinete)
            {
                gabinete = oString + "/";
            }
            if (gabinete.EndsWith("/"))
            {
                gabinete = gabinete.Substring(0, gabinete.Length - 1);
            }
            xmlNode.InnerText = Encrypt_Decrypt.Encriptar(gabinete);

            xmldoc.AppendChild(xmlRoot);
            xmlNode = xmldoc.CreateElement("DetalleGabinete");
            xmlRoot.AppendChild(xmlNode);
            string detalle_gabinete = "";

            foreach (string oString in pDetalleGabinete)
            {
                detalle_gabinete = oString + "/";
            }
            if (detalle_gabinete.EndsWith("/"))
            {
                detalle_gabinete = detalle_gabinete.Substring(0, detalle_gabinete.Length - 1);
            }
            xmlNode.InnerText = Encrypt_Decrypt.Encriptar(detalle_gabinete);



            xmldoc.AppendChild(xmlRoot);
            xmlNode = xmldoc.CreateElement("Imagenes");
            xmlRoot.AppendChild(xmlNode);
            string imagenes = "";

            foreach (string oString in pImagenes)
            {
                imagenes = oString + "|";
            }
            if (imagenes.EndsWith("|"))
            {
                imagenes = imagenes.Substring(0, imagenes.Length - 1);
            }
            xmlNode.InnerText = Encrypt_Decrypt.Encriptar(imagenes.Trim());

            xmldoc.AppendChild(xmlRoot);
            xmlNode = xmldoc.CreateElement("Videos");
            xmlRoot.AppendChild(xmlNode);
            string videos = "";

            foreach (string oString in pVideos)
            {
                videos = oString + "|";
            }
            if (videos.EndsWith("|"))
            {
                videos = videos.Substring(0, videos.Length - 1);
            }
            xmlNode.InnerText = Encrypt_Decrypt.Encriptar(videos.Trim());

            xmldoc.Save(PathXml.Trim());
        }
Ejemplo n.º 5
0
        public void btnConvertirPDF_Click(object sender, EventArgs e)
        {
            if (listView1.Items.Count > 0)
            {
                oPicLoading.Visible   = true;
                lblProcesando.Visible = true;

                string fileName         = "";
                string completeFileName = "";
                string path             = Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\TempFiles");

                try
                {
                    fileName         = "\\TempFile_PDF.pdf";
                    completeFileName = path + fileName;
                    File.Delete(completeFileName);
                }
                catch
                {
                    MessageBox.Show(this, "No se puede crear el archivo/reporte ya que otro está actualmente en uso, cierre el archivo temporal en uso primero y vuelva a intentar", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                double xPos = 0;
                double yPos = 0;

                PdfDocument doc = new PdfDocument();

                int cont = 0;
                #region MyRegion
                //foreach (GlobalElementsValues oElement in softNetImageViewer3.GlobalElementsDetails)
                //{
                //    Application.DoEvents();

                //    doc.Pages.Add(new PdfPage());
                //    XGraphics xgr = XGraphics.FromPdfPage(doc.Pages[cont]);
                //    XImage img = XImage.FromFile(oElement.OFileName);

                //    XSize oSize = ImageSize(doc.Pages[cont], img);

                //    if (doc.Pages[cont].Width > img.PointWidth)
                //        xPos = (doc.Pages[cont].Width - img.PointWidth) / 2;
                //    else
                //        xPos = (img.PointWidth - doc.Pages[cont].Width) / 2;

                //    yPos = (doc.Pages[cont].Height - img.PointHeight) / 2;

                //    xgr.DrawImage(img, xPos, yPos, oSize.Width, oSize.Height);

                //    xgr.Dispose();
                //    img.Dispose();
                //    cont++;
                //}
                #endregion

                string filename = textBox1.Text.Trim();
                foreach (ListViewItem oItem in listView1.Items)
                {
                    Application.DoEvents();

                    doc.Pages.Add(new PdfPage());
                    XGraphics xgr = XGraphics.FromPdfPage(doc.Pages[cont]);

                    //string path1 = ConvertImage(File.ReadAllBytes(filename + "\\" + oItem.Text.Trim()), doc.Pages[cont]);
                    XImage img = XImage.FromFile(filename + "\\" + oItem.Text.Trim()); //oElement.OFileName);//path1) ;

                    XSize oSize = ImageSize(doc.Pages[cont], img);                     //img.Size;

                    //img.Size.Height = oSize.Height;

                    if (doc.Pages[cont].Width > oSize.Width)              //img.PointWidth)
                    {
                        xPos = (doc.Pages[cont].Width - oSize.Width) / 2; //img.PointWidth) / 2;
                    }
                    else
                    {
                        xPos = (oSize.Width - doc.Pages[cont].Width) / 2; //(img.PointWidth - doc.Pages[cont].Width) / 2;
                    }
                    yPos = (doc.Pages[cont].Height - oSize.Height) / 2;   //img.PointHeight) / 2;

                    xgr.DrawImage(img, xPos, yPos, oSize.Width, oSize.Height);

                    xgr.Dispose();
                    img.Dispose();
                    xgr = null;
                    img = null;

                    cont++;

                    //File.Delete(path1);
                }

                try
                {
                    doc.Save(completeFileName);
                }
                catch { MessageBox.Show(this, "No se puede generar el archivo si no hay imágenes disponibles", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Error); }
                doc.Close();
                doc.Dispose();

                oPicLoading.Visible   = false;
                lblProcesando.Visible = false;

                softNet_AdobePDFViewer1.FileLocation = completeFileName;
                softNet_AdobePDFViewer1.OpenDocument();
            }
            else
            {
                MessageBox.Show(this, "No se puede generar el archivo si no hay imágenes disponibles", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }