Beispiel #1
0
        private void btnInforme_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                List <ReporteAccidenteBE> lstReporte = null;
                lstReporte = new ReporteAccidenteBL().ListadoResponsable(Convert.ToInt32(cboTipo.EditValue), Convert.ToInt32(cboEmpresa.EditValue), 0, 0, 0, Convert.ToDateTime(deFechaDesde.DateTime.ToShortDateString()), Convert.ToDateTime(deFechaHasta.DateTime.ToShortDateString()));

                if (lstReporte != null)
                {
                    if (lstReporte.Count > 0)
                    {
                        RptVistaReportes objRptAccidente = new RptVistaReportes();
                        objRptAccidente.VerRptAccidenteEmpresaResponsable(lstReporte, deFechaDesde.DateTime.ToShortDateString(), deFechaHasta.DateTime.ToShortDateString());
                        objRptAccidente.ShowDialog();
                    }
                    else
                    {
                        XtraMessageBox.Show("No hay información para el periodo seleccionado", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnInforme_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                List <ReporteAccidenteBE> lstReporte = null;
                lstReporte = new ReporteAccidenteBL().ListadoCantidadAnualEmpresaContratista(Convert.ToInt32(cboTipo.EditValue));

                if (lstReporte != null)
                {
                    if (lstReporte.Count > 0)
                    {
                        RptVistaReportes objRptAccidente = new RptVistaReportes();
                        objRptAccidente.VerRptAccidenteCantidadAnualEmpresaContratista(lstReporte);
                        objRptAccidente.ShowDialog();
                    }
                    else
                    {
                        XtraMessageBox.Show("No hay información para el periodo seleccionado", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #3
0
        private void EnviarCorreoAccionesCorrectivasVencidas()
        {
            try
            {
                List <ReporteAccidenteBE> mLista = null;
                mLista = new ReporteAccidenteBL().ListadoAccionCorrectivaVencida();

                if (mLista.Count > 0)
                {
                    var QueryDniResponsable =
                        from Cuotas in mLista
                        group Cuotas by Cuotas.DniResponsableAccionCorrectiva into newCuotas
                        orderby newCuotas.Key
                        select newCuotas;

                    foreach (var NumCap in QueryDniResponsable)
                    {
                        string    strMail      = "";
                        PersonaBE objE_Persona = null;
                        objE_Persona = new PersonaBL().SeleccionaNumeroDocumento(0, NumCap.Key);
                        if (objE_Persona != null)
                        {
                            strMail = objE_Persona.Email;
                        }

                        List <ReporteAccidenteBE> lstAccionCorrectivaVencidaResponsable = null;
                        lstAccionCorrectivaVencidaResponsable = new ReporteAccidenteBL().ListadoAccionCorrectivaVencidaResponsable(NumCap.Key);
                        if (lstAccionCorrectivaVencidaResponsable.Count > 0)
                        {
                            //GENERAR EL REPORTE EN PDF
                            rptAccidenteAccionCorrectivaVencida objReporte = new rptAccidenteAccionCorrectivaVencida();
                            objReporte.SetDataSource(lstAccionCorrectivaVencidaResponsable);
                            objReporte.ExportToDisk(ExportFormatType.PortableDocFormat, @"D:\AccionesCorrectivasVencidas_" + NumCap.Key + ".pdf");

                            StringBuilder strMensaje = new StringBuilder();
                            strMensaje.Append("**************************************************************************************************************************\n\n");
                            strMensaje.Append("Se adjunta las Acciones Correctivas Vencidas Pendientes " + "\n\n");
                            strMensaje.Append("Comunicarse con el Area de Seguridad y Salud en el Trabajo" + "\n\n");
                            strMensaje.Append("**************************************************************************************************************************\n\n");

                            string strMailTO = "";
                            strMailTO = strMail;

                            BSUtils.EmailSend(strMailTO, "Acciones Correctivas Vencidas de Accidentes/Incidentes", strMensaje.ToString(), @"D:\AccionesCorrectivasVencidas_" + NumCap.Key + ".pdf", "", "", "");
                        }
                    }

                    bEnviarCorreoAccionCorrectiva = false;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnInforme_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                if (intIdPersonaResponsable == 0)
                {
                    XtraMessageBox.Show("Debe seleccionar una persona", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    btnBuscar.Select();
                    Cursor = Cursors.Default;
                    return;
                }

                List <ReporteAccidenteBE> lstReporte = null;
                lstReporte = new ReporteAccidenteBL().ListadoResponsable(Convert.ToInt32(cboTipo.EditValue), intIdEmpresaResponsable, intIdUnidadMineraResponsable, intIdAreaResponsable, intIdPersonaResponsable, Convert.ToDateTime(deFechaDesde.DateTime.ToShortDateString()), Convert.ToDateTime(deFechaHasta.DateTime.ToShortDateString()));

                if (lstReporte != null)
                {
                    if (lstReporte.Count > 0)
                    {
                        RptVistaReportes objRptDocumentoVenta = new RptVistaReportes();
                        objRptDocumentoVenta.VerRptAccidenteResponsable(lstReporte, deFechaDesde.DateTime.ToShortDateString(), deFechaHasta.DateTime.ToShortDateString());
                        objRptDocumentoVenta.ShowDialog();
                    }
                    else
                    {
                        XtraMessageBox.Show("No hay información para el periodo seleccionado", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }