Exemplo n.º 1
0
        public void EliminarTest()
        {
            bool paso = false;

            paso = PacientesBLL.Eliminar(2);
            Assert.AreEqual(paso, true);
        }
Exemplo n.º 2
0
        public static bool Insertar(Cobros cobros)
        {
            bool     paso     = false;
            Contexto contexto = new Contexto();

            try
            {
                Pacientes paciente = PacientesBLL.Buscar(cobros.PacienteId);
                paciente.Balance -= cobros.Monto;


                contexto.Entry(paciente).State = EntityState.Modified;
                contexto.Cobros.Add(cobros);
                paso = contexto.SaveChanges() > 0;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                contexto.Dispose();
            }

            return(paso);
        }
Exemplo n.º 3
0
        public void ExisteTest()
        {
            bool paso = false;

            paso = PacientesBLL.Existe(3);
            Assert.AreEqual(paso, true);
        }
Exemplo n.º 4
0
        public static bool Insertar(Procedimientos procedimiento)
        {
            Contexto contexto = new Contexto();
            bool     paso     = false;

            try
            {
                TiposProcedimientos tipoProcedimiento = TiposProcedimientosBLL.Buscar(procedimiento.TipoProcedimientoId);
                procedimiento.Monto = tipoProcedimiento.Precio;

                Pacientes paciente = PacientesBLL.Buscar(procedimiento.PacienteId);
                paciente.Balance += procedimiento.Monto;


                contexto.Procedimientos.Add(procedimiento);
                contexto.Entry(paciente).State = EntityState.Modified;
                paso = contexto.SaveChanges() > 0;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                contexto.Dispose();
            }
            return(paso);
        }
Exemplo n.º 5
0
        public static bool Eliminar(int id)
        {
            Contexto contexto = new Contexto();
            bool     paso     = false;

            try
            {
                var procedimiento = contexto.Procedimientos.Find(id);

                Pacientes paciente = PacientesBLL.Buscar(procedimiento.PacienteId);
                paciente.Balance -= procedimiento.Monto;

                if (procedimiento != null)
                {
                    contexto.Procedimientos.Remove(procedimiento);



                    contexto.Entry(paciente).State = EntityState.Modified;
                    paso = contexto.SaveChanges() > 0;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                contexto.Dispose();
            }
            return(paso);
        }
Exemplo n.º 6
0
        public static bool Modificar(Procedimientos procedimiento)
        {
            Contexto contexto = new Contexto();

            bool paso = false;

            var anterior = ProcedimientosBLL.Buscar(procedimiento.ProcedimientoId);

            try
            {
                TiposProcedimientos tipoProcedimiento = TiposProcedimientosBLL.Buscar(procedimiento.TipoProcedimientoId);
                procedimiento.Monto = tipoProcedimiento.Precio;

                Pacientes paciente = PacientesBLL.Buscar(procedimiento.PacienteId);
                paciente.Balance -= anterior.Monto; //todo: Revisar funcionamiento
                paciente.Balance += procedimiento.Monto;


                foreach (var item in anterior.ProcedimientoDetalle)
                {
                    if (!procedimiento.ProcedimientoDetalle.Exists(p => p.ProcedimientosDetalleId == item.ProcedimientosDetalleId))
                    {
                        contexto.Entry(item).State = EntityState.Deleted;
                    }
                }

                foreach (var item in procedimiento.ProcedimientoDetalle)
                {
                    if (item.ProcedimientosDetalleId == 0)
                    {
                        contexto.Entry(item).State = EntityState.Added;
                    }
                    else
                    {
                        contexto.Entry(item).State = EntityState.Modified;
                    }
                }


                contexto.Entry(procedimiento).State = EntityState.Modified;
                contexto.Entry(paciente).State      = EntityState.Modified;
                paso = contexto.SaveChanges() > 0;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                contexto.Dispose();
            }
            return(paso);
        }
Exemplo n.º 7
0
        public void GetPacientesTest()
        {
            bool paso = false;

            List <Pacientes> lista = PacientesBLL.GetPacientes();

            if (lista != null)
            {
                paso = true;
            }

            Assert.AreEqual(paso, true);
        }
Exemplo n.º 8
0
        public string Paciente(int id)
        {
            var paciente = PacientesBLL.Buscar(id);

            if (paciente != null)
            {
                return(paciente.Nombres + " " + paciente.Apellidos);
            }
            else
            {
                return("Paciente eliminado");
            }
        }
Exemplo n.º 9
0
        public void BuscarTest()
        {
            bool      paso = false;
            Pacientes pacientes;

            pacientes = PacientesBLL.Buscar(2);

            if (pacientes != null)
            {
                paso = true;
            }

            Assert.AreEqual(paso, true);
        }
Exemplo n.º 10
0
        public void ModificarTest()
        {
            bool      paso     = false;
            Pacientes paciente = new Pacientes();

            paciente.PacienteId      = 2;
            paciente.Nombres         = "Juan Alberto";
            paciente.Apellidos       = "Peña Santos";
            paciente.Direccion       = "C/ Castillo #58 Villa Riva";
            paciente.Telefono        = "829-654-6665";
            paciente.Email           = "*****@*****.**";
            paciente.Genero          = "Masculino";
            paciente.FechaNacimiento = DateTime.Now;
            paciente.FechaRegistro   = DateTime.Now;
            paciente.SeguroId        = 1;
            paciente.Balance         = 0;

            paso = PacientesBLL.Modificar(paciente);
            Assert.AreEqual(paso, true);
        }
Exemplo n.º 11
0
        public void GuardarTest()
        {
            bool      paso     = false;
            Pacientes paciente = new Pacientes();

            paciente.PacienteId      = 3;
            paciente.Nombres         = "Juana Diaz";
            paciente.Apellidos       = "Hernandez";
            paciente.Direccion       = "C/ Cruz #10 Villa Riva";
            paciente.Telefono        = "829-654-5698";
            paciente.Email           = "*****@*****.**";
            paciente.Genero          = "Femenino";
            paciente.FechaNacimiento = DateTime.Now;
            paciente.FechaRegistro   = DateTime.Now;
            paciente.SeguroId        = 1;
            paciente.Balance         = 0;

            paso = PacientesBLL.Guardar(paciente);
            Assert.AreEqual(paso, true);
        }
Exemplo n.º 12
0
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Create(PACIENTE paciente)
        //{
        //    try
        //    {
        //        PacientesBLL.Agregar(paciente);
        //        return RedirectToAction("Paciente");
        //    }
        //    catch (Exception ex)
        //    {

        //        ModelState.AddModelError("","Ocurrio un error al agregar un paciente");
        //        return View();
        //    }
        //}
        public JsonResult Paciente_()
        {
            var data = PacientesBLL.ListPacientes();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 13
0
 public ActionResult Eliminar(int id)
 {
     PacientesBLL.Eliminar(id);
     return(View("~/Views/Medicina/Medicina.cshtml"));
 }
Exemplo n.º 14
0
        private void ReportBody()
        {
            fontStyle = FontFactory.GetFont("Calibri", 9f, 1);
            var _fontStyle = FontFactory.GetFont("Calibri", 9f, 0);

            #region Table Header
            pdfCell = new PdfPCell(new Phrase("ID", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Paciente", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Fecha", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Monto", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfTable.AddCell(pdfCell);



            pdfTable.CompleteRow();
            #endregion

            #region Table Body
            int num = 0;

            foreach (var item in listaCobros)
            {
                num++;
                pdfCell = new PdfPCell(new Phrase(item.PacienteId.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfTable.AddCell(pdfCell);

                var Paciente = PacientesBLL.Buscar(item.PacienteId);
                pdfCell = new PdfPCell(new Phrase(Paciente.Nombres + " " + Paciente.Apellidos, _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(item.Fecha.ToShortDateString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(item.Monto.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfTable.AddCell(pdfCell);

                pdfTable.CompleteRow();
            }

            pdfCell = new PdfPCell(new Phrase(num++.ToString(), fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfTable.AddCell(pdfCell);

            pdfTable.CompleteRow();
            #endregion
        }
Exemplo n.º 15
0
        public ActionResult Editar(int id)
        {
            var paciente = PacientesBLL.GetPaciente(id);

            return(View("~/Views/Paciente/Editar.cshtml", paciente));
        }
Exemplo n.º 16
0
 public ActionResult Create(PACIENTE paciente)
 {
     PacientesBLL.Agregar(paciente);
     return(View("~/Views/Paciente/Paciente.cshtml", paciente));
 }
Exemplo n.º 17
0
        public ActionResult Paciente()
        {
            var _pacientes = PacientesBLL.ListPaciente();

            return(View(_pacientes));
        }
Exemplo n.º 18
0
        private void ReportBody()
        {
            fontStyle = FontFactory.GetFont("Calibri", 9f, 1);
            var _fontStyle = FontFactory.GetFont("Calibri", 9f, 0);

            #region Table Header
            pdfCell = new PdfPCell(new Phrase("ID", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("ID TipoCita", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("ID Paciente", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Estado", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Observacion", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Fecha", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfTable.AddCell(pdfCell);

            pdfTable.CompleteRow();
            #endregion

            #region Table Body
            int num = 0;

            foreach (var item in listaCitas)
            {
                num++;
                pdfCell = new PdfPCell(new Phrase(item.CitaId.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfTable.AddCell(pdfCell);

                var TipoCitas = TipoCitasBLL.Buscar(item.TipoCitaId).Nombre;
                pdfCell = new PdfPCell(new Phrase(TipoCitas, _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfTable.AddCell(pdfCell);

                var Paciente = PacientesBLL.Buscar(item.PacienteId).Nombres;
                pdfCell = new PdfPCell(new Phrase(item.PacienteId.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(item.Estado.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(item.Observacion, _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(item.Fecha.ToString("dd/MM/yyyy"), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfTable.AddCell(pdfCell);

                pdfTable.CompleteRow();
            }

            pdfCell = new PdfPCell(new Phrase(num++.ToString(), fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfTable.AddCell(pdfCell);

            pdfTable.CompleteRow();
            #endregion
        }
Exemplo n.º 19
0
 public ActionResult Eliminar(int id)
 {
     PacientesBLL.Eliminar(id);
     return(View("~/Views/Examen/Examen.cshtml"));
 }
 public ActionResult Eliminar(int id)
 {
     PacientesBLL.Eliminar(id);
     return(View("~/Views/Inventario/Inventario.cshtml"));
 }