public static object CuponMascotaWM(EMascota objE) { ERespuestaJson objRespuesta = new ERespuestaJson(); try { if (HttpContext.Current.Session["userRump"] == null) { objRespuesta.Error("Su sesión ha expirado, por favor vuelva a iniciar sesión"); return(objRespuesta); } int objResultado = 0; EUsuario eSession = (EUsuario)HttpContext.Current.Session["userRump"]; objE.USUARIO_ID = eSession.ID; objResultado = NMascota.CuponMascotaWM(objE); if (objResultado == 0) { objRespuesta.Error("El cupón ingresado no es válido."); } else { objRespuesta.Success("El cupón fue utilizado correctamente."); } } catch (Exception ex) { objRespuesta.Error(String.IsNullOrEmpty(ex.Message) ? ex.InnerException.Message : ex.Message); } return(objRespuesta); }
public static object EncontradaMascotaWM(EMascota objE) { ERespuestaJson objRespuesta = new ERespuestaJson(); try { if (HttpContext.Current.Session["userRump"] == null) { objRespuesta.Error("Su sesión ha expirado, por favor vuelva a iniciar sesión"); return(objRespuesta); } int objResultado = 0; EUsuario eSession = (EUsuario)HttpContext.Current.Session["userRump"]; objE.USUARIO_ID = eSession.ID; objResultado = NMascota.EncontradaMascotaWM(objE); if (objResultado == 0) { objRespuesta.Error("No se reportar la mascota como encontrada."); } else { objRespuesta.Success("Se reportó la mascota como encontrada correctamente"); } } catch (Exception ex) { objRespuesta.Error(String.IsNullOrEmpty(ex.Message) ? ex.InnerException.Message : ex.Message); } return(objRespuesta); }
public float MostrarTotalFacturado(EMascota tipoDeMascota) { float gananciaDePerro = 0f; float gananciaDeGato = 0f; foreach (Mascota item in _listaMascota) { if (item is Perro) { gananciaDePerro += PrecioPerro; } else { gananciaDeGato += PrecioGato; } } if (tipoDeMascota == EMascota.Perro) { return gananciaDePerro; } else { return gananciaDeGato; } }
public static object InsertarFotoMascotaWM(EMascota objE) { ERespuestaJson objRespuesta = new ERespuestaJson(); try { string objResultado = ""; //EUsuario eSession = (EUsuario)HttpContext.Current.Session["UserData"]; objE.FOTO = objE.EXTENSION; objResultado = NMascota.InsertarFotoMascotaWM(objE); if (objResultado == "") { objRespuesta.Error("No se pudo actualizar."); } else { objRespuesta.Resultado = objResultado; objRespuesta.Success("Se guardó la información correctamente"); } } catch (Exception ex) { objRespuesta.Error(String.IsNullOrEmpty(ex.Message) ? ex.InnerException.Message : ex.Message); } return(objRespuesta); }
public static object filtroMascotaWM(EMascota objE) { ERespuestaJson objRespuesta = new ERespuestaJson(); try { if (HttpContext.Current.Session["userRump"] == null) { objRespuesta.Error("Su sesión ha expirado, por favor vuelva a iniciar sesión"); return(objRespuesta); } List <EMascota> objResultado = new List <EMascota>(); objResultado = NMascota.filtroMascotaWM(objE); if (objResultado.Count == 0) { objRespuesta.Error("No se encontraron registros."); } else { objRespuesta.Resultado = objResultado; } } catch (Exception ex) { objRespuesta.Error(String.IsNullOrEmpty(ex.Message) ? ex.InnerException.Message : ex.Message); } return(objRespuesta); }
public ActionResult Edit(EMascota eMascota) { if (ModelState.IsValid) { try { bool a = gestor.Actualizar(eMascota); if (a) { return(RedirectToAction("List")); } else { return(View(eMascota)); } } catch { return(View()); } } else { return(View(eMascota)); } }
private void ImprimirResponsable() { try { var num_dni = Request.QueryString["numIdentify"]; EMascota objE = new EMascota(); objE.DNI = num_dni; //EUsuario eSession = (EUsuario)HttpContext.Current.Session["UserData"]; objE = NMascota.ObtenerMascotaxDNI(objE); if (objE.COD_MICROCHIP.Trim() == "") { ImprirResponsableSC(objE); } else { ImprirResponsableCC(objE); } } catch (Exception ex) { throw (ex); } }
public static object MuerteMascotaWM(EMascota objE) { ERespuestaJson objRespuesta = new ERespuestaJson(); try { if (HttpContext.Current.Session["userRump"] == null) { objRespuesta.Error("Su sesión ha expirado, por favor vuelva a iniciar sesión"); return(objRespuesta); } string objResultado = ""; EUsuario eSession = (EUsuario)HttpContext.Current.Session["userRump"]; objE.USUARIO_ID = eSession.ID; objResultado = NMascota.MuerteMascotaWM(objE); if (objResultado == "") { objRespuesta.Error("Error al querer modificar."); } else { // ECorreo correo = new ECorreo(); // //Correo al cliente // correo.Para = objResultado; // correo.Asunto = "Reportar mascota extraviada"; // correo.Mensaje = "<h4>¡Saludos desde RUMP!</h4>" + //"<p>Lamentamos oír que su mascota se ha extraviado.</p>" + //"<p>Con su chapita identificadora quien la encuentre podrá acceder a la información de contacto " + //"para poder retornarla. Introduciendo el número RUMP en la web y reportándola como " + //"extraviada. En cuanto suceda se le enviará una alerta indicando que la mascota ha sido " + //"encontrada. Del mismo modo, quien la encuentre podrá ver si el animal necesita algún " + //"medicamento o sufre de alguna condición o alergia.</p>" + //"<p>Esperamos recibir buenas noticias pronto. Por el momento haremos difusión en las redes para " + //"que el mayor número de gente posible esté atenta por la zona en que fue extraviada.</p>" + //"<p>Nos gustaría saber específicamente las circunstancias en la que su mascota se " + //"perdió, de este modo podremos aconsejarle para que esta situación no se vuelva a dar.</p>" + //"<p>Estaremos en contacto.</p>" + //"<p>Saludos cordiales,</p>" + //"<h4>Equipo RUMP</h4>"; // correo.Enviar(); //Correo a RUMP //correo.Para = "*****@*****.**"; //correo.Asunto = "Mascota extraviada"; //correo.Mensaje = "<h4>Se perdió la mascota </h4>"; //correo.Enviar(); objRespuesta.Success("Se actualizó correctamente"); } } catch (Exception ex) { objRespuesta.Error(String.IsNullOrEmpty(ex.Message) ? ex.InnerException.Message : ex.Message); } return(objRespuesta); }
public bool Crear(EMascota mascota) { if (Buscar(mascota.id) == null) { RepositorioMascotas.listaMascotas.Add(mascota); return(true); } return(false); }
public bool Eliminar(EMascota eMascota) { EMascota e = Buscar(eMascota.id); if (e != null) { RepositorioMascotas.listaMascotas.Remove(e); return(true); } return(false); }
public static object preRegistrarMascotaWM(EMascota objE) { ERespuestaJson objRespuesta = new ERespuestaJson(); try { EMascota objResultado = new EMascota(); objResultado = NMascota.preRegistrarMascotaWM(objE); objRespuesta.Resultado = EUtil.getEncriptar(objResultado.ID.ToString()); EUsuario eUsuario = new EUsuario(); eUsuario.EMAIL = objE.CORREO.Trim(); eUsuario.PASSWORD = objE.PASSWORD.Trim(); eUsuario = NUsuario.Login(eUsuario); if (eUsuario == null) { objRespuesta.Error("El usuario no existe o Contraseña incorrecta"); return(objRespuesta); } else { HttpContext.Current.Session["UserRump"] = eUsuario; } ECorreo correo = new ECorreo(); correo.Para = objE.CORREO; correo.Asunto = "¡Bienvenido a RUMP!"; correo.Mensaje = "<h4>¡Saludos desde RUMP!</h4>" + "<p>RUMP le da la bienvenida a la comunidad de tenencia responsable y le damos las gracias por unirse a nuestra familia. Cada vez somos más en el movimiento que lucha por el bienestar de las mascotas.</p>" + "<p>Ingresando a nuestra web con su correo y contraseña podrá acceder a múltiples opciones y pronto habrá muchas novedades para el engreído de la casa.</p>" + "<h4>Equipo RUMP</h4>" + "<h4><a href='https://api.whatsapp.com/send?phone=51992975292&text=Hola,%20estoy%20interesado%20en%20el%20servicio%20*RUMP*.%20' rel='noopener' class='mant-to-middle mode-mobile-act' title='Whatsapp'><img src='http://worldpetsperu.com/templatePage/img/core-img/whatsapp.png'></a></h4>"; try { correo.Enviar(); } catch (Exception) { } objRespuesta.Success("Se registró correctamente"); } catch (Exception ex) { objRespuesta.Error(String.IsNullOrEmpty(ex.Message) ? ex.InnerException.Message : ex.Message); } return(objRespuesta); }
public ActionResult Create(EMascota m) { if (ModelState.IsValid) { try { EMascota mascota = new EMascota { id = m.id, nomMascota = m.nomMascota, raza = m.raza, edad = m.edad, sexo = m.sexo }; if (gestor.Crear(mascota) == false) { ViewBag.Error = "ID ya registrado"; //return RedirectToAction("Create"); } else { var listaModels = new List <Mascota>(); foreach (EMascota ma in gestor.BuscarTodo()) { listaModels.Add(new Mascota { id = ma.id, nomMascota = ma.nomMascota, edad = ma.edad, raza = ma.raza, sexo = ma.sexo }); } return(View("List", listaModels)); } return(View()); } catch { return(View()); } } else { return(View(m)); } }
public static object ReportarMascotaWM(EMascota objE) { ERespuestaJson objRespuesta = new ERespuestaJson(); try { string objResultado = ""; int objResultadoReporte = NMascota.ReportarMascotaWM(objE); if (objResultadoReporte > 0) { ECorreo correo = new ECorreo(); //Para el usuario correo.Para = "*****@*****.**"; correo.Copia = objE.CORREO; correo.Asunto = "ENCONTRASTE A UNA MASCOTA"; correo.Mensaje = "<h4>¡Saludos desde RUMP!</h4>" + "<p>Le agradecemos que se haya hecho cargo de una mascota extraviada, gracias a buenas personas como usted podemos evitar que más animales acaben viviendo en la calle en las peores condiciones.</p>" + "<p>Le contactaremos lo antes posible para coordinar la devolución de la mascota a su hogar. Asimismo, le pedimos por favor que acoja y cuide al animalito hasta que se pueda contactar con éxito al dueño.</p>" + "<p>Nuevamente, gracias por responsabilizarse sobre el bienestar animal.</p>" + "<h4>Equipo RUMP</h4>"; correo.Enviar(); //Para rump correo.Para = "*****@*****.**"; correo.Copia = objE.CORREO; correo.Asunto = "MASCOTA ENCONTRADA"; correo.Mensaje = "He encontraedo una mascota con el DNI: " + objE.DNI + "<br/>" + "Mi numero de telefono es :" + objE.TELEFONO; correo.Enviar(); } if (objResultadoReporte > 0) { objRespuesta.Error("No se pudo repotar."); } else { objRespuesta.Resultado = objResultado; objRespuesta.Success("Se reportó correctamente"); } } catch (Exception ex) { objRespuesta.Error(String.IsNullOrEmpty(ex.Message) ? ex.InnerException.Message : ex.Message); } return(objRespuesta); }
public bool Actualizar(EMascota eMascota) { var mascota = Buscar(eMascota.id); if (mascota != null) { var index = RepositorioMascotas.listaMascotas.IndexOf(mascota); RepositorioMascotas.listaMascotas[index] = eMascota; RepositorioMascotas.listaMascotas[RepositorioMascotas.listaMascotas.FindIndex(m => m.id == mascota.id)] = eMascota; return(true); } return(false); }
public static object obtenerAdopcion(EMascota objE) { ERespuestaJson objRespuesta = new ERespuestaJson(); try { EMascota objResultado = NMascota.ObtenerMascotaAdopcion(objE); objRespuesta.Resultado = objResultado; } catch (Exception ex) { objRespuesta.Error(String.IsNullOrEmpty(ex.Message) ? ex.InnerException.Message : ex.Message); } return(objRespuesta); }
public ActionResult Delete(EMascota eMascota) { try { bool a = gestor.Eliminar(eMascota); if (a) { return(RedirectToAction("List")); } return(View()); } catch { return(View()); } }
public float mostrarTotalFacturado(EMascota mascota) { float retorno = 0; foreach (Mascota item in this._listaMascota) { if (EMascota.Perro == mascota) { retorno += this._precioPerro; } else { retorno += this._precioGato; } } return(retorno); }
public static object ActualizarMascotaWM(EMascota objE) { ERespuestaJson objRespuesta = new ERespuestaJson(); try { if (HttpContext.Current.Session["userRump"] == null) { objRespuesta.Error("Su sesión ha expirado, por favor vuelva a iniciar sesión"); return(objRespuesta); } string objResultado = ""; EUsuario eSession = (EUsuario)HttpContext.Current.Session["userRump"]; objE.USUARIO = eSession.ID; if (objE.ID_ENCRIP != "") { objResultado = NMascota.ActualizarMascotaWM(objE).ToString(); } else { objResultado = NMascota.RegistrarMascotaWM(objE); } if (objResultado == "") { objRespuesta.Error("No se pudo actualizar."); } else { objRespuesta.Resultado = objResultado; objRespuesta.Success("Se guardó la información correctamente"); } } catch (Exception ex) { objRespuesta.Error(String.IsNullOrEmpty(ex.Message) ? ex.InnerException.Message : ex.Message); } return(objRespuesta); }
public static object EnviarMensajeWM(EMascota objE) { ERespuestaJson objRespuesta = new ERespuestaJson(); try { ECorreo correo = new ECorreo(); //Para el usuario correo.Para = "*****@*****.**"; correo.Copia = objE.CORREO; correo.Asunto = "Mensaje de " + objE.NOMBRE + " Correo: " + objE.CORREO; correo.Mensaje = "Celular: " + objE.CELULAR + (objE.TELEFONO != "" ? " Telefono: " + objE.TELEFONO: "") + " " + objE.OBSERVACION; correo.Enviar(); objRespuesta.Success("Se envió correctamente"); } catch (Exception ex) { objRespuesta.Error(String.IsNullOrEmpty(ex.Message) ? ex.InnerException.Message : ex.Message); } return(objRespuesta); }
public float MostrarTotalFactura(EMascota tipoDeMascota) { float result = 0; /*MostrarTotalFacturado: devolverá la ganancia de la guardería * (Single), dicho método tendrá una sobrecarga que reciba como * parámetro la enumeración EMascota (con Perro y Gato como * enumerados) y retornará la ganancia de la Guardería por tipo de * Mascota.*/ foreach (Mascota recorre in this._listaMascota) { if (tipoDeMascota == EMascota.Gato && recorre is Gato) { result += this.PrecioPorGato; } else if (tipoDeMascota == EMascota.Perro && recorre is Perro) { result += this.PrecioPorPerro; } } return(result); }
public static object ObtenerMascotaWM(EMascota objE) { ERespuestaJson objRespuesta = new ERespuestaJson(); try { if (HttpContext.Current.Session["userRump"] == null) { objRespuesta.Error("Su sesión ha expirado, por favor vuelva a iniciar sesión"); return(objRespuesta); } EMascota objResultado = new EMascota(); //EUsuario eSession = (EUsuario)HttpContext.Current.Session["UserData"]; objResultado = NMascota.ObtenerMascota(objE); objRespuesta.Resultado = objResultado; } catch (Exception ex) { objRespuesta.Error(String.IsNullOrEmpty(ex.Message) ? ex.InnerException.Message : ex.Message); } return(objRespuesta); }
public static string PerdidaMascotaWM(EMascota ent) { return(DMascota.PerdidaMascotaWM(ent)); }
private void ImprirResponsableCC(EMascota objE) { using (MemoryStream ms = new MemoryStream()) { var doc = new Document(PageSize.A4, 270, 10, 240, 5); //Margen del documento doc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate()); //Rotando horizontalmente iTextSharp.text.pdf.PdfWriter w = iTextSharp.text.pdf.PdfWriter.GetInstance(doc, ms); //using (PdfWriter w = PdfWriter.GetInstance(doc, ms)) //{ doc.Open(); doc.NewPage(); //Estilos var textoBody = FontFactory.GetFont("Calibri", 18, Font.BOLD, new BaseColor(94, 94, 94)); //Fondo var logo = iTextSharp.text.Image.GetInstance(Server.MapPath("~/img/dni/certificado_cc.jpg")); logo.ScaleToFit(doc.PageSize.Width, doc.PageSize.Height - 20);//Tamaño logo.SetAbsolutePosition(5, 10); doc.Add(logo); //Tabla Datos PdfPTable table = new PdfPTable(1); table.WidthPercentage = 93; table.HorizontalAlignment = Element.ALIGN_LEFT; PdfPCell cell = new PdfPCell(new Phrase(objE.DNI, textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 10; table.AddCell(cell); //Código de Microchip var codMicrochip = objE.COD_MICROCHIP; cell = new PdfPCell(new Phrase(letraCapital(codMicrochip), textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 11; if ((codMicrochip).Length > 30) { cell.PaddingTop = -10; } table.AddCell(cell); //Nombre del mascota var nomMascota = objE.NOMBRE + " " + objE.APELLIDO; cell = new PdfPCell(new Phrase(letraCapital(nomMascota), textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 11; if ((nomMascota).Length > 30) { cell.PaddingTop = -10; } table.AddCell(cell); //Nombre del responsable var nomResponsable = objE.FAMILIARP; cell = new PdfPCell(new Phrase(letraCapital(nomResponsable), textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; if ((nomResponsable).Length > 30) { cell.PaddingTop = -14; cell.PaddingBottom = 6; } else { cell.PaddingBottom = 11; } table.AddCell(cell); //Nombre de Distrito var nomDist = objE.DISTRITO; cell = new PdfPCell(new Phrase(letraCapital(nomDist), textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 11; if ((nomDist).Length > 30) { cell.PaddingTop = 4; } table.AddCell(cell); //Fecha de inscripcion cell = new PdfPCell(new Phrase(objE.FEC_CREA.Value.ToString("dd") + " de " + objE.FEC_CREA.Value.ToString("MMMM", CultureInfo.CreateSpecificCulture("es-ES")) + " de " + objE.FEC_CREA.Value.ToString("yyyy"), textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 11; table.AddCell(cell); //Nombre de macota Mayuscula cell = new PdfPCell(new Phrase(nomMascota.ToUpper(), textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 14; if ((nomMascota).Length > 30) { cell.PaddingTop = 4; } table.AddCell(cell); doc.Add(table); doc.Close(); //} //} Response.ContentType = "application/pdf"; Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length); Response.OutputStream.Flush(); Response.OutputStream.Close(); } }
public static int ActualizarMascotaWM(EMascota ent) { return(DMascota.ActualizarMascotaWM(ent)); }
public static string ActualizarFotoMascotaWM(EMascota ent) { return(DMascota.ActualizarFotoMascotaWM(ent)); }
private void imprimirDNI() { try { var num_dni = Request.QueryString["numIdentify"]; EMascota objE = new EMascota(); objE.DNI = num_dni; //EUsuario eSession = (EUsuario)HttpContext.Current.Session["UserData"]; objE = NMascota.ObtenerMascotaxDNI(objE); using (MemoryStream ms = new MemoryStream()) { var doc = new Document(PageSize.LETTER, 25, 20, 25, 20); //using (var doc = new Document(PageSize.LETTER, 25, 20, 20, 20)) //{ iTextSharp.text.pdf.PdfWriter w = iTextSharp.text.pdf.PdfWriter.GetInstance(doc, ms); //using (PdfWriter w = PdfWriter.GetInstance(doc, ms)) //{ doc.Open(); doc.NewPage(); //Estilos var titleHeader = FontFactory.GetFont("Arial", 7, Font.BOLD, new BaseColor(76, 76, 76)); var titleRUMP = FontFactory.GetFont("Arial", 7, Font.BOLD, new BaseColor(0, 0, 0)); var titleSmall7B = FontFactory.GetFont("Courier", 7, Font.BOLD, new BaseColor(0, 0, 0)); var titleSmall6 = FontFactory.GetFont("Arial", 6, Font.NORMAL, new BaseColor(0, 0, 0)); var titleSmall6B = FontFactory.GetFont("Arial", 6, Font.BOLD, new BaseColor(0, 0, 0)); var titleSmall5 = FontFactory.GetFont("Arial", 5, Font.NORMAL, new BaseColor(0, 0, 0)); var titleSmall5B = FontFactory.GetFont("Arial", 5, Font.BOLD, new BaseColor(0, 0, 0)); var fechaCaducidad = FontFactory.GetFont("Arial", 5, Font.BOLD, new BaseColor(228, 141, 25)); var numDNI = FontFactory.GetFont("Arial", 11, Font.BOLD, new BaseColor(255, 131, 5)); //Fondo var logo = iTextSharp.text.Image.GetInstance(Server.MapPath("~/img/dni/fondo.jpg")); logo.ScaleAbsolute(263, 358); logo.SetAbsolutePosition(10, 423); doc.Add(logo); //Tabla Header PdfPTable table = new PdfPTable(2); float[] widths = new float[] { 1f, 2f }; table.SetWidths(widths); table.HorizontalAlignment = 0; PdfPCell cell = new PdfPCell(new Phrase("REPUBLICA DEL PERU", titleHeader)); cell.Border = 0; cell.HorizontalAlignment = 1; table.AddCell(cell); cell = new PdfPCell(new Phrase("RUMP - " + objE.DNI + "-" + (objE.SEXO == "Macho" ? "1" : "2"), titleRUMP)); cell.Border = 0; cell.Rowspan = 2; cell.PaddingTop = 8; cell.VerticalAlignment = 1; table.AddCell(cell); cell = new PdfPCell(new Phrase("REGISTRO UNICO DE MASCOTAS", titleHeader)); cell.Border = 0; cell.HorizontalAlignment = 1; table.AddCell(cell); //Tabla Body PdfPTable tbody = new PdfPTable(4); tbody.TotalWidth = 237f; tbody.LockedWidth = true; float[] widths2 = new float[] { 17f, 65f, 75f, 80f }; tbody.SetWidths(widths2); tbody.HorizontalAlignment = 0; tbody.SpacingBefore = 5f; //DNI VERTICAL SEPARADO var dniSeparado = ""; for (int i = 0; i < objE.DNI.Length; i++) { dniSeparado += objE.DNI.Substring(i, 1) + " "; } cell = new PdfPCell(new Phrase(dniSeparado.Trim(), numDNI)); cell.Border = 0; cell.Rotation = -90; cell.HorizontalAlignment = 1; tbody.AddCell(cell); //Foto Mascota string url_img_mascota = Server.MapPath("~/img/mascota/" + objE.lMASCOTA[0].FOTO); iTextSharp.text.Image imgMascota; if (File.Exists(url_img_mascota)) { imgMascota = iTextSharp.text.Image.GetInstance(url_img_mascota); } else { imgMascota = iTextSharp.text.Image.GetInstance(Server.MapPath("~/img/noPets.png")); } imgMascota.ScaleAbsolute(65, 85); imgMascota.SpacingBefore = 5f; cell = new PdfPCell(imgMascota); cell.Border = 0; tbody.AddCell(cell); //******************************************************* //************* INICIO NOMBRES Y DATOS ****************** //******************************************************* PdfPTable tdatos = new PdfPTable(1); cell = new PdfPCell(new Phrase("Nombre", titleSmall6)); cell.Border = 0; tdatos.AddCell(cell); cell = new PdfPCell(new Phrase(objE.NOMBRE.ToUpper(), titleSmall6B)); cell.Border = 0; tdatos.AddCell(cell); cell = new PdfPCell(new Phrase("Apellidos", titleSmall6)); cell.Border = 0; tdatos.AddCell(cell); cell = new PdfPCell(new Phrase(objE.APELLIDO.ToUpper(), titleSmall6B)); cell.Border = 0; tdatos.AddCell(cell); cell = new PdfPCell(new Phrase("Fecha de Nacimiento", titleSmall6)); cell.Border = 0; cell.PaddingTop = 20; tdatos.AddCell(cell); cell = new PdfPCell(new Phrase(objE.FEC_NAC.Value.ToString("dd MM yyyy"), titleSmall6B)); cell.Border = 0; tdatos.AddCell(cell); cell = new PdfPCell(new Phrase("Sexo " + objE.SEXO.Substring(0, 1), titleSmall6B)); cell.Border = 0; tdatos.AddCell(cell); cell = new PdfPCell(tdatos); cell.Border = 0; tbody.AddCell(cell); //******************************************************* //**************** FIN NOMBRES Y DATOS ****************** //******************************************************* //******************************************************* //******* INICIO FECHAS DE INSCRIPCION ****************** //******************************************************* PdfPTable tFechas = new PdfPTable(1); cell = new PdfPCell(new Phrase("Fecha de Inscripción", titleSmall5)); cell.Border = 0; cell.HorizontalAlignment = 1; tFechas.AddCell(cell); cell = new PdfPCell(new Phrase(objE.FEC_CREA.Value.ToString("dd MM yyyy"), titleSmall5B)); cell.Border = 0; cell.HorizontalAlignment = 1; cell.PaddingTop = -2; tFechas.AddCell(cell); cell = new PdfPCell(new Phrase("Fecha de Emisión", titleSmall5)); cell.Border = 0; cell.PaddingTop = 5; cell.HorizontalAlignment = 1; tFechas.AddCell(cell); cell = new PdfPCell(new Phrase(objE.FEC_EMI.Value.ToString("dd MM yyyy"), titleSmall5B)); cell.Border = 0; cell.HorizontalAlignment = 1; cell.PaddingTop = -2; tFechas.AddCell(cell); cell = new PdfPCell(new Phrase("Fecha de Caducidad", titleSmall5)); cell.Border = 0; cell.PaddingTop = 5; cell.HorizontalAlignment = 1; tFechas.AddCell(cell); cell = new PdfPCell(new Phrase(objE.FEC_CAD.Value.ToString("dd MM yyyy"), fechaCaducidad)); cell.Border = 0; cell.HorizontalAlignment = 1; cell.PaddingTop = -2; tFechas.AddCell(cell); //Imagen Pequeña iTextSharp.text.Image imgMascotaSmall; if (File.Exists(url_img_mascota)) { imgMascotaSmall = iTextSharp.text.Image.GetInstance(url_img_mascota); } else { imgMascotaSmall = iTextSharp.text.Image.GetInstance(Server.MapPath("~/img/noPets.png")); } imgMascotaSmall.ScaleAbsolute(30, 38); imgMascotaSmall.SpacingBefore = 7f; cell = new PdfPCell(imgMascotaSmall); cell.Border = 0; cell.HorizontalAlignment = 1; tFechas.AddCell(cell); cell = new PdfPCell(tFechas); cell.Border = 0; cell.HorizontalAlignment = 0; tbody.AddCell(cell); //******************************************************* //******* FIN FECHAS DE INSCRIPCION ********************* //******************************************************* PdfPTable tmayor = new PdfPTable(1); tmayor.TotalWidth = 237f; tmayor.LockedWidth = true; tmayor.HorizontalAlignment = 0; int cant_str_nom = 0; cant_str_nom += (objE.TIPO.Substring(0, 1) + "<PER" + objE.NOMBRE.ToUpper() + "<<").Length; if (46 - cant_str_nom < 0) { cant_str_nom = 0; } else { cant_str_nom = 46 - cant_str_nom; } cell = new PdfPCell(new Phrase(objE.TIPO.Substring(0, 1) + "<PER" + objE.APELLIDO.Replace(" ", "").PadRight(cant_str_nom, Convert.ToChar("<")) + objE.NOMBRE.ToUpper() + "<<", titleSmall7B)); cell.Border = 0; cell.PaddingTop = 0; cell.PaddingLeft = 18; tmayor.AddCell(cell); cell = new PdfPCell(new Phrase(objE.DNI + "<1<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", titleSmall7B)); cell.Border = 0; cell.PaddingLeft = 18; cell.PaddingTop = -2; tmayor.AddCell(cell); //******************************************************* //********** INICIO PARTE POSTERIOR ********************* //******************************************************* PdfPTable tposterior = new PdfPTable(4); tposterior.TotalWidth = 250f; float[] widthsPosterior = new float[] { 60f, 15f, 100f, 90f }; tposterior.SetWidths(widthsPosterior); tposterior.LockedWidth = true; tposterior.HorizontalAlignment = 0; tposterior.SpacingBefore = 60f; cell = new PdfPCell(new Phrase("Responsable 1", titleSmall6)); cell.Border = 0; cell.PaddingLeft = 12; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase("-", titleSmall6)); cell.Border = 0; cell.HorizontalAlignment = 1; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase(objE.FAMILIARP.ToUpper(), titleSmall6B)); cell.Border = 0; tposterior.AddCell(cell); PdfContentByte cb = w.DirectContent; Barcode128 bc128 = new Barcode128(); bc128.Code = objE.DNI; bc128.Font = null; iTextSharp.text.Image imgCodeBar = bc128.CreateImageWithBarcode(cb, null, null); imgCodeBar.ScaleAbsolute(70, 30); cell = new PdfPCell(imgCodeBar); cell.Border = 0; cell.Rotation = 90; cell.PaddingLeft = 30; cell.HorizontalAlignment = 2; cell.Rowspan = 7; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase("Responsable 2", titleSmall6)); cell.Border = 0; cell.PaddingLeft = 12; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase("-", titleSmall6)); cell.Border = 0; cell.HorizontalAlignment = 1; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase(objE.FAMILIARM.ToUpper(), titleSmall6B)); cell.Border = 0; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase("Caracteristicas", titleSmall6B)); cell.Border = 0; cell.Colspan = 3; cell.PaddingTop = 5; cell.PaddingBottom = 5; cell.PaddingLeft = 12; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase("Raza", titleSmall6)); cell.Border = 0; cell.PaddingLeft = 12; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase("-", titleSmall6)); cell.Border = 0; cell.HorizontalAlignment = 1; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase(objE.RAZA.ToUpper(), titleSmall6B)); cell.Border = 0; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase("Calificación", titleSmall6)); cell.Border = 0; cell.PaddingLeft = 12; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase("-", titleSmall6)); cell.Border = 0; cell.HorizontalAlignment = 1; tposterior.AddCell(cell); var calificacion = objE.CALIFICACION; switch (calificacion) { case "Rojo": calificacion = "AGRESIVO"; break; case "Verde": calificacion = "AMISTOSO"; break; case "Blanco": calificacion = "DISCAPACITADO"; break; case "Azul": calificacion = "ENTRENADO"; break; case "Amarillo": calificacion = "MIEDOSO"; break; case "Naranja": calificacion = "PELEADOR"; break; } cell = new PdfPCell(new Phrase(calificacion.ToUpper(), titleSmall6B)); cell.Border = 0; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase("Pelaje", titleSmall6)); cell.Border = 0; cell.PaddingLeft = 12; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase("-", titleSmall6)); cell.Border = 0; cell.HorizontalAlignment = 1; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase(objE.COLOR, titleSmall6B)); cell.Border = 0; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase("Domicilio", titleSmall6)); cell.Border = 0; cell.Colspan = 4; cell.PaddingLeft = 12; tposterior.AddCell(cell); cell = new PdfPCell(new Phrase(objE.DIRECCION, titleSmall6B)); cell.Border = 0; cell.Colspan = 4; cell.PaddingLeft = 20; tposterior.AddCell(cell); //******************************************************* //********** INICIO DIRECCION POSTERIOR ***************** //******************************************************* PdfPTable tdireccion = new PdfPTable(3); tdireccion.TotalWidth = 200f; float[] widthsDireccion = new float[] { 100f, 50f, 50f }; tdireccion.SetWidths(widthsDireccion); tdireccion.LockedWidth = true; tdireccion.HorizontalAlignment = 0; //tdireccion.SpacingBefore = 10f; cell = new PdfPCell(new Phrase("Distrito", titleSmall6)); cell.Border = 0; cell.PaddingLeft = 12; tdireccion.AddCell(cell); cell = new PdfPCell(new Phrase("Provincia", titleSmall6)); cell.Border = 0; tdireccion.AddCell(cell); cell = new PdfPCell(new Phrase("Departamento", titleSmall6)); cell.Border = 0; tdireccion.AddCell(cell); cell = new PdfPCell(new Phrase(objE.DISTRITO, titleSmall6B)); cell.Border = 0; cell.PaddingLeft = 12; tdireccion.AddCell(cell); cell = new PdfPCell(new Phrase(objE.PROVINCIA, titleSmall6B)); cell.Border = 0; tdireccion.AddCell(cell); cell = new PdfPCell(new Phrase(objE.DEPARTAMENTO, titleSmall6B)); cell.Border = 0; tdireccion.AddCell(cell); doc.Add(table); doc.Add(tbody); doc.Add(tmayor); doc.Add(tposterior); doc.Add(tdireccion); doc.Close(); //} //} Response.ContentType = "application/pdf"; Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length); Response.OutputStream.Flush(); Response.OutputStream.Close(); } } catch (Exception ex) { throw (ex); } }
public static int NoAdopcionMascotaWM(EMascota ent) { return(DMascota.NoAdopcionMascotaWM(ent)); }
// GET: Home/Delete/5 public ActionResult Delete(int id) { EMascota mascota = gestor.Buscar(id); return(View(mascota)); }
public static string MuerteMascotaWM(EMascota ent) { return(DMascota.MuerteMascotaWM(ent)); }
private void ImprirRegistroSC(EMascota objE) { using (MemoryStream ms = new MemoryStream()) { var doc = new Document(PageSize.A4, 270, 10, 360, 5); //Margen del documento //{ iTextSharp.text.pdf.PdfWriter w = iTextSharp.text.pdf.PdfWriter.GetInstance(doc, ms); //using (PdfWriter w = PdfWriter.GetInstance(doc, ms)) //{ doc.Open(); doc.NewPage(); //Estilos var textoBody = FontFactory.GetFont("Calibri", 18, Font.BOLD, new BaseColor(94, 94, 94)); //Fondo var logo = iTextSharp.text.Image.GetInstance(Server.MapPath("~/img/dni/registro_sc.jpg")); logo.ScaleToFit(doc.PageSize.Width, doc.PageSize.Height - 20);//Tamaño logo.SetAbsolutePosition(5, 10); doc.Add(logo); //Tabla Datos PdfPTable table = new PdfPTable(1); table.WidthPercentage = 93; table.HorizontalAlignment = Element.ALIGN_LEFT; PdfPCell cell = new PdfPCell(new Phrase(objE.DNI, textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 20; table.AddCell(cell); //Nombre del mascota var nomMascota = objE.NOMBRE + " " + objE.APELLIDO; cell = new PdfPCell(new Phrase(letraCapital(nomMascota), textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 13; if ((nomMascota).Length > 30) { cell.PaddingTop = -10; } table.AddCell(cell); //Nombre del responsable var nomResponsable = objE.FAMILIARP; cell = new PdfPCell(new Phrase(letraCapital(nomResponsable), textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 13; if ((nomResponsable).Length > 30) { cell.PaddingTop = -20; cell.PaddingBottom = 10; } else { cell.PaddingBottom = 13; } table.AddCell(cell); cell = new PdfPCell(new Phrase(objE.FEC_CREA.Value.ToString("dd") + " de " + objE.FEC_CREA.Value.ToString("MMMM", CultureInfo.CreateSpecificCulture("es-ES")) + " de " + objE.FEC_CREA.Value.ToString("yyyy"), textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 13; table.AddCell(cell); //Nombre de Provincia y departamento var nomProv = objE.PROVINCIA + "-" + objE.DEPARTAMENTO; cell = new PdfPCell(new Phrase(letraCapital(nomProv), textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 14; if ((nomProv).Length > 30) { cell.PaddingTop = 4; } table.AddCell(cell); //Nombre de Distrito var nomDist = objE.DISTRITO; cell = new PdfPCell(new Phrase(letraCapital(nomDist), textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 14; if ((nomDist).Length > 30) { cell.PaddingTop = 4; } table.AddCell(cell); //Nombre de raza var nomRaza = objE.RAZA; cell = new PdfPCell(new Phrase(letraCapital(nomRaza), textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cell.PaddingBottom = 14; if ((nomRaza).Length > 30) { cell.PaddingTop = 4; } table.AddCell(cell); //Nombre color var nomColor = objE.COLOR; cell = new PdfPCell(new Phrase(nomColor, textoBody)); cell.Border = 0; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; if ((nomRaza).Length > 30) { cell.PaddingTop = -16; } table.AddCell(cell); doc.Add(table); doc.Close(); //} //} Response.ContentType = "application/pdf"; Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length); Response.OutputStream.Flush(); Response.OutputStream.Close(); } }
public ActionResult Buscar(EMascota eMascota) { EMascota mascota = gestor.Buscar(eMascota.id); return(View(mascota)); }