Example #1
0
 private void enviarNotificacion(string correo, string nombrePersona)
 {
     RGen.Utiles.RGenMailer mailSender = new RGen.Utiles.RGenMailer();
     try
     {
       mailSender.enviaMensaje(this.txtCorreo.Text, "Notificación de Asignación de Ajuste | fecha " + DateTime.Now.ToString(), "Sr. " + nombrePersona + " el administrador del Sistema Riesgos Generales le ha asignado el Ajuste N° " + GestorAjuste.dameNumeroAjuste(Convert.ToDecimal(Request.QueryString["AjusteId"])) + "<br /> se le agradecerá tome las medidas necesarias para atender el caso en la brevedad posible.");
     }
     catch (Exception ex)
     {
       LoggerFacade.Log(ex);
       Response.Redirect("vMuestraMensaje.aspx?mensaje=Error: " + Server.UrlEncode(ex.Message));
     }
 }
Example #2
0
    private void enviar()
    {
        if (archivo.Exists)
        {
            try
            {
                RGenMailer myMailer = new RGenMailer();
                ArrayList to = new ArrayList();
                string enviadoA = null;
                contactoAseguradora = GestorAjuste.dameContactoAseguradora(Convert.ToDecimal(ajusteId));
                contactoBroker = GestorAjuste.dameContactoBroker(Convert.ToDecimal(ajusteId));

                if (contactoAseguradora != null) enviadoA = contactoAseguradora.Nombre;
                if (contactoBroker != null) enviadoA += "," + contactoBroker.Nombre;

                if (this.txtPara.Text != "")
                {
                    odsActualizaEnvios.UpdateParameters.Add("ajusteId",TypeCode.Decimal,ajusteId.ToString());
                    odsActualizaEnvios.UpdateParameters.Add("informeId", TypeCode.Decimal, informeId.ToString());
                    odsActualizaEnvios.UpdateParameters.Add("enviadoA", TypeCode.String, enviadoA.ToString());
                    odsActualizaEnvios.Update();

                    String[] ParaArreglo = this.txtPara.Text.Split(new char[] { ',' });

                    to.AddRange(ParaArreglo);
                    //myMailer.enviaMensajeConAttachment
                }

                myMailer.enviaMensajeConAttachment(to, this.txtAsunto.Text, this.txtContentArea.Text, archivo.FullName);

            }
            catch (Exception ex)
            {
                Response.Redirect("vMuestraMensaje.aspx?mensaje=No se puede enviar el Informe contacte con Soporte, Error: " + ex.Message);
            }
            this.txtAsunto.Text = "";
            this.txtContentArea.Text = "";
            this.txtPara.Text = "";
            this.txtNombreDelInforme.Text = "";

        }
    }
    private void crearSolicitud()
    {
        //llamar al metodo estático para mostrar la solicitud impresa
        int numero = 0;
        try {
            numero = int.Parse((this.txtNumRecordatorio.Text));
        }
        catch (Exception ex) {
            numero = 0;
        }

        RGen.docs.GetPdf.GenerarSolicitudDocumentos(Convert.ToDecimal(Request.QueryString["AjusteId"]), Convert.ToDecimal(Request.QueryString["solicitudDocumentosId"]), this.txtDestinatario.Text,this.txtCargo.Text, DateTime.Today, this.txtNumCartaAsegurado.Text, numero,this.txtDescripcion.Text, Server.MapPath(""));

        //enviar el mail

        if (this.chkDestinatarioAseguradora.Checked ||
                    this.chkDestinatarioBroker.Checked ||
                    this.chkDestinatarioOtros.Checked)
        {
            string NombreFile = "SD-" + Request.QueryString["AjusteId"] + "-" + Request.QueryString["solicitudDocumentosId"] + ".pdf";
            archivo = new FileInfo(Server.MapPath("Informes") + "\\" + NombreFile);

            String nombreFileTemporal = Server.MapPath("Informes") + "\\SD-" + Request.QueryString["NumAjusteSolicitud"] + ".pdf";
            FileInfo archivoTemp = new FileInfo(nombreFileTemporal);

            if (archivo.Exists)
            {
                if (archivoTemp.Exists)
                {
                    File.Delete(nombreFileTemporal);
                }
                File.Copy(archivo.FullName, nombreFileTemporal);

            }

            archivo = new FileInfo(nombreFileTemporal);

            if (archivo.Exists)
            {
                RGenMailer myMailer = new RGenMailer();
                ArrayList to = new ArrayList();
                if ((this.txtCorreoAseguradora.Text != "") && (this.chkDestinatarioAseguradora.Checked))
                {
                    String[] ParaArreglo = this.txtCorreoAseguradora.Text.Split(new char[] { ',' });

                    to.AddRange(ParaArreglo);
                    //myMailer.enviaMensajeConAttachment
                }
                if ((this.txtCorreoBroker.Text != "") && (this.chkDestinatarioBroker.Checked))
                {
                    String[] ParaArreglo = this.txtCorreoBroker.Text.Split(new char[] { ',' });

                    to.AddRange(ParaArreglo);
                    //myMailer.enviaMensajeConAttachment
                }
                if ((this.txtCorreoOtros.Text != "") && (this.chkDestinatarioOtros.Checked))
                {
                    String[] ParaArreglo = this.txtCorreoOtros.Text.Split(new char[] { ',' });

                    to.AddRange(ParaArreglo);
                    //myMailer.enviaMensajeConAttachment
                }

                //TODO: Revisar los permisos para realizar los envios pertinentes
                myMailer.enviaMensajeConAttachment(
                    to,
                    "AJUSTE N°" + RGen.GestorAjuste.dameNumeroAjuste(Convert.ToDecimal(Request.QueryString["AjusteId"])),
                    "<strong>Como documento Adjunto se ha Enviado una copia de la Solicitud de Documentos</strong>",
                    archivo.FullName);

                File.Delete(nombreFileTemporal);
            }
        }

        this.DivResultado.Attributes.CssStyle.Add(HtmlTextWriterStyle.Display, "Block");
        this.lblResutado.InnerHtml = "<strong>La Solicitud ha sido creada</strong> &nbsp;&nbsp;";
        //this.lblResutado.InnerHtml += "<button style=\"width:80px;\" id=\"verSolicitud\" class=\"FormButton\" onclick=\"javascript:verSolicitud();\">Ver Solicitud</button>";
        this.verSolicitud.Attributes.Add("onclick", "ShowReport('vViewPdf.aspx?AjusteId=" + Request.QueryString["AjusteId"] + "&SolDocId=" + Request.QueryString["solicitudDocumentosId"] + "&TI=SD');");

        this.verSolicitud.Visible = true;
        this.imgLoading.Visible = false;
        this.ImprimirSolicitudDatos.Visible = false;
    }
Example #4
0
    protected void odsNuevoAjusteAseguradora1_Inserted(object sender, SqlDataSourceStatusEventArgs e)
    {
        if (e.Exception == null)
        {
            this.NumeroAjuste = e.Command.Parameters["@numeroAjuste"].Value.ToString();
            string ajusteId = e.Command.Parameters["@ajuId"].Value.ToString();
            //Enviar un correo al administrador para que atienda el caso de ajuste (crea el ajuste pero no pone ninguna poliza)
            RGen.Utiles.RGenMailer mailSender = new RGen.Utiles.RGenMailer();

            ArrayList para = new ArrayList();

            //obtenemos los correos que están en la BD como parametros y correosADM
            para = RGen.Gestores.gestorParametros.getCorreosAdministrativos();

            para.Add(ConfigurationManager.AppSettings["correoAdministrador"]);

            try
            {
                this.ruta = R3M.Common.Util.ResolveURL("./");
            }
            catch (Exception ex)
            {
                //logger.addLogItem(new LogItem("la ruta de instalacion no se encuentra : " + ex.Message));
                LoggerFacade.Log(ex);
            }

            try
            {
                mailSender.enviaMensaje(para, "Notificación de Ajuste Vía Web", formaHTML());
            }
            catch (Exception ex)
            {
                //logger.addLogItem(new LogItem("El mensaje no pudo enviarse. El error asociado es : " + ex.Message));
                LoggerFacade.Log(ex);
            }

            Response.Redirect(String.Format("vMensaje.aspx?AjusteId={0}&NumAjuste={1}", ajusteId, this.NumeroAjuste));
        }
        else
        {
            LoggerFacade.Log(e.Exception);
        }
    }