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> "; //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; }