public ResultadoEnvioEmail EnviarEmail(string otrosDestinatarios)
        {
            _otrosDestinatarios        = otrosDestinatarios;
            resultadoEnvioNotificacion = ResultadoEnvioEmail.NoEnviado;
            BindingList <Persona> notificados = _regFalla.GetAgentesNotificados();

            agentesNotificar = _agentesInvolucrados;
            if (notificados.Count > 0)
            {
                BindingList <Persona> sinNotificar        = _regFalla.GetAgentesSinNotificar();
                FormAgentesNotificar  frmAgentesNotificar = new FormAgentesNotificar();
                agentesNotificar = frmAgentesNotificar.Visualizar(notificados, sinNotificar);
                if (agentesNotificar == null)
                {
                    return(ResultadoEnvioEmail.EnvioCanceladoPorUs);
                }
            }
            FormEnvioNotif fEnvioNotif = new FormEnvioNotif();
            P_GF_Correos   encabezado  = ModeloMgr.Instancia.P_GF_CorreosMgr.Get(1, D_COD_SECC_CORREO.ENCABEZADO);
            P_GF_Correos   cuerpo      = ModeloMgr.Instancia.P_GF_CorreosMgr.Get(1, D_COD_SECC_CORREO.CUERPO);

            _encabezado = encabezado.Texto.Replace("#NN_FALLA#", RegFalla.FormatearCodFalla(_regFalla.CodFalla.ToString()));
            _cuerpo     = cuerpo.Texto.Replace("#NN_FALLA#", RegFalla.FormatearCodFalla(_regFalla.CodFalla.ToString()));

            if (fEnvioNotif.Visualizar(_encabezado, _cuerpo) == DialogResult.OK)
            {
                PistaMgr.Instance.Info("Sisfalla  ", "Envio ");
                _encabezado = fEnvioNotif.Asunto;
                _cuerpo     = fEnvioNotif.Cuerpo;
                FormTareaAsincrona f = new FormTareaAsincrona();
                PistaMgr.Instance.Info("Envío Notificación de Falla", "Enviando Notificación...");
                f.Visualizar("Envío Notificación de Falla", "Enviando Notificación...", EnviarNotificacion);

                if (resultadoEnvioNotificacion != ResultadoEnvioEmail.NoEnviado)
                {
                    GuardarNotificaciones(D_COD_ESTADO_NOTIFICACION.ENVIADO);
                    RegistrarOperaciones(agentesNotificar);
                }
            }
            else
            {
                resultadoEnvioNotificacion = ResultadoEnvioEmail.EnvioCanceladoPorUs;
            }

            return(resultadoEnvioNotificacion);
        }
Beispiel #2
0
        private void _btnDecargar_Click(object sender, EventArgs e)
        {
            if (CNDC.Sincronizacion.SincronizadorCliente.Instancia.PingHost())
            {
                int _pkCodFallaSeleccionadoInicio = (int)_cmbRegistrosFallaInicio.SelectedValue;
                int _pkCodFallaSeleccionadoFin    = (int)_cmbRegistrosFallaFin.SelectedValue;

                for (_pkCodFalla = _pkCodFallaSeleccionadoInicio; _pkCodFalla <= _pkCodFallaSeleccionadoFin; _pkCodFalla++)
                {
                    FormTareaAsincrona tarea = new FormTareaAsincrona();
                    tarea.Visualizar("Descargando Informes de Falla", "Descargando...", DescargarInformes);
                }


                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("No hay conexion con la vpn.", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
        }
 private void _btnDecargar_Click(object sender, EventArgs e)
 {
     if (CNDC.Sincronizacion.SincronizadorCliente.Instancia.PingHost())
     {
         if (_chlbxAgentes.Items.Count == 0)
         {
             MessageBox.Show("No hay items seleccionados.");
         }
         else
         {
             FormTareaAsincrona tarea = new FormTareaAsincrona();
             tarea.Visualizar("Descargando Informes de Falla", "Descargando...", DescargarInformes);
         }
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
         this.Close();
     }
     else
     {
         MessageBox.Show("No hay conexion con la vpn.", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
         this.Close();
     }
 }
Beispiel #4
0
        public override void Ejecutar()
        {
            InformeFalla infFalla = _frmInfFalla.InfFalla;

            if (!_frmInfFalla.TabActualValido())
            {
                MessageBox.Show(MessageMgr.Instance.GetMessage("HAY_ERRORES_EN_INF"));
                return;
            }

            if (!BaseForm.EstaSeguro(MessageMgr.Instance.GetMessage("SEGURO_DE_ENVIAR_INF")))
            {
                return;
            }

            infFalla.CodEstadoInf = (long)D_COD_ESTADO_INF.ENVIADO;
            infFalla.PonerFechaHora();
            if (!_frmInfFalla.Guardar())
            {
                return;
            }

            FormTareaAsincrona f = new FormTareaAsincrona();

            f.Visualizar("Envío Informe de Falla", "Enviando Informe...", EnviarInforme);
            bool   enviarManualmente = false;
            string mensaje1          = string.Empty;
            string mensaje2          = string.Empty;

            switch (_resultadoEnvioInforme)
            {
            case ResultadoEnvioEmail.Enviado:
                mensaje2 = MessageMgr.Instance.GetMessage("ENVIO_POR_EMAIL_SI");
                break;

            case ResultadoEnvioEmail.EnviadoConError:
            case ResultadoEnvioEmail.NoEnviado:
                mensaje2          = MessageMgr.Instance.GetMessage("ENVIO_POR_EMAIL_NO");
                enviarManualmente = true;
                break;
            }

            string msg = string.Empty;

            if (Sesion.Instancia.RolSIN == "CNDC")
            {
                msg = mensaje2;
            }
            else
            {
                if (_datosEnviadosAlServidor)
                {
                    mensaje1 = MessageMgr.Instance.GetMessage("ENVIO_POR_WCF_SI");
                }
                else
                {
                    mensaje1 = MessageMgr.Instance.GetMessage("ENVIO_POR_WCF_NO");
                }
                msg = string.Format("- {0}{1}- {2}", mensaje1, Environment.NewLine, mensaje2);
            }

            MessageBox.Show(msg, "Envío Informe", MessageBoxButtons.OK);

            if (enviarManualmente)
            {
                SaveFileDialog dialog = new SaveFileDialog();
                dialog.Title    = MessageMgr.Instance.GetMessage("EXPORTAR_INF");
                dialog.Filter   = "Archivos Sisfalla|*.gz|Todos Archivos|*.*";
                dialog.FileName = "INFORMEFALLA_" + RegFalla.FormatearCodFalla(infFalla.PkCodFalla.ToString()) + "_" + CNDC.BLL.Sesion.Instancia.EmpresaActual.Sigla + "_" + InformeFalla.GetTexto(infFalla.PkDCodTipoinforme) + ".xml";

                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string      archivo = dialog.FileName;
                    Exportardor imp     = new Exportardor();
                    imp.ExportarInformeFallaExistente(_dSetInforme, archivo);
                    MessageBox.Show("Guardado satisfactoriamente, el archivo : " + new FileInfo(archivo).Name + ".gz");
                }
            }
            _frmInfFalla.CerrarOK();
        }
        private void _btnEnviarInforme_Click(object sender, EventArgs e)
        {
            _infFalla.CodEstadoInf = (long)D_COD_ESTADO_INF.ENVIADO;
            if (Sesion.Instancia.FechaHoraServidor == null)
            {
                _infFalla.FecRegistro = Sesion.Instancia.Conexion.GetFechaHora();
            }
            else
            {
                _infFalla.FecRegistro = Sesion.Instancia.FechaHoraServidor.Value;
            }
            Guardar();
            FormTareaAsincrona f = new FormTareaAsincrona();

            f.Visualizar("Envío Informe de Falla", "Enviando Informe...", EnviarInforme);
            bool   enviarManualmente = false;
            string mensaje1          = string.Empty;
            string mensaje2          = string.Empty;

            switch (_resultadoEnvioInforme)
            {
            case ResultadoEnvioEmail.Enviado:
                mensaje2 = "Envío de datos vía Correo Electrónico: SI";
                break;

            case ResultadoEnvioEmail.EnviadoConError:
            case ResultadoEnvioEmail.NoEnviado:
                mensaje2          = "Envío de datos vía Correo Electrónico: CON ERRORES. Se recomienda enviarlos por otro medio. Se procedera a crear los archivos correspondientes.";
                enviarManualmente = true;
                break;
            }

            string msg = string.Empty;

            if (Sesion.Instancia.RolSIN == "CNDC")
            {
                msg = mensaje2;
            }
            else
            {
                if (_datosEnviadosAlServidor)
                {
                    mensaje1 = "Envío de datos vía Servicio CNDC: SI";
                }
                else
                {
                    mensaje1 = "Envío de datos vía Servicio CNDC: NO";
                }
                msg = string.Format("- {0}{1}- {2}", mensaje1, Environment.NewLine, mensaje2);
            }

            MessageBox.Show(msg, "Envío Informe", MessageBoxButtons.OK);

            if (enviarManualmente)
            {
                SaveFileDialog dialog = new SaveFileDialog();

                dialog.Title    = "Exportar Registro para envío por correo electrónico.";
                dialog.Filter   = "Archivos Sisfalla|*.gz|Todos Archivos|*.*";
                dialog.FileName = "INFORMEFALLA_" + RegFalla.FormatearCodFalla(_infFalla.PkCodFalla.ToString()) + "_" + CNDC.BLL.Sesion.Instancia.EmpresaActual.Sigla + "_" + InformeFalla.GetTexto(_infFalla.PkDCodTipoinforme) + ".xml";

                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string           archivo = dialog.FileName;
                    ExportarImportar imp     = new ExportarImportar(12, _dSetInforme, _infFalla);
                    imp.ExportarInformeFallaExistente(archivo);
                    MessageBox.Show("Guardado satisfactoriamente, el archivo : " + new FileInfo(archivo).Name + ".gz");
                }
            }
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }