public int agregar_reporte_proyecto(Reporte reporte, Detalle_Reporte detalle_Reporte, string correos, string user) { int result = 0; string[] vector_correo = correos.Split(','); Fecha fecha = new Fecha(); string fecha_asignar = fecha.fecha(); reporte.FECHA_CREACION = fecha_asignar; reporte.USUARIO_CREACION = user; int id = dao_reporte.AgregarReporteProyecto(reporte); detalle_Reporte.USUARIO_CREACION = user; detalle_Reporte.FECHA_CREACION = fecha_asignar; detalle_Reporte.FK_ID_REPORTE = id; dao_reporte.CambiarEstadoReporteProyecto(reporte.ID_PROYECTO, user, fecha_asignar); string nombre_cliente = dao_reporte.ObtenerNombreCliente2(reporte.ID_PROYECTO); result = dao_reporte.AgregarDetalleReporteProyecto(detalle_Reporte); mail.Enviar_Resporte_Correo_Proyecto(encryption.Encrypt(id.ToString()), reporte, detalle_Reporte, nombre_cliente, vector_correo); return(result); }
public int actualizar_reporte_proyecto(Reporte reporte, Detalle_Reporte detalle_Reporte, string user) { int result = 0; Fecha fecha = new Fecha(); string fecha_asignar = fecha.fecha(); reporte.FECHA_CREACION = fecha_asignar; reporte.USUARIO_CREACION = user; int id = dao_reporte.ModificarReporteProyecto(reporte); detalle_Reporte.USUARIO_CREACION = user; detalle_Reporte.FECHA_CREACION = fecha_asignar; detalle_Reporte.FK_ID_REPORTE = reporte.PK_ID_REPORTE; dao_reporte.CambiarEstadoReporteProyecto(reporte.ID_PROYECTO, user, fecha_asignar); dao_reporte.EliminarDetallesReporte(reporte.PK_ID_REPORTE); result = dao_reporte.AgregarDetalleReporteProyecto(detalle_Reporte); // mail.Enviar_Resporte_Correo(encryption.Encrypt(id.ToString())); return(result); }
public int AgregarDetalleReporteProyecto(Detalle_Reporte detalle_Reporte) { int result = 0; SqlCommand comando = new SqlCommand(); //QuitarDetallesReporte(servicios[0].ID_CONTRATO); comando.Connection = conexion; comando.CommandText = "execute [PA_CTRL_MAN_AGREGAR_DETALLES_REPORTE_PROYECTO] @TARIFA, @USUARIO, @FECHA, @ID_REPORTE, @OBSERVACION"; comando.Parameters.AddWithValue("@TARIFA", detalle_Reporte.TARIFA); comando.Parameters.AddWithValue("@USUARIO", detalle_Reporte.USUARIO_CREACION); comando.Parameters.AddWithValue("@FECHA", detalle_Reporte.FECHA_CREACION); comando.Parameters.AddWithValue("@ID_REPORTE", detalle_Reporte.FK_ID_REPORTE); if (detalle_Reporte.OBSERVACION != null) { comando.Parameters.AddWithValue("@OBSERVACION", detalle_Reporte.OBSERVACION); } else { comando.Parameters.AddWithValue("@OBSERVACION", " "); } //result = comando.ExecuteNonQuery(); result = Convert.ToInt32(comando.ExecuteScalar()); return(result); }
public void GenerarPDFProyecto(string PK_ID_REPORTE, Reporte reporte, Detalle_Reporte detalle_Reporte, string nombre_cliente) { string pk_reporte = encryption.Decrypt(PK_ID_REPORTE); string tipo = ""; tipo = "Reporte de Proyecto"; byte[] pdfContent = new SimplePechkin(new GlobalConfig()).Convert("<html><body style='background - color: #E3F5FF '><CENTER> <TABLE style = 'font-family: arial;' WIDTH ='80%'><TR><TD WIDTH ='75%'><h2 style = 'color: #1B252F'> Soluciones <strong> S.I.T.S.A </strong></h2><h4><a href = 'http://www.sitsacr.net'> www.sitsacr.net </a></h4><h4><a> [email protected] </a></h4><p> Tel: 2431 - 2925 </p><hr style = 'border-color: #707070;'><p> 50 m.Sur del Scotiabank Alajuela Centro <br/> <strong> 'Avenida Juan Lopez del corral' </strong></p><TD style = 'font-family: arial;'><center><h1 style = 'color: #1B252F'> S.I.T.S.A </h1> Soluciones Integrales en Tecnología </center><center> </TABLE><TABLE style = 'font-family: arial;' WIDTH=80%><TR><TD ><hr style ='border-color: #707070;'><center><p style ='font-size: 24px;'> Reporte #" + pk_reporte + "</p> <h2>S.I.T.S.A</h2></center><TR> <TD><hr style = 'border-color: #707070;' ><label style = 'font-size: 18px;'><strong> Cliente:</strong> </label> " + nombre_cliente + "       <label style = 'font-size: 18px; font-family: arial;'> <strong> Fecha:</strong > </label > " + reporte.FECHA + "<br><br> <label style = 'font-size: 18px;'> <strong> Tipo de reporte: </strong > </label >   " + tipo + "<br> <br> <label style = 'font-size: 18px;' > <strong > Monto consumido: </strong> </label>   " + detalle_Reporte.TARIFA + "<br><br></TABLE><CENTER><TABLE style = 'font-family: arial;' WIDTH=80%><TR ><TR ><TD ><hr style= 'border-color: #707070;' ><label style= 'font-size: 18px;'><strong> Pendientes / Observaciones:</strong> </label><br><br><textarea style='width:100%; height: 100px; font-family: arial; font-size: 18px; font-color:black;'>" + reporte.OBSERVACION + "</textarea><br><br><CENTER><a href = 'https://localhost:44375/Reporte_Aceptacion.aspx?key=" + PK_ID_REPORTE + "'><button style='border-radius: 12px; font-family: arial; font-size: 16px; background-color: #e7e7e7; color: black;'>Cambiar estado</button></a></CENTER></TABLE></body</html>"); // Folder where the file will be created string directory = "C:\\Pdf\\"; // Name of the PDF string filename = "Reporte#" + pk_reporte + ".pdf"; if (ByteArrayToFile(directory + filename, pdfContent)) { Console.WriteLine("PDF Succesfully created"); } else { Console.WriteLine("Cannot create PDF"); } }
public List <Detalle_Reporte> BuscaDetallesReporte(int id, int opc) { Detalle_Reporte detalle_reporte = new Detalle_Reporte(); List <Detalle_Reporte> detalles_reporte = new List <Detalle_Reporte>(); SqlCommand comando = new SqlCommand(); comando.Connection = conexion; comando.CommandText = ""; if (opc == 1) { comando.CommandText = "PA_CTRL_CON_BUSCAR_DETALLE_REPORTE_CONTRATO @ID"; } else if (opc == 2) { comando.CommandText = "PA_CTRL_CON_BUSCAR_DETALLE_REPORTE_PROYECTO @ID"; } else if (opc == 3) { comando.CommandText = "PA_CTRL_CON_BUSCAR_DETALLE_REPORTE_CONTRATO_EXTRA @ID"; } comando.Parameters.AddWithValue("@ID", id); SqlDataReader list = comando.ExecuteReader(); while (list.Read()) { detalle_reporte = new Detalle_Reporte(); detalle_reporte.PK_ID_DETALLE_REPORTE = list.GetInt32(0); if (!list.IsDBNull(1)) { detalle_reporte.HORAS = list.GetDouble(1); } detalle_reporte.TARIFA = list.GetDouble(2); detalle_reporte.FK_ID_REPORTE = list.GetInt32(3); detalle_reporte.OBSERVACION = list.GetString(4); if (!list.IsDBNull(5)) { detalle_reporte.ID_SERVICIO = list.GetInt32(5); } detalles_reporte.Add(detalle_reporte); } list.Dispose(); comando.Dispose(); return(detalles_reporte); }
public int Cambiar_Estado_Reporte(string ID_Reporte, string correos) { int ID_Reporte2 = int.Parse(ID_Reporte); string nombre_cliente = daoreporte.ObtenerNombreCliente2(ID_Reporte2); string[] vector_correo = correos.Split(','); int result = dao_cierre.Cambiar_Estado_Reenvio(ID_Reporte2); Reporte Reporte_Obj = new Reporte(); Reporte_Obj = daoreporte.devuelve_reporte(ID_Reporte2); Detalle_Reporte Detalle_Obj2 = new Detalle_Reporte(); int opc = 0; if (Reporte_Obj.ID_CONTRATO != 0) { opc = 1; } else if (Reporte_Obj.ID_PROYECTO != 0) { opc = 2; } List <Detalle_Reporte> Detalle_Obj = new List <Detalle_Reporte>(); Detalle_Obj = daoreporte.BuscaDetallesReporte(ID_Reporte2, opc); if ((Reporte_Obj.TIPO_DOCUMENTO == "Reporte Contrato") || (Reporte_Obj.TIPO_DOCUMENTO == "Reporte Contrato Garantía") || (Reporte_Obj.TIPO_DOCUMENTO == "Reporte Contrato Facturado")) { mail.Enviar_Resporte_Correo(encryption.Encrypt(ID_Reporte2.ToString()), Reporte_Obj, Detalle_Obj, nombre_cliente, vector_correo); } else { mail.Enviar_Resporte_Correo_Proyecto(encryption.Encrypt(ID_Reporte2.ToString()), Reporte_Obj, Detalle_Obj2, nombre_cliente, vector_correo); } return(result); }
public void Enviar_Resporte_Correo_Proyecto(string PK_ID_REPORTE, Reporte reporte, Detalle_Reporte detalle_Reporte, String nombre_cliente, string[] correos) { GenerarPDFProyecto(PK_ID_REPORTE, reporte, detalle_Reporte, nombre_cliente); string pk_reporte = encryption.Decrypt(PK_ID_REPORTE); try { string filename = @"c:\\Pdf\\Reporte#" + pk_reporte + ".pdf"; Attachment data = new Attachment(filename, MediaTypeNames.Application.Octet); listaConfiguracion = dao.Correo_Configuracion(); foreach (var dato in listaConfiguracion) { if (dato.LLAVE04.Equals("CORREO")) { Correo = dato.VALOR; } if (dato.LLAVE04.Equals("SMTP")) { SMTP = dato.VALOR; } if (dato.LLAVE04.Equals("PUERTO")) { Puerto = dato.VALOR; } if (dato.LLAVE04.Equals("CONTRASENNA")) { Contrasenna1 = dato.VALOR; } } MailMessage email = new MailMessage(); for (int i = 0; i < correos.Length - 1; i++) { email.To.Add(new MailAddress(correos[i])); } email.From = new MailAddress(Correo); email.Subject = "Cambio de contrasenna "; email.Body = "<html>" + "<body style = 'margin: 0; padding: 0;' >" + "<table role = 'presentation' border = '0' cellpadding = '0' cellspacing = '0' width = '100%' > <tr >" + "<td style = 'padding: 20px 0 30px 0;' >" + "<table align = 'center' border = '0' cellpadding = '0' cellspacing = '0' width = '600' style = 'border-collapse: collapse; border: 1px solid #cccccc;' >" + "<tr >" + "<td align = 'center' bgcolor = '#1B252F' style = 'padding: 0px 0 0px 0;' >" + "<img src = 'http://www.sitsacr.net/Media/IMG/Dynamic/Home/Carousel/1Imagen%201.png?v=6899' alt = 'Creating Email Magic.' width = '600' height = '280' style = 'display: block;' />" + "</td >" + "</tr >" + "<tr >" + "<td bgcolor = '#ffffff' style = 'padding: 40px 30px 40px 30px;' >" + "<table border = '0' cellpadding = '0' cellspacing = '0' width = '100%' style = 'border-collapse: collapse;' >" + "<tr >" + "<td style = 'color: #153643; font-family: Arial, sans-serif;' >" + "<h1 style = 'font-size: 24px; margin: 0;' > Estimado cliente:</h1 >" + "</td >" + "</tr >" + "<tr >" + "<td style = 'color: #153643; font-family: Arial, sans-serif; font-size: 16px; line-height: 24px; padding: 20px 0 30px 0;' >" + "<p style = 'margin: 0;' > Adjunto se encuentra el estado del informe del contrato. <br><br>Por medio del <a href = 'https://*****:*****@sitsacr.net'>" + "<img src='https://cdn.icon-icons.com/icons2/1195/PNG/512/1490889681-email_82528.png' alt='Email.' width='38' height='38' style='display: block;' border='0' />" + "</a>" + "</td>" + "</tr>" + "</table>" + "</td >" + "</tr >" + "</table >" + "</td>" + "</tr >" + "</table >" + "</td >" + "</tr >" + "</table >" + "</body >" + "</html > "; email.IsBodyHtml = true; email.Priority = MailPriority.Normal; email.Attachments.Add(data); SmtpClient smtp = new SmtpClient(); smtp.Host = SMTP; smtp.Port = Int32.Parse(Puerto); smtp.EnableSsl = true; smtp.UseDefaultCredentials = false; smtp.Credentials = new NetworkCredential(Correo, Contrasenna1); string output = null; try { smtp.Send(email); email.Dispose(); output = "Corre electrónico fue enviado satisfactoriamente."; } catch (Exception ex) { output = "Error enviando correo electrónico: " + ex.Message; } Console.WriteLine(output); } catch (Exception e) { string hola = e.Message; Console.WriteLine(hola); } }
public JsonResult agregar_reporte_proyecto(Reporte reporte, Detalle_Reporte detalle_Reporte, string correos) { int result = ReporteModelo.agregar_reporte_proyecto(reporte, detalle_Reporte, correos, (string)(Session["User"]));; return(Json(result, JsonRequestBehavior.AllowGet)); }
//-----------inicio public JsonResult actualizar_reporte_proyecto(Reporte reporte, Detalle_Reporte detalle_Reporte) { int result = ReporteModelo.actualizar_reporte_proyecto(reporte, detalle_Reporte, (string)(Session["User"])); return(Json(result, JsonRequestBehavior.AllowGet)); }