private void btnPaint_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "¿Se creará una copia temporal de la imagen actual por propósitos de edición, desea continuar con estas acciones?", "Atención", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { string path = ""; Image oImage = Metodos_Globales.CreateTempImageFromByteArray(Imagen, out path); if (oImage != null) { System.Diagnostics.Process.Start("mspaint", path).WaitForExit(); oImage = Image.FromFile(path); GlobalElementsValues oElement = new GlobalElementsValues { OBytes = File.ReadAllBytes(path), OFileName = path, OImage = oImage, OIndex = Program.oFrmConsultas.softNetImageViewer1.Controls.Count }; Program.oFrmConsultas.softNetImageViewer1.AddSingleImage(oElement); Notificacion.mostrarVentana("Atención", "Nueva imagen editada fue agregada a su lista de imágenes disponible", Notificacion.Imagen.Soporte, 7); } else { MessageBox.Show(this, "¿Hubo un problema con la creación de la imagen temporal, por favor intente de nuevo. Si el problema persiste comuníquese con la persona que da soporte a su empresa", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } }
public static string LeerContraseñaAplicacionEmail() { string contraseñaAplicacion = String.Empty; try { string 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/ApplicationPwd"); contraseñaAplicacion = Encrypt_Decrypt.Desencriptar(m_nodelist[0].ChildNodes.Item(0).Value.ToString()); } } catch (Exception ex) { } return(contraseñaAplicacion); }
public void LeeConfiguracionEmail() { string pathXML = Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\UserInfo"); string fileName = "\\MailSettings.xml"; pathXML += fileName; try { if (File.Exists(pathXML.Trim())) { XmlDocument xmldoc = new XmlDocument(); XmlNodeList m_nodelist = null; xmldoc.Load(pathXML.Trim()); m_nodelist = xmldoc.SelectNodes("/SoftNetMail_Settings/Port"); Program.oSMTPPort = Encrypt_Decrypt.Desencriptar(m_nodelist[0].ChildNodes.Item(0).Value.ToString()); m_nodelist = xmldoc.SelectNodes("/SoftNetMail_Settings/EnableSSL"); Program.oEnableSSL = Convert.ToBoolean(Encrypt_Decrypt.Desencriptar(m_nodelist[0].ChildNodes.Item(0).Value.ToString())); } else { Program.oSMTPPort = "587"; Program.oEnableSSL = false; } } catch { } }
public bool VerificaCorreosEnviados() { DateTime oFecha = new DateTime(); string PathXml = Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\Citas") + "\\SentEmails.xml"; if (File.Exists(PathXml.Trim())) { XmlDocument xmldoc = new XmlDocument(); XmlNodeList m_nodelist = null; xmldoc.Load(PathXml.Trim()); m_nodelist = xmldoc.SelectNodes("/SentDate/Date"); foreach (XmlNode Nodo in m_nodelist) { oFecha = Convert.ToDateTime(Encrypt_Decrypt.Desencriptar(Nodo.ChildNodes.Item(0).Value.ToString())); } if (oFecha.Date == System.DateTime.Today.Date) { return(true); } else { return(false); } } else { return(false); } }
private void ModoBloqueo() { LlenarLista(); lstGabinete.Enabled = true; //tobNuevo.Enabled = true; Metodos_Globales.EjecutaPermisos(tobNuevo, tobModificar, tobEliminar, oArregloPermisos); if (tobModificar.Enabled == true || tobEliminar.Enabled == true) { if (lstGabinete.Items.Count > 0) { if (tobModificar.Enabled == true) { tobModificar.Enabled = true; } else { tobModificar.Enabled = false; } if (tobEliminar.Enabled == true) { tobEliminar.Enabled = true; } else { tobEliminar.Enabled = false; } } else { tobModificar.Enabled = false; tobEliminar.Enabled = false; } } tobGuardar.Enabled = false; tobCancelar.Enabled = false; tobIniciarConsulta.Enabled = true; tobEjecutarConsulta.Enabled = false; tobCancelarConsulta.Enabled = false; tobSalir.Enabled = true; tobGuardarCategoria.Enabled = false; nuevo = false; modificar = false; if (lstGabinete.Items.Count == 0) { toolStripStatusLabel2.Text = "Presione el botón \"Nuevo\" para ingresar un nuevo examen a la lista"; } else { toolStripStatusLabel2.Text = "Seleccione la fila deseada sobre la cual desea trabajar"; } }
public void GeneraMailNotificacion(string pDe, string pDeContraseña, string pPara, string pAsunto, string pDetalle) { try { if (pDeContraseña.Trim() != "" && pDe.Trim() != "") { //RC.Gmail.GmailMessage gmailMsg = new RC.Gmail.GmailMessage(pDe.Trim() + "<" + oCEmpresa.NombreEmpresa.Trim() + ">", pDeContraseña.Trim()); //gmailMsg.To = pPara.Trim(); //gmailMsg.From = pDe.Trim() + "<" + oCEmpresa.NombreEmpresa.Trim()+ ">"; //gmailMsg.Subject = pAsunto.Trim(); //gmailMsg.Body = pDetalle.Trim(); //gmailMsg.Priority = System.Web.Mail.MailPriority.High; //gmailMsg.Send(); SmtpClient client = new SmtpClient(); client.Host = "smtp.gmail.com";//"smtp.mail.yahoo.com"; //"smtp.live.com"; //smtp.gmail.com client.Port = Convert.ToInt32(Program.oSMTPPort); client.DeliveryMethod = SmtpDeliveryMethod.Network; client.Credentials = new NetworkCredential(pDe.Trim(), pDeContraseña.Trim());//"*****@*****.**", "manujr123macr3267");//"*****@*****.**", "Ligia2347262"); client.EnableSsl = Program.oEnableSSL; MailMessage message = new MailMessage();//[email protected] message.Sender = new MailAddress(pDe.Trim(), oCEmpresa.NombreEmpresa.Trim()); message.From = new MailAddress(pDe.Trim(), oCEmpresa.NombreEmpresa.Trim()); char[] oChar = { ';', ' ' }; string[] oCadenaTemp = Metodos_Globales.MetodoSplit(pPara.Trim(), oChar); for (int i = 0; i < oCadenaTemp.Length;) { message.To.Add(oCadenaTemp[i].Trim()); i++; } message.Subject = pAsunto.Trim(); message.Body = pDetalle.Trim(); message.IsBodyHtml = false; message.Priority = MailPriority.High; client.Send(message); } else { MessageBox.Show("El mensaje no podrá ser enviado hasta que se proporcione la contraseña del correo electrónico indicado en la sección \"De:\" de esta pantalla.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } catch (Exception exc) { MessageBox.Show(exc.Message.Trim()); } }
private void tobCancelar_Click(object sender, EventArgs e) { //LlenarLista(); ModoBloqueo(); LimpiaCampos(); cmbCategorias.Text = ""; Metodos_Globales.BloquearCampos(this); Metodos_Globales.BloqueaTeclasRapidas(toolStrip1, menuStrip1); }
private void tobNuevo_Click(object sender, EventArgs e) { nuevo = true; modificar = false; Metodos_Globales.DesbloquearCampos(this); Metodos_Globales.EstableceFoco(TxtDescripcion); Metodos_Globales.LimpiaCampos(this); Metodos_Globales.ModoEscritura(toolStrip1); Metodos_Globales.BloqueaTeclasRapidas(toolStrip1, menuStrip1); }
public void frmPrescriptionPad_Load(object sender, EventArgs e) { ListaDeImpresorasInstaladas(); if (File.Exists(Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\UserInfo") + "\\Recetas.Xml")) { EstableceValoresFuentes(); EstableceValoresXY(); EstableceImpresoraYEjecutableAdobe(); } EstableceTextoFuente(); }
private void tobIniciarConsulta_Click(object sender, EventArgs e) { nuevo = false; modificar = false; Metodos_Globales.DesbloquearCampos(this); Metodos_Globales.EstableceFoco(txtNombre); LimpiaCampos(); Metodos_Globales.ModoConsulta(toolStrip1); tobGuardarCategoria.Enabled = true; Metodos_Globales.BloqueaTeclasRapidas(toolStrip1, menuStrip1); }
private void btn10Ultimos_Click(object sender, EventArgs e) { tobLimpiar_Click(sender, e); string sql = "Select Top 10 * from Paciente Order By num_expediente Desc"; Metodos_Globales.LlenarGrid(Grid1, sql.Trim()); if (Grid1.RowCount > 0) { DataGridViewCellEventArgs e2 = new DataGridViewCellEventArgs(0, Grid1.Rows.GetFirstRow(DataGridViewElementStates.None)); Grid1_CellEnter(sender, e2); Grid1.Focus(); } }
private void tobCancelar_Click(object sender, EventArgs e) { Metodos_Globales.LlenarGrid(Grid1, oCCategoriasExamenes.ConsultarSinParametros()); Metodos_Globales.ModoBloqueo(toolStrip1, Grid1); Metodos_Globales.LimpiaCampos(this); Metodos_Globales.BloquearCampos(this); Metodos_Globales.BloqueaTeclasRapidas(toolStrip1, menuStrip1); if (Grid1.Rows.Count == 0) { toolStripStatusLabel2.Text = "Presione el botón \"Nuevo\" para ingresar un nuevo método anticonceptivo"; } else { toolStripStatusLabel2.Text = "Seleccione la fila deseada sobre la cual desea trabajar"; } }
private void tobModificar_Click(object sender, EventArgs e) { if (Grid1.SelectedRows.Count > 0) { nuevo = false; modificar = true; Metodos_Globales.DesbloquearCampos(this); Metodos_Globales.EstableceFoco(TxtDescripcion); Metodos_Globales.ModoModificar(toolStrip1); Metodos_Globales.BloqueaTeclasRapidas(toolStrip1, menuStrip1); } else { MessageBox.Show(this, "Primero debe seleccionar la fila que contenga los valores deseados para realizar estas acciones", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
////public PagePreview.RenderEvent RenderEvent ////{ //// get { return this.renderEvent; } //// set //// { //// this.pagePreview.SetRenderEvent(value); //// this.renderEvent = value; //// } ////} ////PagePreview.RenderEvent renderEvent; ///// <summary> ///// Prints the document to the default printer. ///// See MSDN documentation for information about printer selection and printer settings. ///// </summary> //public void Print() //{ // PrintDocument pd = new PrintDocument(); // pd.PrintPage += new PrintPageEventHandler(PrintPage); // pd.Print(); //} ///// <summary> ///// Draws the page on the printer. ///// </summary> //private void PrintPage(object sender, PrintPageEventArgs ev) //{ // Graphics graphics = ev.Graphics; // graphics.PageUnit = GraphicsUnit.Point; // gfx = XGraphics.FromGraphics(graphics, PageSizeConverter.ToSize(PageSize.A4)); // //if (this.renderEvent != null) // // this.renderEvent(gfx); // ev.HasMorePages = false; //} public void Print() { string file = Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\TempFiles") + "\\TempFile_Prescription.pdf"; if (File.Exists(file)) { PdfFilePrinter.AdobeReaderPath = txtAdobeExePath.Text.Trim(); // Set the file to print and the Windows name of the printer. PdfFilePrinter printer = new PdfFilePrinter(file, comboBox1.Text.Trim()); // try { printer.Print(); } catch {} } }
/// <summary> /// Lee el archivo XML correspondiente y mediante el método DeterminaValoresFuente establece los valores a todas las fuentes /// existentes. /// </summary> private void EstableceValoresFuentes() { oXMLCreator.PathXml = Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\UserInfo") + "\\Recetas.Xml"; nomClinica = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/nomClinica")); especialidad = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/especialidad")); serviciosOfrecidos = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/serviciosOfrecidos")); telefono = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/telefono")); email = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/email")); direccion = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/direccion")); nombrePaciente = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/nombrePaciente")); cedula = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/cedula")); edad = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/edad")); peso = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/peso")); telefonos = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/telefonos")); rx = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/rx")); firma = DeterminaValoresFuente(oXMLCreator.ReadNodes("/Formato/firma")); }
private void LlenaListaConsultasPaciente() { lstConsultasPaciente.Items.Clear(); ArrayList oArreglo = oCPacientes.ConsultasPorPaciente(TxtNumExpediente.Text.Trim()); char[] oChar = { '$' }; foreach (string oCadena2 in oArreglo) { string[] oCadena = Metodos_Globales.MetodoSplit(oCadena2, oChar); lstConsultasPaciente.Items.Add(""); lstConsultasPaciente.Items[lstConsultasPaciente.Items.Count - 1].SubItems.Add(oCadena[0].ToString().Trim()); lstConsultasPaciente.Items[lstConsultasPaciente.Items.Count - 1].SubItems.Add(Convert.ToDateTime(oCadena[1]).ToLongDateString() + " a las " + Convert.ToDateTime(oCadena[1]).ToLongTimeString()); lstConsultasPaciente.Items[lstConsultasPaciente.Items.Count - 1].SubItems.Add(Convert.ToDateTime(oCadena[1]).ToString()); } }
private void tobCancelar_Click(object sender, EventArgs e) { Metodos_Globales.LlenarGrid(Grid1, oCCategoriasEmpleado.ConsultarSinParametros()); Metodos_Globales.ModoBloqueo(toolStrip1, Grid1); Metodos_Globales.EjecutaPermisos(tobNuevo, tobModificar, tobEliminar, oArregloPermisos); if (tobModificar.Enabled == true || tobEliminar.Enabled == true) { if (Grid1.Rows.Count > 0) { if (tobModificar.Enabled == true) { tobModificar.Enabled = true; } else { tobModificar.Enabled = false; } if (tobEliminar.Enabled == true) { tobEliminar.Enabled = true; } else { tobEliminar.Enabled = false; } } } Metodos_Globales.LimpiaCampos(this); Metodos_Globales.BloquearCampos(this); Metodos_Globales.BloqueaTeclasRapidas(toolStrip1, menuStrip1); if (Grid1.Rows.Count == 0) { toolStripStatusLabel2.Text = "Presione el botón \"Nuevo\" para ingresar una nueva categoría de empleado"; } else { toolStripStatusLabel2.Text = "Seleccione la fila deseada sobre la cual desea trabajar"; } }
private void ModoBloqueo() { tobNuevo.Enabled = true; tobGuardar.Enabled = false; tobCancelar.Enabled = false; tobSalir.Enabled = true; cmbRol.Enabled = true; LstOrigen.Enabled = true; LstDestino.Enabled = true; BtnAgregaTodo.Enabled = false; BtnAgregaUno.Enabled = false; BtnQuitaTodo.Enabled = false; BtnQuitaUno.Enabled = false; int linea = 0; LstDestino.Items.Clear(); SqlDataReader dr = Program.oPersistencia.ejecutarConsultaSQL("select idmenu from rolesXmenu where roldb = '" + Program.oComprobaciones.DevuelveCadenaCorrectaParaSentenciaSQL(cmbRol.Text) + "'"); // Verifico el Error if (Program.oPersistencia.IsError == true) { return; } while (dr.Read()) { this.LstDestino.Items.Add(dr.GetValue(0).ToString().Trim()); linea = linea + 1; } dr.Dispose();//Cierra el datareader if (LstDestino.Items.Count > 0) { tobModificar.Enabled = true; } Metodos_Globales.BloqueaTeclasRapidas(toolStrip1, menuStrip1); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnGuardar_Click(object sender, EventArgs e) { oCConsultasAntiguas.Num_expediente = idPaciente; oCConsultasAntiguas.Fecha_consulta = dtFechaConsulta.Value; oCConsultasAntiguas.Detalle_adicional = txtDetallesAdicionales.Text.Trim(); string path = Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\TempFiles"); path += "\\TempFile_PDF.pdf"; oCConsultasAntiguas.Detalle_consulta = File.ReadAllBytes(path); oCConsultasAntiguas.Insertar(); if (Program.oPersistencia.IsError == false) { MessageBox.Show(this, "Consulta generada correctamente", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.Close(); } }
private void tobEjecutarConsulta_Click(object sender, EventArgs e) { oCCategoriasEmpleado.Descripcion = TxtDescripcion.Text.Trim(); Metodos_Globales.LlenarGrid(Grid1, oCCategoriasEmpleado.ConsultarConParametros()); if (Grid1.Rows.Count > 0) { Metodos_Globales.ModoBloqueo(toolStrip1, Grid1); Metodos_Globales.EjecutaPermisos(tobNuevo, tobModificar, tobEliminar, oArregloPermisos); if (tobModificar.Enabled == true || tobEliminar.Enabled == true) { if (tobModificar.Enabled == true) { tobModificar.Enabled = true; } else { tobModificar.Enabled = false; } if (tobEliminar.Enabled == true) { tobEliminar.Enabled = true; } else { tobEliminar.Enabled = false; } } tobCancelarConsulta.Enabled = true; } else { MessageBox.Show(this, "No se encontraron resultados con los parámetros descritos", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); tobIniciarConsulta.Enabled = true; tobEjecutarConsulta.Enabled = false; } }
private void ModoModificar() { tobNuevo.Enabled = false; tobModificar.Enabled = false; tobGuardar.Enabled = true; tobCancelar.Enabled = true; tobSalir.Enabled = true; cmbRol.Enabled = false; LstOrigen.Enabled = true; LstDestino.Enabled = true; BtnAgregaTodo.Enabled = true; BtnAgregaUno.Enabled = true; BtnQuitaTodo.Enabled = true; BtnQuitaUno.Enabled = true; Metodos_Globales.BloqueaTeclasRapidas(toolStrip1, menuStrip1); }
private void tobModificar_Click(object sender, EventArgs e) { if (lstGabinete.SelectedItems.Count > 0) { nuevo = false; modificar = true; Metodos_Globales.DesbloquearCampos(this); Metodos_Globales.EstableceFoco(TxtDescripcion); Metodos_Globales.ModoModificar(toolStrip1); tobGuardarCategoria.Enabled = true; lstGabinete.Enabled = false; Metodos_Globales.BloqueaTeclasRapidas(toolStrip1, menuStrip1); } else { MessageBox.Show(this, "Debe de seleccionar el examen deseado de la lista disponible para poder modificar sus valores.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btnGuardarFormato_Click(object sender, EventArgs e) { File.Delete(Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\UserInfo") + "\\Recetas.Xml"); oXMLCreator.CreateXMLDocument(Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\UserInfo") + "\\Recetas.Xml", "Formato"); oXMLCreator.AddChildNodes("nomClinica", nomClinica.Name.Trim() + "|" + nomClinica.Size.ToString().Trim() + "|" + nomClinica.Style.ToString().Trim() + "|" + txtXNomClinica.Value.ToString() + "|" + txtYNombreClinica.Value.ToString()); oXMLCreator.AddChildNodes("especialidad", especialidad.Name.Trim() + "|" + especialidad.Size.ToString().Trim() + "|" + especialidad.Style.ToString().Trim() + "|" + txtXEspecialidad.Value.ToString() + "|" + txtYEspecialidad.Value.ToString()); oXMLCreator.AddChildNodes("serviciosOfrecidos", serviciosOfrecidos.Name.Trim() + "|" + serviciosOfrecidos.Size.ToString().Trim() + "|" + serviciosOfrecidos.Style.ToString().Trim() + "|" + txtXServiciosOfrecidos.Value.ToString() + "|" + txtYServiciosOfrecidos.Value.ToString()); oXMLCreator.AddChildNodes("telefono", telefono.Name.Trim() + "|" + telefono.Size.ToString().Trim() + "|" + telefono.Style.ToString().Trim() + "|" + txtXTelefono.Value.ToString() + "|" + txtYTelefono.Value.ToString()); oXMLCreator.AddChildNodes("email", email.Name.Trim() + "|" + email.Size.ToString().Trim() + "|" + email.Style.ToString().Trim() + "|" + txtXEmail.Value.ToString() + "|" + txtYEmail.Value.ToString()); oXMLCreator.AddChildNodes("direccion", direccion.Name.Trim() + "|" + direccion.Size.ToString().Trim() + "|" + direccion.Style.ToString().Trim() + "|" + txtXDireccion.Value.ToString() + "|" + txtYDireccion.Value.ToString()); oXMLCreator.AddChildNodes("nombrePaciente", nombrePaciente.Name.Trim() + "|" + nombrePaciente.Size.ToString().Trim() + "|" + nombrePaciente.Style.ToString().Trim() + "|" + txtXNomPaciente.Value.ToString() + "|" + txtYNombrePaciente.Value.ToString()); oXMLCreator.AddChildNodes("cedula", cedula.Name.Trim() + "|" + cedula.Size.ToString().Trim() + "|" + cedula.Style.ToString().Trim() + "|" + txtXCedula.Value.ToString() + "|" + txtYCedula.Value.ToString()); oXMLCreator.AddChildNodes("edad", edad.Name.Trim() + "|" + edad.Size.ToString().Trim() + "|" + edad.Style.ToString().Trim() + "|" + txtXEdad.Value.ToString() + "|" + txtYEdad.Value.ToString()); oXMLCreator.AddChildNodes("peso", peso.Name.Trim() + "|" + peso.Size.ToString().Trim() + "|" + peso.Style.ToString().Trim() + "|" + txtXPeso.Value.ToString() + "|" + txtYPeso.Value.ToString()); oXMLCreator.AddChildNodes("telefonos", telefonos.Name.Trim() + "|" + telefonos.Size.ToString().Trim() + "|" + telefonos.Style.ToString().Trim() + "|" + txtXTelefonosPaciente.Value.ToString() + "|" + txtYTelefonosPaciente.Value.ToString()); oXMLCreator.AddChildNodes("rx", rx.Name.Trim() + "|" + rx.Size.ToString().Trim() + "|" + rx.Style.ToString().Trim() + "|" + txtXRx.Value.ToString() + "|" + txtYRx.Value.ToString()); oXMLCreator.AddChildNodes("firma", firma.Name.Trim() + "|" + firma.Size.ToString().Trim() + "|" + firma.Style.ToString().Trim() + "|" + txtXFirma.Value.ToString() + "|" + txtYFirma.Value.ToString()); oXMLCreator.AddChildNodes("print", txtAdobeExePath.Text.Trim() + "|" + comboBox1.Text.Trim()); }
private void btnAdobeReader_Click(object sender, EventArgs e) { 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 { 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; } if (pdfRenderer != null) { pdfRenderer.PdfDocument.Save(completeFileName); Process.Start(completeFileName); } else { btnGenerarArchivo_Click(sender, e); if (pdfRenderer != null) { pdfRenderer.PdfDocument.Save(completeFileName); Process.Start(completeFileName); } else { MessageBox.Show(this, "El archivo debe previsualizarse primero antes de ser mostrado en Adobe Reader", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private void tobModificar_Click(object sender, EventArgs e) { if (Grid1.SelectedRows.Count > 0) { if (TxtDescripcion.Text.Trim() == "Médico") { MessageBox.Show(this, "Esta categoría es crucial para el funcionamiento del sistema por lo que no podrá ser eliminada o modificada", "No se pueden eliminar o modificar los datos", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } nuevo = false; modificar = true; Metodos_Globales.DesbloquearCampos(this); Metodos_Globales.EstableceFoco(TxtDescripcion); Metodos_Globales.ModoModificar(toolStrip1); Metodos_Globales.BloqueaTeclasRapidas(toolStrip1, menuStrip1); } else { MessageBox.Show(this, "Primero debe seleccionar la fila que contenga los valores deseados para realizar estas acciones", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void tobCancelar_Click(object sender, EventArgs e) { Metodos_Globales.LlenarGrid(Grid1, oCTiposContacto.ConsultarSinParametros()); Metodos_Globales.ModoBloqueo(toolStrip1, Grid1); Metodos_Globales.EjecutaPermisos(tobNuevo, tobModificar, tobEliminar, oArregloPermisos); if (tobModificar.Enabled == true || tobEliminar.Enabled == true) { if (Grid1.Rows.Count > 0) { if (tobModificar.Enabled == true) { tobModificar.Enabled = true; } else { tobModificar.Enabled = false; } if (tobEliminar.Enabled == true) { tobEliminar.Enabled = true; } else { tobEliminar.Enabled = false; } } } Metodos_Globales.LimpiaCampos(this); Metodos_Globales.BloquearCampos(this); Metodos_Globales.BloqueaTeclasRapidas(toolStrip1, menuStrip1); toolStripStatusLabel2.Text = ""; }
private void btnMSWord_Click(object sender, EventArgs e) { string path = Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\TempFiles"); string completeFileName = ""; try { string fileName = "\\TempFile_Epicrisis.rtf"; 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; } RtfDocumentRenderer rtf = new RtfDocumentRenderer(); rtf.Render(this.pdfViewer1.Document, completeFileName.Trim(), null); Process.Start(completeFileName.Trim()); }
private Document DocumentoEpicrisisGabinete() { Document document = new Document(); if (TxtNumExpediente.Text.Trim() != "") { if (lstConsultasPaciente.Items.Count > 0) { if (oCEmpresa.LeeDatosEmpresa() == true && oCPacientes.LeeDatosPaciente(TxtNumExpediente.Text.Trim()) == true) { Section section = document.AddSection(); #region Encabezado (Fecha, Título, Datos Personales y Detalle Opcional) Table tableHeader = document.LastSection.AddTable(); tableHeader.Borders.Visible = true; tableHeader.Borders.Width = 0; Column columnHeader = tableHeader.AddColumn("8cm"); columnHeader.Format.Alignment = ParagraphAlignment.Right; columnHeader = tableHeader.AddColumn("8cm"); columnHeader.Format.Alignment = ParagraphAlignment.Center; Row rowHeader = tableHeader.AddRow(); tableHeader.AddRow(); tableHeader.AddRow(); tableHeader.AddRow(); #region Fecha Paragraph oParagraphDate = rowHeader.Cells[0].AddParagraph(DateTime.Now.Date.ToLongDateString()); oParagraphDate.Format.Font = new MigraDoc.DocumentObjectModel.Font("Arial", 10); rowHeader.Cells[0].MergeRight = 1; #endregion #region Título rowHeader = tableHeader.AddRow(); rowHeader.Cells[0].MergeRight = 1; Paragraph oParagraphTitle = rowHeader.Cells[0].AddParagraph("Epicrisis"); oParagraphTitle.Format.Alignment = ParagraphAlignment.Center; oParagraphTitle.Format.Font = new MigraDoc.DocumentObjectModel.Font("Arial", 26); #endregion tableHeader.AddRow(); tableHeader.AddRow(); tableHeader.AddRow(); #region Datos Personales (Nombre y Cédula) rowHeader = tableHeader.AddRow(); Paragraph oParagraphNombre = rowHeader.Cells[0].AddParagraph(); FormattedText oFormattedTextNombre = oParagraphNombre.AddFormattedText("Nombre: "); oFormattedTextNombre.Bold = true; oFormattedTextNombre.Font.Name = "Segoe UI"; oFormattedTextNombre.Font.Size = 11; oParagraphNombre.Format.Font = new MigraDoc.DocumentObjectModel.Font("Arial", 9); oParagraphNombre.AddText(oCPacientes.Nombre.Trim() + " " + oCPacientes.Apellidos.Trim()); oParagraphNombre.Format.Alignment = ParagraphAlignment.Left; Paragraph oParagraphCedula = rowHeader.Cells[1].AddParagraph(); FormattedText oFormattedTextCedula = oParagraphCedula.AddFormattedText("Cédula: "); oFormattedTextCedula.Bold = true; oFormattedTextCedula.Font.Name = "Segoe UI"; oFormattedTextCedula.Font.Size = 11; oParagraphCedula.Format.Font = new MigraDoc.DocumentObjectModel.Font("Arial", 9); oParagraphCedula.AddText(oCPacientes.Cedula); oParagraphCedula.Format.Alignment = ParagraphAlignment.Left; #endregion tableHeader.AddRow(); tableHeader.AddRow(); #region Detalle Opcional rowHeader = tableHeader.AddRow(); rowHeader.Cells[0].MergeRight = 1; Paragraph oParagraphDetalleOpcional = rowHeader.Cells[0].AddParagraph(); FormattedText oFormattedDetalleOpcional = oParagraphDetalleOpcional.AddFormattedText(textBox1.Text.Trim()); oFormattedDetalleOpcional.Font.Name = "Arial"; oFormattedDetalleOpcional.Font.Size = 10; oParagraphDetalleOpcional.Format.Alignment = ParagraphAlignment.Left; #endregion tableHeader.AddRow(); tableHeader.AddRow(); tableHeader.AddRow(); #endregion #region Tabla de Datos de Consultas if (rdNoIncluirDetallesConsultas.Checked == false) { Table tableData = document.LastSection.AddTable(); tableData.Borders.Visible = true; tableData.Borders.Width = 0.74; tableData.Borders.Color = new MigraDoc.DocumentObjectModel.Color(192, 80, 77); Column columnData = tableData.AddColumn("2.8cm"); columnData.Format.Alignment = ParagraphAlignment.Center; columnData = tableData.AddColumn("3.5cm"); columnData.Format.Alignment = ParagraphAlignment.Center; columnData = tableData.AddColumn("3.5cm"); columnData.Format.Alignment = ParagraphAlignment.Center; columnData = tableData.AddColumn("3.7cm"); columnData.Format.Alignment = ParagraphAlignment.Center; columnData = tableData.AddColumn("3.7cm"); columnData.Format.Alignment = ParagraphAlignment.Center; Row rowData = tableData.AddRow(); rowData.Borders.Top.Clear(); rowData.Borders.Left.Clear(); rowData.Borders.Right.Clear(); rowData.Borders.Bottom.Width = Unit.FromMillimeter(1); Paragraph oParagraphDataHeader = new Paragraph(); //oParagraphDataHeader = rowData.Cells[0].AddParagraph("Fecha de Consulta"); //oParagraphDataHeader.Format.Font = new MigraDoc.DocumentObjectModel.Font("Times New Roman", 13); //oParagraphDataHeader.Format.Font.Bold = true; oParagraphDataHeader = rowData.Cells[0].AddParagraph("Detalle de la Consulta"); oParagraphDataHeader.Format.Font = new MigraDoc.DocumentObjectModel.Font("Times New Roman", 13); oParagraphDataHeader.Format.Font.Bold = true; oParagraphDataHeader = rowData.Cells[1].AddParagraph("Diagnóstico"); oParagraphDataHeader.Format.Font = new MigraDoc.DocumentObjectModel.Font("Times New Roman", 13); oParagraphDataHeader.Format.Font.Bold = true; oParagraphDataHeader = rowData.Cells[2].AddParagraph("Tratamiento"); oParagraphDataHeader.Format.Font = new MigraDoc.DocumentObjectModel.Font("Times New Roman", 13); oParagraphDataHeader.Format.Font.Bold = true; oParagraphDataHeader = rowData.Cells[3].AddParagraph("Exámenes Prescritos"); oParagraphDataHeader.Format.Font = new MigraDoc.DocumentObjectModel.Font("Times New Roman", 13); oParagraphDataHeader.Format.Font.Bold = true; oParagraphDataHeader = rowData.Cells[4].AddParagraph("Gabinete"); oParagraphDataHeader.Format.Font = new MigraDoc.DocumentObjectModel.Font("Times New Roman", 13); oParagraphDataHeader.Format.Font.Bold = true; Paragraph oParagraphData = new Paragraph(); ArrayList oArregloDetallesConsultaEpicrisis = new ArrayList(); int alternateColor = 0; bool continuar = false; foreach (ListViewItem oItem in lstConsultasPaciente.Items) { if (rdTodas.Checked == true) { continuar = true; } else if (rdSeleccionar.Checked == true) { if (oItem.Checked == true) { continuar = true; } else { continuar = false; } } if (continuar == true) { oArregloDetallesConsultaEpicrisis = oCConsultas.DetallesConsultaEpicrisis(oItem.SubItems[1].Text.Trim()); rowData = tableData.AddRow(); //if (alternateColor == 0) // rowData.Shading.Color = new MigraDoc.DocumentObjectModel.Color(239, 211, 210); //else rowData.Shading.Color = Colors.White; string consultaHeader = Convert.ToDateTime(oItem.SubItems[3].Text).ToShortDateString(); oParagraphData = rowData.Cells[0].AddParagraph(consultaHeader); oParagraphData.Format.Font = new MigraDoc.DocumentObjectModel.Font("Times New Roman", 12); oParagraphData.Format.Font.Bold = true; oParagraphData.Format.Font.Color = new MigraDoc.DocumentObjectModel.Color(36, 64, 97); oParagraphData.Format.Alignment = ParagraphAlignment.Left; rowData.Cells[0].Shading.Color = Colors.White; oParagraphData = rowData.Cells[0].AddParagraph(""); oParagraphData = rowData.Cells[0].AddParagraph(oArregloDetallesConsultaEpicrisis[0].ToString().Trim()); oParagraphData.Format.Font.Bold = false; oParagraphData.Format.Font = new MigraDoc.DocumentObjectModel.Font("Arial", 8); oParagraphData.Format.Alignment = ParagraphAlignment.Left; string oTratamiento = oArregloDetallesConsultaEpicrisis[1].ToString().Trim(); int c = 0; while (oTratamiento.Contains("{") || oTratamiento.Contains("}")) { if (c == 0) { oTratamiento = Metodos_Globales.CortaSeccionDeTexto(oTratamiento, "{", "}", ""); } else { oTratamiento = Metodos_Globales.CortaSeccionDeTexto(oTratamiento, "{", "}", ", "); } c++; } oParagraphData = rowData.Cells[1].AddParagraph(oTratamiento.Trim()); oParagraphData.Format.Font.Bold = false; oParagraphData.Format.Font = new MigraDoc.DocumentObjectModel.Font("Arial", 8); oParagraphData.Format.Alignment = ParagraphAlignment.Left; oParagraphData = rowData.Cells[2].AddParagraph(oArregloDetallesConsultaEpicrisis[2].ToString().Trim()); oParagraphData.Format.Font.Bold = false; oParagraphData.Format.Font = new MigraDoc.DocumentObjectModel.Font("Arial", 8); oParagraphData.Format.Alignment = ParagraphAlignment.Left; string detalleExamen = ""; DataSet ds = oCExamenesConsulta.ConsultarSinParametros(oItem.SubItems[1].Text.Trim()); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { if (Convert.ToBoolean(dr[3]) == true) { detalleExamen = "• " + oCExamenesConsulta.NombreExamen(dr[0].ToString().Trim()) + "(" + dr[5].ToString().Trim() + ")."; } else { detalleExamen = "• " + oCExamenesConsulta.NombreExamen(dr[0].ToString().Trim()) + "(\"Pendiente de resultados\")."; } oParagraphData = rowData.Cells[3].AddParagraph(detalleExamen.Trim()); oParagraphData.Format.Font.Bold = false; oParagraphData.Format.Font = new MigraDoc.DocumentObjectModel.Font("Arial", 8); oParagraphData.Format.Alignment = ParagraphAlignment.Left; oParagraphData.AddLineBreak(); } } ds.Dispose(); } string gabinete = ""; DataSet ds1 = oCGabineteConsulta.ConsultarSinParametros(oItem.SubItems[1].Text.Trim()); if (ds1 != null) { if (ds1.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds1.Tables[0].Rows) { if (Convert.ToBoolean(dr[3]) == true) { gabinete = "• " + oCGabineteConsulta.NombreGabinete(dr[0].ToString().Trim()) + "(" + dr[5].ToString().Trim() + ")."; } else { gabinete = "• " + oCGabineteConsulta.NombreGabinete(dr[0].ToString().Trim()) + "(\"Pendiente de resultados\")."; } oParagraphData = rowData.Cells[4].AddParagraph(gabinete.Trim()); oParagraphData.Format.Font.Bold = false; oParagraphData.Format.Font = new MigraDoc.DocumentObjectModel.Font("Arial", 8); oParagraphData.Format.Alignment = ParagraphAlignment.Left; oParagraphData.AddLineBreak(); } } ds1.Dispose(); } if (alternateColor == 0) { alternateColor = 1; } else { alternateColor = 0; } rowData.Borders.Top.Clear(); rowData.Borders.Left.Clear(); //rowData.Borders.Bottom.Clear(); } } } #endregion #region Agrega Footer Section section2 = document.LastSection; section2.PageSetup.OddAndEvenPagesHeaderFooter = false; HeaderFooter footer = new HeaderFooter(); Paragraph paraFooter = new Paragraph(); MigraDoc.DocumentObjectModel.Font ofont = new MigraDoc.DocumentObjectModel.Font("Arial", 8); paraFooter.AddLineBreak(); ofont.Color = Colors.Black; string nombreEmp = oCEmpleados.ObtieneNombreEmpleado(Program.oIdUsuario); string codEmpleado = oCEmpleados.ObtieneCodigoColegiado(Program.oIdUsuario); string footerText = "________________________________" + Environment.NewLine + nombreEmp.Trim() + Environment.NewLine + "Cód. " + codEmpleado.Trim(); paraFooter.AddFormattedText(footerText, ofont); paraFooter.Format.Alignment = ParagraphAlignment.Right; footer.Add(paraFooter); //section2.Footers.Primary = footer; document.LastSection.Footers.Primary = footer; #endregion #region Crea el documento pdfRenderer = new PdfDocumentRenderer(false, PdfFontEmbedding.Always); pdfRenderer.Document = document; pdfRenderer.RenderDocument(); #endregion } } } oDocument = document; return(document); }
public void ExportarPDF(string pNombrePaciente, string pCedula, string pEdad, string pPeso, string pTelefonos, string pNombreDoctor, string pCodigoDoctor, string[] pItemsReceta, bool pPrint) { #region Variables Privadas PdfDocument document = new PdfDocument(); document.Info.Title = Program.oCEmpresa.NombreEmpresa; //// Create an empty page PdfPage page = document.AddPage(); gfx = XGraphics.FromPdfPage(page); string completeFileName = ""; double x = 50, auxX = 0, y = 135; string categoria = ""; char[] caracterBuscado = { ' ' }; string[] ocadenaTemp = null; string fileName = ""; #region Fonts //Título //XFont nomClinica = FormatoPDF.FontName(txtFuenteNombreClinica.te; xNomClinica = oXFont(nomClinica); xEspecialidad = oXFont(especialidad); xServiciosOfrecidos = oXFont(serviciosOfrecidos); xTelefono = oXFont(telefono); xEmail = oXFont(email); xDireccion = oXFont(direccion); xNombrePaciente = oXFont(nombrePaciente); xCedula = oXFont(cedula); xEdad = oXFont(edad); xPeso = oXFont(peso); xTelefonos = oXFont(telefonos); xRx = oXFont(rx); xFirma = oXFont(firma); #endregion //double nextLine = arialBlack.GetHeight(gfx); //double nextLine2 = arial.GetHeight(gfx); #endregion try { fileName = "\\TempFile_Prescription.pdf"; completeFileName = Metodos_Globales.crearCarpetaAppdata("\\SoftNet G-Clinic\\TempFiles") + 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; } gfx.DrawString(Program.oCEmpresa.NombreEmpresa.Trim(), xNomClinica, XBrushes.Black, Convert.ToDouble(txtXNomClinica.Value), Convert.ToDouble(txtYNombreClinica.Value)); gfx.DrawString(DateTime.Now.ToLongDateString(), xNormalFont, XBrushes.Black, 365, Convert.ToDouble(txtYNombreClinica.Value)); gfx.DrawString(Program.oCEmpresa.Especialidad.Trim(), xEspecialidad, XBrushes.Black, Convert.ToDouble(txtXEspecialidad.Value), Convert.ToDouble(txtYEspecialidad.Value)); gfx.DrawString(Program.oCEmpresa.ServiciosOfrecidos.Trim(), xServiciosOfrecidos, XBrushes.Black, Convert.ToDouble(txtXServiciosOfrecidos.Value), Convert.ToDouble(txtYServiciosOfrecidos.Value)); gfx.DrawString(Program.oCEmpresa.Telefono.Trim(), xTelefono, XBrushes.Black, Convert.ToDouble(txtXTelefono.Value), Convert.ToDouble(txtYTelefono.Value)); gfx.DrawString(Program.oCEmpresa.Email.Trim(), xEmail, XBrushes.Black, Convert.ToDouble(txtXEmail.Value), Convert.ToDouble(txtYEmail.Value)); gfx.DrawString(Program.oCEmpresa.Direccion.Trim(), xDireccion, XBrushes.Black, Convert.ToDouble(txtXDireccion.Value), Convert.ToDouble(txtYDireccion.Value)); gfx.DrawString("Nombre del Paciente: ", xNombrePaciente, XBrushes.Black, Convert.ToDouble(txtXNomPaciente.Value), Convert.ToDouble(txtYNombrePaciente.Value)); gfx.DrawString("Cédula: ", xCedula, XBrushes.Black, Convert.ToDouble(txtXCedula.Value), Convert.ToDouble(txtYCedula.Value)); gfx.DrawString("Edad: ", xEdad, XBrushes.Black, Convert.ToDouble(txtXEdad.Value), Convert.ToDouble(txtYEdad.Value)); gfx.DrawString("Peso: ", xPeso, XBrushes.Black, Convert.ToDouble(txtXPeso.Value), Convert.ToDouble(txtYPeso.Value)); gfx.DrawString("Teléfonos: ", xTelefonos, XBrushes.Black, Convert.ToDouble(txtXTelefonosPaciente.Value), Convert.ToDouble(txtYTelefonosPaciente.Value)); gfx.DrawString(pNombrePaciente, xNormalFont, XBrushes.Black, TextSize("Nombre del Paciente: ", xNombrePaciente).Width + Convert.ToDouble(txtXNomPaciente.Value) + 6, Convert.ToDouble(txtYNombrePaciente.Value)); gfx.DrawString(pCedula.Trim(), xNormalFont, XBrushes.Black, TextSize("Cédula: ", xCedula).Width + Convert.ToDouble(txtXCedula.Value) + 10, Convert.ToDouble(txtYCedula.Value)); gfx.DrawString(pEdad.Trim(), xNormalFont, XBrushes.Black, TextSize("Edad: ", xEdad).Width + Convert.ToDouble(txtXEdad.Value) + 10, Convert.ToDouble(txtYEdad.Value)); gfx.DrawString(pPeso.Trim(), xNormalFont, XBrushes.Black, TextSize("Peso: ", xPeso).Width + Convert.ToDouble(txtXPeso.Value) + 10, Convert.ToDouble(txtYPeso.Value)); gfx.DrawString(pTelefonos.Trim(), xNormalFont, XBrushes.Black, TextSize("Teléfonos: ", xTelefono).Width + Convert.ToDouble(txtXTelefonosPaciente.Value) + 10, Convert.ToDouble(txtYTelefonosPaciente.Value)); gfx.DrawString("Rx: ", xRx, XBrushes.Black, Convert.ToDouble(txtXRx.Value), Convert.ToDouble(txtYRx.Value)); if (pItemsReceta != null) { double auxY = Convert.ToDouble(txtYRx.Value); for (int i = 0; i < pItemsReceta.Length;) { gfx.DrawString(pItemsReceta[i].Trim(), xItemsReceta, XBrushes.Black, TextSize("Rx: ", xRx).Width + Convert.ToDouble(txtXRx.Value) + 10, auxY); auxY += 12; i++; } } gfx.DrawString("____________________", xFirma, XBrushes.Black, Convert.ToDouble(txtXFirma.Value), Convert.ToDouble(txtYFirma.Value)); gfx.DrawString(pNombreDoctor, xFirma, XBrushes.Black, Convert.ToDouble(txtXFirma.Value), Convert.ToDouble(txtYFirma.Value + 15)); gfx.DrawString(pCodigoDoctor, xFirma, XBrushes.Black, Convert.ToDouble(txtXFirma.Value), Convert.ToDouble(txtYFirma.Value + 27)); document.ViewerPreferences.FitWindow = true; #region Crea archivo temporal y da opción de guardar archivo en carpeta de preferencia //Salvamos el documento en la carpeta de archivos temporales... document.Save(completeFileName); #region Guarda Copia de Archivo Temporal - INACTIVO //try //{ // SaveFileDialog oSaveFileDialog = new SaveFileDialog(); // oSaveFileDialog.Filter = "PDF File|*.pdf"; // oSaveFileDialog.Title = "Guardar copia de Hoja de Reparación"; // if (oSaveFileDialog.ShowDialog() == DialogResult.OK) // { // string newDestiny = ""; // if (!oSaveFileDialog.FileName.Contains(".pdf")) // newDestiny = oSaveFileDialog.FileName.Trim() + ".pdf"; // else // newDestiny = oSaveFileDialog.FileName.Trim(); // File.Copy(completeFileName, newDestiny); // completeFileName = newDestiny; // } //} //catch { } #endregion #endregion //Inicia el proceso, es decir, abre el archivo, si no se guardó el archivo recién generado en otra ubicación //se abrirá el archivo Temporal //Process oProcess = Process.Start(completeFileName); if (pPrint == true) { this.Print(); } //System.Threading.Thread.Sleep(5000); //oProcess.CloseMainWindow(); //oProcess.Close(); #region Liberamos Recursos gfx.Dispose(); document.Dispose(); #endregion }
public void LlenaComboMetodosAnticonceptivos() { cmbMetodoAnticonceptivo.DataSource = null; Metodos_Globales.LlenarCombo(cmbMetodoAnticonceptivo, "Sp_S_Metodos_Anticonceptivos", "Metodos_Anticonceptivos", "id_metodo", "descripcion"); }