예제 #1
0
        public ClassResultV Usp_Paciente_Update_ByIdPaciente(DtoB dtoBase)
        {
            DtoPaciente  dto = (DtoPaciente)dtoBase;
            ClassResultV cr  = new ClassResultV();

            SqlParameter[] pr = new SqlParameter[9];
            try
            {
                pr[0] = new SqlParameter("@IdPaciente", SqlDbType.Int)
                {
                    Value = (dto.IdPaciente)
                };
                pr[1] = new SqlParameter("@Nombres", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.Nombres))
                };
                pr[2] = new SqlParameter("@Apellidos", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.Apellidos))
                };
                pr[3] = new SqlParameter("@IN_Tipodoc", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_Tipodoc))
                };
                pr[4] = new SqlParameter("@Numdoc", SqlDbType.VarChar, 20)
                {
                    Value = (V_ValidaPrNull(dto.Numdoc))
                };
                pr[5] = new SqlParameter("@IN_TipoSeguro", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_TipoSeguro))
                };
                pr[6] = new SqlParameter("@IN_EstadoPaciente", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_EstadoPaciente))
                };
                pr[7] = new SqlParameter("@UsuarioModificacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioModificacionId))
                };
                pr[8] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };
                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Paciente_Update_ByIdPaciente", pr);
                if (!String.IsNullOrEmpty(Convert.ToString(pr[8].Value)))
                {
                    cr.ErrorMsj   = Convert.ToString(pr[8].Value);
                    cr.LugarError = "Usp_Paciente_Update_ByIdPaciente";
                }
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al actualizar los datos del paciente";
            }
            ObjCn.Close();
            return(cr);
        }
        public ClassResultV Usp_Mensajes_Update_Respuesta(DtoB dtoBase)
        {
            ClassResultV cr  = new ClassResultV();
            DtoMensajes  dto = (DtoMensajes)dtoBase;

            SqlParameter[] pr = new SqlParameter[6];
            try
            {
                pr[0] = new SqlParameter("@IdMensaje", SqlDbType.Int)
                {
                    Value = dto.IdMensaje
                };
                pr[1] = new SqlParameter("@Respuesta", SqlDbType.VarChar, 3000)
                {
                    Value = (V_ValidaPrNull(dto.Respuesta))
                };
                pr[2] = new SqlParameter("@UsuarioModificacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioModificacionId))
                };

                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Mensajes_Update_Respuesta", pr);
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al actualizar la respuesta";
            }
            ObjCn.Close();
            return(cr);
        }
        public DtoContacto Usp_Contacto_Insert(DtoB dtoBase)
        {
            DtoContacto dto = (DtoContacto)dtoBase;

            SqlParameter[] pr = new SqlParameter[9];
            try
            {
                pr[0] = new SqlParameter("@IdContacto", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                };
                pr[1] = new SqlParameter("@NombreCompleto", SqlDbType.VarChar, 200)
                {
                    Value = (V_ValidaPrNull(dto.NombreCompleto))
                };
                pr[2] = new SqlParameter("@IN_Tipodoc", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_Tipodoc))
                };
                pr[3] = new SqlParameter("@Numdoc", SqlDbType.VarChar, 20)
                {
                    Value = (V_ValidaPrNull(dto.Numdoc))
                };
                pr[4] = new SqlParameter("@Email", SqlDbType.VarChar, 50)
                {
                    Value = (V_ValidaPrNull(dto.Email))
                };
                pr[5] = new SqlParameter("@Telefono", SqlDbType.VarChar, 50)
                {
                    Value = (V_ValidaPrNull(dto.Telefono))
                };
                pr[6] = new SqlParameter("@UsuarioCreacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioCreacionId))
                };
                pr[7] = new SqlParameter("@PacienteId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.PacienteId))
                };
                pr[8] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };
                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Contacto_Insert", pr);
                dto.IdContacto = Convert.ToInt32(pr[0].Value);
                if (!String.IsNullOrEmpty(Convert.ToString(pr[8].Value)))
                {
                    dto.ErrorMsj   = Convert.ToString(pr[8].Value);
                    dto.LugarError = "Usp_Contacto_Insert";
                }
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error al insertar Contacto";
            }
            ObjCn.Close();
            return(dto);
        }
예제 #4
0
        public ClassResultV Usp_Usuario_ResetPassword_Admin(DtoB dtoBase)
        {
            DtoUsuario   dto = (DtoUsuario)dtoBase;
            ClassResultV cr  = new ClassResultV();

            SqlParameter[] pr = new SqlParameter[3];
            try
            {
                pr[0] = new SqlParameter("@IdUsuario", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IdUsuario))
                };
                pr[1] = new SqlParameter("@UsuarioModificacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioModificacionId))
                };
                pr[2] = new SqlParameter("@NuevaContrasena", SqlDbType.VarChar, 200)
                {
                    Value = (V_ValidaPrNull(dto.Contrasena))
                };

                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Usuario_ResetPassword_Admin", pr);
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al actualizar contraseña";
            }
            ObjCn.Close();
            return(cr);
        }
        public ClassResultV Usp_Mensajes_SelectAll(DtoB dtoBase)
        {
            ClassResultV cr  = new ClassResultV();
            var          dto = (DtoMensajes)dtoBase;

            SqlParameter[] pr = new SqlParameter[4];
            try
            {
                pr[0] = new SqlParameter("@Criterio", SqlDbType.VarChar, 300)
                {
                    Value = V_ValidaPrNull(dto.Criterio)
                };
                pr[1] = new SqlParameter("@IB_Respondido", SqlDbType.Bit)
                {
                    Value = V_ValidaPrNull(dto.IB_Respondido)
                };
                pr[2] = new SqlParameter("@IN_TipoMensaje", SqlDbType.Int)
                {
                    Value = V_ValidaPrNull(dto.IN_TipoMensaje)
                };
                pr[3] = new SqlParameter("@OrganizacionId", SqlDbType.Int)
                {
                    Value = V_ValidaPrNull(dto.OrganizacionId)
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_Mensajes_SelectAll", pr);

                cr.List = new List <DtoB>();
                while (reader.Read())
                {
                    cr.List.Add(new DtoMensajes
                    {
                        IdMensaje             = GetValue("IdMensaje", reader).ValueInt32,
                        ContactoId            = GetValue("ContactoId", reader).ValueInt32,
                        Asunto                = GetValue("Asunto", reader).ValueString,
                        Mensaje               = GetValue("Mensaje", reader).ValueString,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Respondido         = GetValue("IB_Respondido", reader).ValueBool,
                        Respuesta             = GetValue("Respuesta", reader).ValueString,
                        IN_TipoMensaje        = GetValue("IN_TipoMensaje", reader).ValueInt32,
                        OrganizacionId        = GetValue("OrganizacionId", reader).ValueInt32,
                        Email             = GetValue("Email", reader).ValueString,
                        NombreCompleto    = GetValue("NombreCompleto", reader).ValueString,
                        NombreTipoMensaje = GetValue("NombreTipoMensaje", reader).ValueString
                    });
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al mostrar la bandeja de entrada";
            }
            ObjCn.Close();
            return(cr);
        }
        public ClassResultV Usp_PacienteHistorial_SelectAll_Usuario(DtoB dtoBase)
        {
            ClassResultV cr  = new ClassResultV();
            var          dto = (DtoPacienteHistorial)dtoBase;

            SqlParameter[] pr = new SqlParameter[3];
            try
            {
                pr[0] = new SqlParameter("@PacienteId", SqlDbType.Int)
                {
                    Value = (dto.PacienteId)
                };
                pr[1] = new SqlParameter("@FechaInicio", SqlDbType.Date)
                {
                    Value = V_ValidaPrNull(dto.FechaInicio)
                };
                pr[2] = new SqlParameter("@FechaFin", SqlDbType.Date)
                {
                    Value = V_ValidaPrNull(dto.FechaFin)
                };
                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_PacienteHistorial_SelectAll_Usuario", pr);

                cr.List = new List <DtoB>();
                while (reader.Read())
                {
                    cr.List.Add(new DtoPacienteHistorial
                    {
                        IdHistorial            = GetValue("IdHistorial", reader).ValueInt32,
                        PacienteId             = GetValue("PacienteId", reader).ValueInt32,
                        Temperatura            = GetValue("Temperatura", reader).ValueString,
                        PresionArterial        = GetValue("PresionArterial", reader).ValueString,
                        Saturacion             = GetValue("Saturacion", reader).ValueString,
                        Pronostico             = GetValue("Pronostico", reader).ValueString,
                        Requerimiento          = GetValue("Requerimiento", reader).ValueString,
                        Evolucion              = GetValue("Evolucion", reader).ValueString,
                        IB_Traslado            = GetValue("IB_Traslado", reader).ValueBool,
                        IN_TipoTraslado        = GetValue("IN_TipoTraslado", reader).ValueInt32,
                        DescTraslado           = GetValue("DescTraslado", reader).ValueString,
                        FechaSolicitudTraslado = GetValue("FechaSolicitudTraslado", reader).ValueDateTime,
                        OrganizacionId         = GetValue("OrganizacionId", reader).ValueInt32,
                        ContactoId             = GetValue("ContactoId", reader).ValueInt32,
                        UsuarioCreacionId      = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion          = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId  = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion      = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado              = GetValue("IB_Estado", reader).ValueBool
                    });
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al consultar usuarios del PacienteHistorial";
            }
            ObjCn.Close();
            return(cr);
        }
        public DtoPaciente Usp_Contacto_Login(DtoB dtoBase)
        {
            DtoPaciente dto = (DtoPaciente)dtoBase;

            SqlParameter[] pr = new SqlParameter[3];
            try
            {
                pr[0] = new SqlParameter("@Credencial", SqlDbType.VarChar, 100)
                {
                    Value = dto.Credencial
                };
                pr[1] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_Contacto_Login", pr);
                if (reader.Read())
                {
                    dto = new DtoPaciente
                    {
                        IdPaciente            = GetValue("IdPaciente", reader).ValueInt32,
                        Nombres               = GetValue("Nombres", reader).ValueString,
                        Apellidos             = GetValue("Apellidos", reader).ValueString,
                        IN_Tipodoc            = GetValue("IN_Tipodoc", reader).ValueInt32,
                        Numdoc                = GetValue("Numdoc", reader).ValueString,
                        IN_TipoSeguro         = GetValue("IN_TipoSeguro", reader).ValueInt32,
                        IN_EstadoPaciente     = GetValue("IN_EstadoPaciente", reader).ValueInt32,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado             = GetValue("IB_Estado", reader).ValueBool,
                        Credencial            = GetValue("Credencial", reader).ValueString,
                        OrganizacionId        = GetValue("OrganizacionId", reader).ValueInt32,
                        NombreTipodoc         = GetValue("NombreTipodoc", reader).ValueString,
                        NombreTipoSeguro      = GetValue("NombreTipoSeguro", reader).ValueString,
                        NombreEstadoPaciente  = GetValue("NombreEstadoPaciente", reader).ValueString
                    };
                }
                reader.Close();
                if (!String.IsNullOrEmpty(Convert.ToString(pr[1].Value)))
                {
                    dto.ErrorMsj   = Convert.ToString(pr[1].Value);
                    dto.LugarError = "Usp_Contacto_Login";
                }
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error al loguear crendecial";
            }
            ObjCn.Close();
            return(dto);
        }
        public DtoTablaVarios Usp_TablaVarios_Insert(DtoB dtoBase)
        {
            DtoTablaVarios dto = (DtoTablaVarios)dtoBase;

            SqlParameter[] pr = new SqlParameter[7];
            try
            {
                pr[0] = new SqlParameter("@IdTabVarios", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                };
                pr[1] = new SqlParameter("@Descripcion", SqlDbType.VarChar, 200)
                {
                    Value = (V_ValidaPrNull(dto.Descripcion))
                };
                pr[2] = new SqlParameter("@TipoAtributo", SqlDbType.VarChar, 200)
                {
                    Value = (V_ValidaPrNull(dto.TipoAtributo))
                };
                pr[3] = new SqlParameter("@EntidadTabla", SqlDbType.VarChar, 200)
                {
                    Value = (V_ValidaPrNull(dto.EntidadTabla))
                };
                pr[4] = new SqlParameter("@UsuarioCreacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioCreacionId))
                };
                pr[5] = new SqlParameter("@IB_Estado", SqlDbType.Bit)
                {
                    Value = V_ValidaPrNull(dto.IB_Estado)
                };
                pr[6] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };

                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_TablaVarios_Insert", pr);
                if (pr[0].Value != DBNull.Value)
                {
                    dto.IdTabVarios = Convert.ToInt32(pr[0].Value);
                }
                if (!String.IsNullOrEmpty(Convert.ToString(pr[6].Value)))
                {
                    dto.ErrorMsj   = Convert.ToString(pr[6].Value);
                    dto.LugarError = "Usp_TablaVarios_Insert";
                }
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error al insertar en TablaVarios";
            }
            ObjCn.Close();
            return(dto);
        }
        public ClassResultV Usp_Contacto_Update_ByPacienteId(DtoB dtoBase)
        {
            DtoContacto  dto = (DtoContacto)dtoBase;
            ClassResultV cr  = new ClassResultV();

            SqlParameter[] pr = new SqlParameter[9];
            try
            {
                pr[0] = new SqlParameter("@NombreCompleto", SqlDbType.VarChar, 200)
                {
                    Value = (V_ValidaPrNull(dto.NombreCompleto))
                };
                pr[1] = new SqlParameter("@IN_Tipodoc", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_Tipodoc))
                };
                pr[2] = new SqlParameter("@Numdoc", SqlDbType.VarChar, 20)
                {
                    Value = (V_ValidaPrNull(dto.Numdoc))
                };
                pr[3] = new SqlParameter("@Email", SqlDbType.VarChar, 50)
                {
                    Value = (V_ValidaPrNull(dto.Email))
                };
                pr[4] = new SqlParameter("@Telefono", SqlDbType.VarChar, 50)
                {
                    Value = (V_ValidaPrNull(dto.Telefono))
                };
                pr[5] = new SqlParameter("@PacienteId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.PacienteId))
                };
                pr[6] = new SqlParameter("@UsuarioModificacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioModificacionId))
                };
                pr[8] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };
                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Contacto_Update_ByPacienteId", pr);
                if (!String.IsNullOrEmpty(Convert.ToString(pr[8].Value)))
                {
                    cr.ErrorMsj   = Convert.ToString(pr[8].Value);
                    cr.LugarError = "Usp_Contacto_Update_ByPacienteId";
                }
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al actualizar los datos del Contacto";
            }
            ObjCn.Close();
            return(cr);
        }
예제 #10
0
        public DtoUsuario Usp_Usuario_SelectOne(DtoB dtoBase)
        {
            DtoUsuario dto = (DtoUsuario)dtoBase;

            SqlParameter[] pr = new SqlParameter[1];

            try
            {
                pr[0] = new SqlParameter("@IdUsuario", SqlDbType.Int)
                {
                    Value = (dto.IdUsuario)
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_Usuario_SelectOne", pr);

                //cr.List = new List<DtoB>();
                if (reader.Read())
                {
                    dto = new DtoUsuario
                    {
                        IdUsuario             = GetValue("IdUsuario", reader).ValueInt32,
                        Usuario               = GetValue("Usuario", reader).ValueString,
                        Contrasena            = GetValue("Contrasena", reader).ValueString,
                        Numdoc                = GetValue("Numdoc", reader).ValueString,
                        IN_Tipodoc            = GetValue("IN_Tipodoc", reader).ValueInt32,
                        Telefono              = GetValue("Telefono", reader).ValueString,
                        IN_Rol                = GetValue("IN_Rol", reader).ValueInt32,
                        IN_Cargo              = GetValue("IN_Cargo", reader).ValueInt32,
                        OrganizacionId        = GetValue("OrganizacionId", reader).ValueInt32,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado             = GetValue("IB_Estado", reader).ValueBool,
                        PrimerNombre          = GetValue("PrimerNombre", reader).ValueString,
                        SegundoNombre         = GetValue("SegundoNombre", reader).ValueString,
                        ApellidoPaterno       = GetValue("ApellidoPaterno", reader).ValueString,
                        ApellidoMaterno       = GetValue("ApellidoMaterno", reader).ValueString,
                        Email       = GetValue("Email", reader).ValueString,
                        NombreRol   = GetValue("NombreRol", reader).ValueString,
                        NombreCargo = GetValue("NombreCargo", reader).ValueString
                    };
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error en Usp_Usuario_SelectOne";
            }
            ObjCn.Close();
            return(dto);
        }
        public DtoPacienteHistorial Usp_PacienteHistorial_SelectOne(DtoB dtoBase)
        {
            //ClassResultV cr = new ClassResultV();
            DtoPacienteHistorial dto = (DtoPacienteHistorial)dtoBase;

            SqlParameter[] pr = new SqlParameter[1];

            try
            {
                pr[0] = new SqlParameter("@IdHistorial", SqlDbType.Int)
                {
                    Value = (dto.IdHistorial)
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_PacienteHistorial_SelectOne", pr);

                //cr.List = new List<DtoB>();
                if (reader.Read())
                {
                    dto = new DtoPacienteHistorial
                    {
                        IdHistorial            = GetValue("IdHistorial", reader).ValueInt32,
                        PacienteId             = GetValue("PacienteId", reader).ValueInt32,
                        Temperatura            = GetValue("Temperatura", reader).ValueString,
                        FrecuenciaCardiaca     = GetValue("FrecuenciaCardiaca", reader).ValueString,
                        PresionArterial        = GetValue("PresionArterial", reader).ValueString,
                        Saturacion             = GetValue("Saturacion", reader).ValueString,
                        Pronostico             = GetValue("Pronostico", reader).ValueString,
                        Requerimiento          = GetValue("Requerimiento", reader).ValueString,
                        Evolucion              = GetValue("Evolucion", reader).ValueString,
                        IB_Traslado            = GetValue("IB_Traslado", reader).ValueBool,
                        IN_TipoTraslado        = GetValue("IN_TipoTraslado", reader).ValueInt32,
                        DescTraslado           = GetValue("DescTraslado", reader).ValueString,
                        FechaSolicitudTraslado = GetValue("FechaSolicitudTraslado", reader).ValueDateTime,
                        OrganizacionId         = GetValue("OrganizacionId", reader).ValueInt32,
                        ContactoId             = GetValue("ContactoId", reader).ValueInt32,
                        UsuarioCreacionId      = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion          = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId  = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion      = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado              = GetValue("IB_Estado", reader).ValueBool
                    };
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error en Usp_PacienteHistorial_SelectOne";
            }
            ObjCn.Close();
            return(dto);
        }
        public ClassResultV Usp_TablaVarios_Update(DtoB dtoBase)
        {
            DtoTablaVarios dto = (DtoTablaVarios)dtoBase;
            ClassResultV   cr  = new ClassResultV();

            SqlParameter[] pr = new SqlParameter[7];
            try
            {
                pr[0] = new SqlParameter("@IdTabVarios", SqlDbType.Int)
                {
                    Value = (dto.IdTabVarios)
                };
                pr[1] = new SqlParameter("@Descripcion", SqlDbType.VarChar, 200)
                {
                    Value = (V_ValidaPrNull(dto.Descripcion))
                };
                pr[2] = new SqlParameter("TipoAtributo", SqlDbType.VarChar, 200)
                {
                    Value = (V_ValidaPrNull(dto.TipoAtributo))
                };
                pr[3] = new SqlParameter("@EntidadTabla", SqlDbType.VarChar, 200)
                {
                    Value = (V_ValidaPrNull(dto.EntidadTabla))
                };
                pr[4] = new SqlParameter("@UsuarioModificacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioModificacionId))
                };
                pr[5] = new SqlParameter("IB_Estado", SqlDbType.Bit)
                {
                    Value = (V_ValidaPrNull(dto.IB_Estado))
                };
                pr[6] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };

                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_TablaVarios_Update", pr);
                if (!String.IsNullOrEmpty(Convert.ToString(pr[6].Value)))
                {
                    cr.ErrorMsj   = Convert.ToString(pr[6].Value);
                    cr.LugarError = "Usp_TablaVarios_Update";
                }
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al actualizar los datos de TablaVarios";
            }
            ObjCn.Close();
            return(cr);
        }
        public ClassResultV Usp_Contacto_ForgotCredential(DtoB dtoBase)
        {
            DtoContacto  dto = (DtoContacto)dtoBase;
            ClassResultV cr  = new ClassResultV();

            SqlParameter[] pr = new SqlParameter[7];
            try
            {
                pr[0] = new SqlParameter("@IN_Tipodoc", SqlDbType.Int)
                {
                    Value = V_ValidaPrNull(dto.IN_Tipodoc)
                };
                pr[1] = new SqlParameter("@Numdoc", SqlDbType.VarChar, 20)
                {
                    Value = V_ValidaPrNull(dto.Numdoc)
                };
                pr[2] = new SqlParameter("@Email", SqlDbType.VarChar, 50)
                {
                    Value = V_ValidaPrNull(dto.Email)
                };
                pr[3] = new SqlParameter("@NuevaCredencial", SqlDbType.VarChar, 100)
                {
                    Value = V_ValidaPrNull(dto.NuevaCredencial)
                };
                pr[4] = new SqlParameter("@IN_Tipodoc_Paciente", SqlDbType.Int)
                {
                    Value = V_ValidaPrNull(dto.IN_Tipodoc_Paciente)
                };
                pr[5] = new SqlParameter("@Numdoc_Paciente", SqlDbType.VarChar, 20)
                {
                    Value = V_ValidaPrNull(dto.Numdoc_Paciente)
                };
                pr[6] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };
                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Contacto_ForgotCredential", pr);
                if (!String.IsNullOrEmpty(Convert.ToString(pr[6].Value)))
                {
                    cr.ErrorMsj   = Convert.ToString(pr[6].Value);
                    cr.LugarError = "Usp_Contacto_ForgotCredential";
                }
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al actualizar la nueva credencial";
            }
            ObjCn.Close();
            return(cr);
        }
예제 #14
0
        public ClassResultV Usp_Organizacion_Update_ByIdOrganizacion(DtoB dtoBase)
        {
            DtoOrganizacion dto = (DtoOrganizacion)dtoBase;
            ClassResultV    cr  = new ClassResultV();

            SqlParameter[] pr = new SqlParameter[6];
            try
            {
                pr[0] = new SqlParameter("@IdOrganizacion", SqlDbType.Int)
                {
                    Value = (dto.IdOrganizacion)
                };
                pr[1] = new SqlParameter("@NombreOrganizacion", SqlDbType.VarChar, 200)
                {
                    Value = (V_ValidaPrNull(dto.NombreOrganizacion))
                };
                pr[2] = new SqlParameter("@Departamento", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.Departamento))
                };
                pr[3] = new SqlParameter("@Distrito", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.Distrito))
                };
                pr[4] = new SqlParameter("@Capacidad", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.Capacidad))
                };
                pr[5] = new SqlParameter("@UsuarioModificacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioModificacionId))
                };
                pr[6] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };
                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Organizacion_Update_ByIdOrganizacion", pr);
                if (!String.IsNullOrEmpty(Convert.ToString(pr[6].Value)))
                {
                    cr.ErrorMsj   = Convert.ToString(pr[6].Value);
                    cr.LugarError = "Usp_Organizacion_Update_ByIdOrganizacion";
                }
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al actualizar los datos de la organizacion";
            }
            ObjCn.Close();
            return(cr);
        }
        public ClassResultV Usp_TablaVarios_SelectAll_Admin(DtoB dtoBase)
        {
            ClassResultV cr  = new ClassResultV();
            var          dto = (DtoTablaVarios)dtoBase;

            SqlParameter[] pr = new SqlParameter[3];
            try
            {
                pr[0] = new SqlParameter("@Criterio", SqlDbType.VarChar, 300)
                {
                    Value = (dto.Criterio)
                };
                pr[1] = new SqlParameter("@TipoAtributo", SqlDbType.VarChar, 200)
                {
                    Value = V_ValidaPrNull(dto.TipoAtributo)
                };
                pr[2] = new SqlParameter("@IB_Estado", SqlDbType.Bit)
                {
                    Value = dto.IB_Estado
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_TablaVarios_SelectAll_Admin", pr);

                cr.List = new List <DtoB>();
                while (reader.Read())
                {
                    cr.List.Add(new DtoTablaVarios
                    {
                        IdTabVarios           = GetValue("IdTabVarios", reader).ValueInt32,
                        Valor                 = GetValue("Valor", reader).ValueString,
                        Descripcion           = GetValue("Descripcion", reader).ValueString,
                        TipoAtributo          = GetValue("TipoAtributo", reader).ValueString,
                        EntidadTabla          = GetValue("EntidadTabla", reader).ValueString,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado             = GetValue("IB_Estado", reader).ValueBool
                    });
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al consultar tabla varios";
            }
            ObjCn.Close();
            return(cr);
        }
예제 #16
0
        public DtoPaciente Usp_Paciente_SelectOne(DtoB dtoBase)
        {
            DtoPaciente dto = (DtoPaciente)dtoBase;

            SqlParameter[] pr = new SqlParameter[1];

            try
            {
                pr[0] = new SqlParameter("@IdPaciente", SqlDbType.Int)
                {
                    Value = (dto.IdPaciente)
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_Paciente_SelectOne", pr);

                //cr.List = new List<DtoB>();
                if (reader.Read())
                {
                    dto = new DtoPaciente
                    {
                        IdPaciente            = GetValue("IdPaciente", reader).ValueInt32,
                        Nombres               = GetValue("Nombres", reader).ValueString,
                        Apellidos             = GetValue("Apellidos", reader).ValueString,
                        IN_Tipodoc            = GetValue("IN_Tipodoc", reader).ValueInt32,
                        Numdoc                = GetValue("Numdoc", reader).ValueString,
                        IN_TipoSeguro         = GetValue("IN_TipoSeguro", reader).ValueInt32,
                        IN_EstadoPaciente     = GetValue("IN_EstadoPaciente", reader).ValueInt32,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado             = GetValue("IB_Estado", reader).ValueBool,
                        Credencial            = GetValue("Credencial", reader).ValueString,
                        OrganizacionId        = GetValue("OrganizacionId", reader).ValueInt32,
                        NombreTipodoc         = GetValue("NombreTipodoc", reader).ValueString,
                        NombreTipoSeguro      = GetValue("NombreTipoSeguro", reader).ValueString,
                        NombreEstadoPaciente  = GetValue("NombreEstadoPaciente", reader).ValueString
                    };
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error en Usp_Paciente_SelectOne";
            }
            ObjCn.Close();
            return(dto);
        }
        public DtoContacto Usp_Contacto_SelectOne(DtoB dtoBase)
        {
            DtoContacto dto = (DtoContacto)dtoBase;

            SqlParameter[] pr = new SqlParameter[1];

            try
            {
                pr[0] = new SqlParameter("@PacienteId", SqlDbType.Int)
                {
                    Value = (dto.PacienteId)
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_Contacto_SelectOne", pr);

                //cr.List = new List<DtoB>();
                if (reader.Read())
                {
                    dto = new DtoContacto
                    {
                        IdContacto            = GetValue("IdContacto", reader).ValueInt32,
                        NombreCompleto        = GetValue("NombreCompleto", reader).ValueString,
                        IN_Tipodoc            = GetValue("IN_Tipodoc", reader).ValueInt32,
                        Numdoc                = GetValue("Numdoc", reader).ValueString,
                        Email                 = GetValue("Email", reader).ValueString,
                        Telefono              = GetValue("Telefono", reader).ValueString,
                        EnvioCredencial       = GetValue("EnvioCredencial", reader).ValueBool,
                        FechaEnvioCredencial  = GetValue("FechaEnvioCredencial", reader).ValueDateTime,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado             = GetValue("IB_Estado", reader).ValueBool,
                        PacienteId            = GetValue("PacienteId", reader).ValueInt32
                    };
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error en Usp_Contacto_SelectOne";
            }
            ObjCn.Close();
            return(dto);
        }
예제 #18
0
        public ClassResultV Usp_Organizacion_SelectAll(DtoB dtoBase)
        {
            ClassResultV cr  = new ClassResultV();
            var          dto = (DtoOrganizacion)dtoBase;

            SqlParameter[] pr = new SqlParameter[1];
            try
            {
                pr[0] = new SqlParameter("@Criterio", SqlDbType.VarChar, 300)
                {
                    Value = (dto.Criterio)
                };
                pr[1] = new SqlParameter("@IB_Estado", SqlDbType.Bit)
                {
                    Value = (dto.IB_Estado)
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_Organizacion_SelectAll", pr);

                cr.List = new List <DtoB>();
                while (reader.Read())
                {
                    cr.List.Add(new DtoOrganizacion
                    {
                        IdOrganizacion        = GetValue("IdPaciente", reader).ValueInt32,
                        NombreOrganizacion    = GetValue("NombreOrganizacion", reader).ValueString,
                        Departamento          = GetValue("Departamento", reader).ValueString,
                        Distrito              = GetValue("Distrito", reader).ValueString,
                        Capacidad             = GetValue("Capacidad", reader).ValueInt32,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado             = GetValue("IB_Estado", reader).ValueBool,
                    });
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al consultar organizaciones";
            }
            ObjCn.Close();
            return(cr);
        }
예제 #19
0
        public DtoOrganizacion Usp_Organizacion_Insert(DtoB dtoBase)
        {
            DtoOrganizacion dto = (DtoOrganizacion)dtoBase;

            SqlParameter[] pr = new SqlParameter[6];
            try
            {
                pr[0] = new SqlParameter("@IdOrganizacion", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                };
                pr[1] = new SqlParameter("@NombreOrganizacion", SqlDbType.VarChar, 200)
                {
                    Value = (V_ValidaPrNull(dto.NombreOrganizacion))
                };
                pr[2] = new SqlParameter("@Departamento", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.Departamento))
                };
                pr[3] = new SqlParameter("@Distrito", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.Distrito))
                };
                pr[4] = new SqlParameter("@Capacidad", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.Capacidad))
                };
                pr[5] = new SqlParameter("@UsuarioCreacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioCreacionId))
                };
                pr[6] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };
                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Organizacion_Insert", pr);
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error al insertar Organizacion";
            }
            ObjCn.Close();
            return(dto);
        }
        public DtoMensajes Usp_Mensajes_SelectOne(DtoB dtoBase)
        {
            DtoMensajes dto = (DtoMensajes)dtoBase;

            SqlParameter[] pr = new SqlParameter[1];

            try
            {
                pr[0] = new SqlParameter("@IdMensaje", SqlDbType.Int)
                {
                    Value = (dto.IdMensaje)
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_Mensajes_SelectOne", pr);

                if (reader.Read())
                {
                    dto = new DtoMensajes
                    {
                        IdMensaje             = GetValue("IdMensaje", reader).ValueInt32,
                        ContactoId            = GetValue("ContactoId", reader).ValueInt32,
                        Asunto                = GetValue("Asunto", reader).ValueString,
                        Mensaje               = GetValue("Mensaje", reader).ValueString,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Respondido         = GetValue("IB_Respondido", reader).ValueBool,
                        Respuesta             = GetValue("Respuesta", reader).ValueString,
                        IN_TipoMensaje        = GetValue("IN_TipoMensaje", reader).ValueInt32,
                        OrganizacionId        = GetValue("OrganizacionId", reader).ValueInt32
                    };
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error en Usp_Mensajes_SelectOne";
            }
            ObjCn.Close();
            return(dto);
        }
예제 #21
0
        public DtoOrganizacion Usp_Organizacion_SelectOne(DtoB dtoBase)
        {
            DtoOrganizacion dto = (DtoOrganizacion)dtoBase;

            SqlParameter[] pr = new SqlParameter[0];

            try
            {
                pr[0] = new SqlParameter("@IdOrganizacion", SqlDbType.Int)
                {
                    Value = (dto.IdOrganizacion)
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_Organizacion_SelectOne", pr);

                //cr.List = new List<DtoB>();
                if (reader.Read())
                {
                    dto = new DtoOrganizacion
                    {
                        IdOrganizacion        = GetValue("IdPaciente", reader).ValueInt32,
                        NombreOrganizacion    = GetValue("NombreOrganizacion", reader).ValueString,
                        Departamento          = GetValue("Departamento", reader).ValueString,
                        Distrito              = GetValue("Distrito", reader).ValueString,
                        Capacidad             = GetValue("Capacidad", reader).ValueInt32,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado             = GetValue("IB_Estado", reader).ValueBool,
                    };
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error en Usp_Organizacion_SelectOne";
            }
            ObjCn.Close();
            return(dto);
        }
        public DtoMensajes Usp_Mensajes_Insert(DtoB dtoBase)
        {
            DtoMensajes dto = (DtoMensajes)dtoBase;

            SqlParameter[] pr = new SqlParameter[6];
            try
            {
                pr[0] = new SqlParameter("@IdMensaje", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                };
                pr[1] = new SqlParameter("@ContactoId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.ContactoId))
                };
                pr[2] = new SqlParameter("@Asunto", SqlDbType.VarChar, 500)
                {
                    Value = (V_ValidaPrNull(dto.Asunto))
                };
                pr[3] = new SqlParameter("@Mensaje", SqlDbType.VarChar, 3000)
                {
                    Value = (V_ValidaPrNull(dto.Mensaje))
                };
                pr[4] = new SqlParameter("@IN_TipoMensaje", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_TipoMensaje))
                };
                pr[5] = new SqlParameter("@OrganizacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.OrganizacionId))
                };
                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Mensajes_Insert", pr);
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error al crear mensaje";
            }
            ObjCn.Close();
            return(dto);
        }
        public DtoTablaVarios Usp_TablaVarios_SelectOne(DtoB dtoBase)
        {
            DtoTablaVarios dto = (DtoTablaVarios)dtoBase;

            SqlParameter[] pr = new SqlParameter[1];

            try
            {
                pr[0] = new SqlParameter("@IdTabVarios", SqlDbType.Int)
                {
                    Value = (dto.IdTabVarios)
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_TablaVarios_SelectOne", pr);

                if (reader.Read())
                {
                    dto = new DtoTablaVarios
                    {
                        IdTabVarios           = GetValue("IdTabVarios", reader).ValueInt32,
                        Valor                 = GetValue("Valor", reader).ValueString,
                        Descripcion           = GetValue("Descripcion", reader).ValueString,
                        TipoAtributo          = GetValue("TipoAtributo", reader).ValueString,
                        EntidadTabla          = GetValue("EntidadTabla", reader).ValueString,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado             = GetValue("IB_Estado", reader).ValueBool
                    };
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error en Usp_TablaVarios_SelectOne";
            }
            ObjCn.Close();
            return(dto);
        }
        public DtoPacienteHistorial Usp_PacienteHistorial_Update_ByIdHistorial(DtoB dtoBase)
        {
            DtoPacienteHistorial dto = (DtoPacienteHistorial)dtoBase;

            SqlParameter[] pr = new SqlParameter[15];
            try
            {
                pr[0] = new SqlParameter("@IdHistorial", SqlDbType.Int)
                {
                    Value = V_ValidaPrNull(dto.IdHistorial)
                };
                pr[1] = new SqlParameter("@Temperatura", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.Temperatura))
                };
                pr[2] = new SqlParameter("@FrecuenciaCardiaca", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.FrecuenciaCardiaca))
                };
                pr[3] = new SqlParameter("@PresionArterial", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.PresionArterial))
                };
                pr[4] = new SqlParameter("@Saturacion", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.Saturacion))
                };
                pr[5] = new SqlParameter("@Pronostico", SqlDbType.VarChar, int.MaxValue)
                {
                    Value = (V_ValidaPrNull(dto.Pronostico))
                };
                pr[6] = new SqlParameter("@Requerimiento", SqlDbType.VarChar, int.MaxValue)
                {
                    Value = (V_ValidaPrNull(dto.Requerimiento))
                };
                pr[7] = new SqlParameter("@Evolucion", SqlDbType.VarChar, int.MaxValue)
                {
                    Value = (V_ValidaPrNull(dto.Evolucion))
                };
                pr[8] = new SqlParameter("@IB_Traslado", SqlDbType.Bit)
                {
                    Value = (V_ValidaPrNull(dto.IB_Traslado))
                };
                pr[9] = new SqlParameter("@IN_TipoTraslado", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_TipoTraslado))
                };
                pr[10] = new SqlParameter("@DescTraslado", SqlDbType.VarChar, int.MaxValue)
                {
                    Value = (V_ValidaPrNull(dto.DescTraslado))
                };
                pr[11] = new SqlParameter("@FechaSolicitudTraslado", SqlDbType.DateTime)
                {
                    Value = (V_ValidaPrNull(dto.FechaSolicitudTraslado))
                };
                pr[14] = new SqlParameter("@UsuarioModificacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioModificacionId))
                };
                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_PacienteHistorial_Update_ByIdHistorial", pr);
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error al actualizar PacienteHistorial";
            }
            ObjCn.Close();
            return(dto);
        }
예제 #25
0
        public ClassResultV Usp_Paciente_Select(DtoB dtoBase)
        {
            ClassResultV cr  = new ClassResultV();
            var          dto = (DtoPaciente)dtoBase;

            SqlParameter[] pr = new SqlParameter[4];
            try
            {
                pr[0] = new SqlParameter("@Criterio", SqlDbType.VarChar, 300)
                {
                    Value = (dto.Criterio)
                };
                pr[1] = new SqlParameter("@IN_EstadoPaciente", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_EstadoPaciente))
                };
                pr[2] = new SqlParameter("@IB_Estado", SqlDbType.Bit)
                {
                    Value = (dto.IB_Estado)
                };
                pr[3] = new SqlParameter("@OrganizacionId", SqlDbType.Int)
                {
                    Value = (dto.OrganizacionId)
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_Paciente_Select", pr);

                cr.List = new List <DtoB>();
                while (reader.Read())
                {
                    cr.List.Add(new DtoPaciente
                    {
                        IdPaciente            = GetValue("IdPaciente", reader).ValueInt32,
                        Nombres               = GetValue("Nombres", reader).ValueString,
                        Apellidos             = GetValue("Apellidos", reader).ValueString,
                        IN_Tipodoc            = GetValue("IN_Tipodoc", reader).ValueInt32,
                        Numdoc                = GetValue("Numdoc", reader).ValueString,
                        IN_TipoSeguro         = GetValue("IN_TipoSeguro", reader).ValueInt32,
                        IN_EstadoPaciente     = GetValue("IN_EstadoPaciente", reader).ValueInt32,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado             = GetValue("IB_Estado", reader).ValueBool,
                        Credencial            = GetValue("Credencial", reader).ValueString,
                        OrganizacionId        = GetValue("OrganizacionId", reader).ValueInt32,
                        NombreTipodoc         = GetValue("NombreTipodoc", reader).ValueString,
                        NombreTipoSeguro      = GetValue("NombreTipoSeguro", reader).ValueString,
                        NombreEstadoPaciente  = GetValue("NombreEstadoPaciente", reader).ValueString
                    });
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al consultar usuarios del Paciente";
            }
            ObjCn.Close();
            return(cr);
        }
예제 #26
0
        public ClassResultV Usp_Usuario_SelectAll(DtoB dtoBase)
        {
            ClassResultV cr  = new ClassResultV();
            var          dto = (DtoUsuario)dtoBase;

            SqlParameter[] pr = new SqlParameter[4];
            try
            {
                pr[0] = new SqlParameter("@Criterio", SqlDbType.VarChar, 300)
                {
                    Value = (dto.Criterio)
                };
                pr[1] = new SqlParameter("@IB_Estado", SqlDbType.Bit)
                {
                    Value = (dto.IB_Estado)
                };
                pr[2] = new SqlParameter("@IN_Rol", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_Rol))
                };
                pr[3] = new SqlParameter("@OrganizacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.OrganizacionId))
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_Usuario_SelectAll", pr);

                cr.List = new List <DtoB>();
                while (reader.Read())
                {
                    cr.List.Add(new DtoUsuario
                    {
                        IdUsuario             = GetValue("IdUsuario", reader).ValueInt32,
                        Usuario               = GetValue("Usuario", reader).ValueString,
                        Numdoc                = GetValue("Numdoc", reader).ValueString,
                        IN_Tipodoc            = GetValue("IN_Tipodoc", reader).ValueInt32,
                        Telefono              = GetValue("Telefono", reader).ValueString,
                        IN_Rol                = GetValue("IN_Rol", reader).ValueInt32,
                        IN_Cargo              = GetValue("IN_Cargo", reader).ValueInt32,
                        OrganizacionId        = GetValue("OrganizacionId", reader).ValueInt32,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado             = GetValue("IB_Estado", reader).ValueBool,
                        PrimerNombre          = GetValue("PrimerNombre", reader).ValueString,
                        SegundoNombre         = GetValue("SegundoNombre", reader).ValueString,
                        ApellidoPaterno       = GetValue("ApellidoPaterno", reader).ValueString,
                        ApellidoMaterno       = GetValue("ApellidoMaterno", reader).ValueString,
                        Email         = GetValue("Email", reader).ValueString,
                        NombreTipodoc = GetValue("NombreTipodoc", reader).ValueString,
                        NombreRol     = GetValue("NombreRol", reader).ValueString,
                        NombreCargo   = GetValue("NombreCargo", reader).ValueString
                    });
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al consultar Usuarios";
            }
            ObjCn.Close();
            return(cr);
        }
예제 #27
0
        public DtoUsuario Usp_Usuario_Insert(DtoB dtoBase)
        {
            DtoUsuario dto = (DtoUsuario)dtoBase;

            //ClassResultV cr = new ClassResultV();
            SqlParameter[] pr = new SqlParameter[17];
            try
            {
                pr[0] = new SqlParameter("@IdUsuario", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                };
                pr[1] = new SqlParameter("@Usuario", SqlDbType.VarChar, 100)
                {
                    Value = (dto.Usuario)
                };
                pr[2] = new SqlParameter("@Contrasena", SqlDbType.VarChar, 200)
                {
                    Value = (dto.Contrasena)
                };
                pr[3] = new SqlParameter("@Numdoc", SqlDbType.VarChar, 20)
                {
                    Value = (dto.Numdoc)
                };
                pr[4] = new SqlParameter("@IN_Tipodoc", SqlDbType.Int)
                {
                    Value = (dto.IN_Tipodoc)
                };
                pr[5] = new SqlParameter("@Telefono", SqlDbType.VarChar, 20)
                {
                    Value = (dto.Telefono)
                };
                pr[6] = new SqlParameter("@IN_Rol", SqlDbType.Int)
                {
                    Value = (dto.IN_Rol)
                };
                pr[7] = new SqlParameter("@IN_Cargo", SqlDbType.Int)
                {
                    Value = (dto.IN_Cargo)
                };
                pr[8] = new SqlParameter("@OrganizacionId", SqlDbType.Int)
                {
                    Value = (dto.OrganizacionId)
                };
                pr[9] = new SqlParameter("@UsuarioCreacionId", SqlDbType.Int)
                {
                    Value = (dto.UsuarioCreacionId)
                };
                pr[10] = new SqlParameter("@IB_Estado", SqlDbType.Bit)
                {
                    Value = (dto.IB_Estado)
                };
                pr[11] = new SqlParameter("@PrimerNombre", SqlDbType.VarChar, 100)
                {
                    Value = (dto.PrimerNombre)
                };
                pr[12] = new SqlParameter("@SegundoNombre", SqlDbType.VarChar, 100)
                {
                    Value = (dto.SegundoNombre)
                };
                pr[13] = new SqlParameter("@ApellidoPaterno", SqlDbType.VarChar, 100)
                {
                    Value = (dto.ApellidoPaterno)
                };
                pr[14] = new SqlParameter("@ApellidoMaterno", SqlDbType.VarChar, 100)
                {
                    Value = (dto.ApellidoMaterno)
                };
                pr[15] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };
                pr[16] = new SqlParameter("@Email", SqlDbType.VarChar, 50)
                {
                    Value = dto.Email
                };
                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Usuario_Insert", pr);
                if (pr[0].Value != DBNull.Value)
                {
                    dto.IdUsuario = Convert.ToInt32(pr[0].Value);
                }
                if (!String.IsNullOrEmpty(Convert.ToString(pr[15].Value)))
                {
                    dto.ErrorMsj   = Convert.ToString(pr[15].Value);
                    dto.LugarError = "Usp_Usuario_Insert";
                }
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error al insertar Usuario";
            }
            ObjCn.Close();
            return(dto);
        }
예제 #28
0
        public ClassResultV Usp_Usuario_Update(DtoB dtoBase)
        {
            DtoUsuario   dto = (DtoUsuario)dtoBase;
            ClassResultV cr  = new ClassResultV();

            SqlParameter[] pr = new SqlParameter[16];
            try
            {
                pr[0] = new SqlParameter("@IdUsuario", SqlDbType.Int)
                {
                    Value = (dto.IdUsuario)
                };
                pr[1] = new SqlParameter("@Usuario", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.Usuario))
                };
                pr[2] = new SqlParameter("@Numdoc", SqlDbType.VarChar, 20)
                {
                    Value = (V_ValidaPrNull(dto.Numdoc))
                };
                pr[3] = new SqlParameter("@IN_Tipodoc", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_Tipodoc))
                };
                pr[4] = new SqlParameter("@Telefono", SqlDbType.VarChar, 20)
                {
                    Value = (V_ValidaPrNull(dto.Telefono))
                };
                pr[5] = new SqlParameter("@IN_Rol", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_Rol))
                };
                pr[6] = new SqlParameter("@IN_Cargo", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_Cargo))
                };
                pr[7] = new SqlParameter("@UsuarioModificacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioModificacionId))
                };
                pr[8] = new SqlParameter("@IB_Estado", SqlDbType.Bit)
                {
                    Value = (V_ValidaPrNull(dto.IB_Estado))
                };
                pr[9] = new SqlParameter("@PrimerNombre", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.PrimerNombre))
                };
                pr[10] = new SqlParameter("@SegundoNombre", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.SegundoNombre))
                };
                pr[11] = new SqlParameter("@ApellidoPaterno", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.ApellidoPaterno))
                };
                pr[12] = new SqlParameter("@ApellidoMaterno", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.ApellidoMaterno))
                };
                pr[13] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };
                pr[14] = new SqlParameter("@Email", SqlDbType.VarChar, 50)
                {
                    Value = (V_ValidaPrNull(dto.Email))
                };
                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Usuario_Update", pr);
                if (!String.IsNullOrEmpty(Convert.ToString(pr[13].Value)))
                {
                    cr.ErrorMsj   = Convert.ToString(pr[13].Value);
                    cr.LugarError = "Usp_Usuario_Update";
                }
            }
            catch (Exception ex)
            {
                cr.LugarError = ex.StackTrace;
                cr.ErrorEx    = ex.Message;
                cr.ErrorMsj   = "Error al actualizar los datos del usuario";
            }
            ObjCn.Close();
            return(cr);
        }
예제 #29
0
        public DtoUsuario Usp_Usuario_Login(DtoB dtoBase)
        {
            DtoUsuario dto = (DtoUsuario)dtoBase;

            SqlParameter[] pr = new SqlParameter[3];
            try
            {
                pr[0] = new SqlParameter("@Usuario", SqlDbType.VarChar, 200)
                {
                    Value = dto.Usuario
                };
                pr[1] = new SqlParameter("@Contrasena", SqlDbType.VarChar, 100)
                {
                    Value = dto.Contrasena
                };
                pr[2] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };

                SqlDataReader reader = SqlHelper.ExecuteReader(ObjCn, CommandType.StoredProcedure, "Usp_Usuario_Login", pr);
                if (reader.Read())
                {
                    dto = new DtoUsuario
                    {
                        IdUsuario             = GetValue("IdUsuario", reader).ValueInt32,
                        Usuario               = GetValue("Usuario", reader).ValueString,
                        Numdoc                = GetValue("Numdoc", reader).ValueString,
                        IN_Tipodoc            = GetValue("IN_Tipodoc", reader).ValueInt32,
                        Telefono              = GetValue("Telefono", reader).ValueString,
                        IN_Rol                = GetValue("IN_Rol", reader).ValueInt32,
                        IN_Cargo              = GetValue("IN_Cargo", reader).ValueInt32,
                        OrganizacionId        = GetValue("OrganizacionId", reader).ValueInt32,
                        UsuarioCreacionId     = GetValue("UsuarioCreacionId", reader).ValueInt32,
                        FechaCreacion         = GetValue("FechaCreacion", reader).ValueDateTime,
                        UsuarioModificacionId = GetValue("UsuarioModificacionId", reader).ValueInt32,
                        FechaModificacion     = GetValue("FechaModificacion", reader).ValueDateTime,
                        IB_Estado             = GetValue("IB_Estado", reader).ValueBool,
                        PrimerNombre          = GetValue("PrimerNombre", reader).ValueString,
                        SegundoNombre         = GetValue("SegundoNombre", reader).ValueString,
                        ApellidoPaterno       = GetValue("ApellidoPaterno", reader).ValueString,
                        ApellidoMaterno       = GetValue("ApellidoMaterno", reader).ValueString,
                        Email              = GetValue("Email", reader).ValueString,
                        NombreRol          = GetValue("NombreRol", reader).ValueString,
                        NombreCargo        = GetValue("NombreCargo", reader).ValueString,
                        NombreOrganizacion = GetValue("NombreOrganizacion", reader).ValueString
                    };
                }
                reader.Close();
                if (!String.IsNullOrEmpty(Convert.ToString(pr[2].Value)))
                {
                    dto.ErrorMsj   = Convert.ToString(pr[2].Value);
                    dto.LugarError = "Usp_Usuario_Login";
                }
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error al loguear usuario";
            }
            ObjCn.Close();
            return(dto);
        }
예제 #30
0
        public DtoPaciente Usp_Paciente_Insert(DtoB dtoBase)
        {
            DtoPaciente dto = (DtoPaciente)dtoBase;

            SqlParameter[] pr = new SqlParameter[11];
            try
            {
                pr[0] = new SqlParameter("@IdPaciente", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                };
                pr[1] = new SqlParameter("@Nombres", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.Nombres))
                };
                pr[2] = new SqlParameter("@Apellidos", SqlDbType.VarChar, 100)
                {
                    Value = (V_ValidaPrNull(dto.Apellidos))
                };
                pr[3] = new SqlParameter("@IN_Tipodoc", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_Tipodoc))
                };
                pr[4] = new SqlParameter("@Numdoc", SqlDbType.VarChar, 20)
                {
                    Value = (V_ValidaPrNull(dto.Numdoc))
                };
                pr[5] = new SqlParameter("@IN_TipoSeguro", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_TipoSeguro))
                };
                pr[6] = new SqlParameter("@IN_EstadoPaciente", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.IN_EstadoPaciente))
                };
                pr[7] = new SqlParameter("@UsuarioCreacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.UsuarioCreacionId))
                };
                pr[8] = new SqlParameter("@Credencial", SqlDbType.VarChar)
                {
                    Value = (V_ValidaPrNull(dto.Credencial))
                };
                pr[9] = new SqlParameter("@OrganizacionId", SqlDbType.Int)
                {
                    Value = (V_ValidaPrNull(dto.OrganizacionId))
                };
                pr[10] = new SqlParameter("@msj", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };
                SqlHelper.ExecuteNonQuery(ObjCn, CommandType.StoredProcedure, "Usp_Paciente_Insert", pr);
                if (pr[0].Value != DBNull.Value)
                {
                    dto.IdPaciente = Convert.ToInt32(pr[0].Value);
                }
                if (!String.IsNullOrEmpty(Convert.ToString(pr[10].Value)))
                {
                    dto.ErrorMsj   = Convert.ToString(pr[10].Value);
                    dto.LugarError = "Usp_Paciente_Insert";
                }
            }
            catch (Exception ex)
            {
                dto.LugarError = ex.StackTrace;
                dto.ErrorEx    = ex.Message;
                dto.ErrorMsj   = "Error al insertar Paciente";
            }
            ObjCn.Close();
            return(dto);
        }