protected void CargarGrilla()
        {
            MascotaDAO mascotaDAO = new MascotaDAO();

            gvdListaMascotasUsu.DataSource = mascotaDAO.ConsultarMascotasActivasUsuario(int.Parse(Session["numeroDocumentoLogin"].ToString()));
            gvdListaMascotasUsu.DataBind();
        }
示例#2
0
        protected void BtnBuscar_Click(object sender, EventArgs e)
        {
            string ID = txtRut.Text;


            if (!ID.Equals(""))
            {
                DataTable dt = MascotaDAO.Buscar(ID);
                try
                {
                    if (dt.Rows[0]["ID_DUENO"].ToString().Equals(ID))
                    {
                        GridView1.DataSource = dt;
                        GridView1.DataBind();
                        LabelOk.Text    = "Mascota encontrada";
                        LabelError.Text = "";
                    }
                }
                catch (IndexOutOfRangeException)
                {
                    LabelOk.Text    = "";
                    LabelError.Text = "Error, Mascota no existe con esa ID";
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Error, Mascota no existe" + "');", true);
                }
            }
        }
示例#3
0
        protected void GridView1_rowDelete(object sender, GridViewDeleteEventArgs e)

        {
            //String Rut = GridView1.Rows[e.RowIndex].DataItem.ToString();

            string ID = GridView1.Rows[e.RowIndex].Cells[1].Text;

            if (!ID.Equals(""))

            {
                if (MascotaDAO.Eliminar(ID) == true)

                {
                    LabelOk.Text = "Mascota Eliminada";



                    LabelError.Text = "";

                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Mascota eliminada" + "');", true);
                }

                else

                {
                    LabelOk.Text = "";

                    LabelError.Text = "Error al Eliminar";

                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Error al eliminar" + "');", true);
                }
            }
        }
示例#4
0
        protected void CargarGrilla()
        {
            MascotaDAO mascotaDAO = new MascotaDAO();

            gvdListaMascotasBusquedaDoctor.DataSource = mascotaDAO.ConsultarMascotasActivasUsuario(int.Parse(Session["NumeroDocBuscadoDoctor"].ToString())).ToList();
            gvdListaMascotasBusquedaDoctor.DataBind();
        }
示例#5
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            string NombreMascota = txtNombre.Text;
            string Raza          = txtRaza.Text;
            string Especie       = txtEspecie.Text;
            string FechaNac      = TextBoxFechaNac.Text;
            string Genero        = DropDownListGenero.SelectedValue.ToString();
            string Foto          = TextBoxFoto.Text;
            string RutDueno      = TextBoxRutDueno.Text;


            if (!NombreMascota.Equals("") && !Raza.Equals("") && !FechaNac.Equals("") &&
                !Genero.Equals("") && !Foto.Equals("") && !RutDueno.Equals(""))
            {
                DataTable dt = MascotaDAO.Agregar(NombreMascota, Raza, DateTime.Parse(FechaNac), Genero, Foto, RutDueno, Especie);
                if (dt != null)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Bien, datos agregados correctamente" + "');", true);
                    LabelError.Text = "";
                    LabelOk.Text    = "Bien, paciente creado";
                }
                else
                {
                    LabelOk.Text    = "";
                    LabelError.Text = "Error, paciente ya existe";
                }
            }
            else
            {
                LabelOk.Text    = "";
                LabelError.Text = "Error, hay campos vacios";
            }
        }
示例#6
0
        protected void ButtonEliminar_Click(object sender, EventArgs e)
        {
            string NombreMascota = txtNombre.Text;
            string RutDueno      = TextBoxRutDueno.Text;


            if (!NombreMascota.Equals("") && !RutDueno.Equals(""))
            {
                DataTable dt = MascotaDAO.EliminarMascota(NombreMascota, RutDueno);
                if (dt != null)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Bien, datos eliminados correctamente" + "');", true);
                    LabelError.Text      = "";
                    LabelOk.Text         = "Bien, mascota eliminada creado";
                    txtNombre.Text       = "";
                    txtRaza.Text         = "";
                    txtEspecie.Text      = "";
                    TextBoxFechaNac.Text = "";
                    DropDownListGenero.SelectedValue.ToString();
                    TextBoxFoto.Text     = "";
                    TextBoxRutDueno.Text = "";
                }
                else
                {
                    LabelOk.Text    = "";
                    LabelError.Text = "Error, no existe mascota asociada al rut del dueño";
                }
            }
            else
            {
                LabelOk.Text    = "";
                LabelError.Text = "Error, hay campos vacios. Debe ingresar nombre y rut del dueño para poder eliminar";
            }
        }
示例#7
0
        protected void btnCrear_Click(object sender, EventArgs e)
        {
            Mascotas   mascotaDTO = new Mascotas();
            MascotaDAO mascotaDAO = new MascotaDAO();

            mascotaDTO.Tipo_documento_usuario = txtTipoDoc.Text;
            mascotaDTO.Cedula_usuario         = int.Parse(txtNumeroDoc.Text);
            mascotaDTO.Nombre             = txtNombre.Text;
            mascotaDTO.Raza               = txtRaza.Text;
            mascotaDTO.Especie            = txtEspecie.Text;
            mascotaDTO.Color              = txtColor.Text;
            mascotaDTO.Sexo               = ddlSexoMascota.SelectedValue;
            mascotaDTO.Señas_particulares = txtSeñas.Text;
            mascotaDTO.Fecha_nacimiento   = ClFechaNacimiento.SelectedDate;
            if (rbEstadoMascota.SelectedItem.Value.ToString() == "Activo")
            {
                mascotaDTO.ID_estado_mascota = 1;
            }
            else if (rbEstadoMascota.SelectedItem.Value.ToString() == "Inactivo")
            {
                mascotaDTO.ID_estado_mascota = 2;
            }


            bool registrado = mascotaDAO.RegistrarMascotas(mascotaDTO);

            if (registrado == true)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alarm", "create_success_modal()", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alarm", "create_fail_modal()", true);
            }
        }
        protected void gvdListaMascotas_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            GridViewRow fila   = (GridViewRow)((Control)e.CommandSource).NamingContainer;
            int         indice = fila.RowIndex;

            if (e.CommandName == "Eliminar")
            {
                int        idMascota  = int.Parse(gvdListaMascotas.Rows[indice].Cells[0].Text);
                MascotaDAO mascotaDAO = new MascotaDAO();
                bool       resultado  = mascotaDAO.EliminarMascota(idMascota);
                if (resultado == true)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alarm", "delete_success_modal()", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alarm", "delete_fail_modal()", true);
                }
                CargarGrillas();
            }

            if (e.CommandName == "Actualizar")
            {
                Session["idMascotaActualizar"] = gvdListaMascotas.Rows[indice].Cells[0].Text;
                Response.Redirect("ActualizarDatosMascotasAdmin.aspx");
                CargarGrillas();
            }
            if (e.CommandName == "Ver")
            {
                Session["idMascotaVer"] = gvdListaMascotas.Rows[indice].Cells[0].Text;
                Response.Redirect("VerInfoMascotaAdmin.aspx");
            }
        }
示例#9
0
        protected void BtnBuscar_Click(object sender, EventArgs e)
        {
            string ID = txtID.Text;


            if (!ID.Equals(""))
            {
                DataTable dt = MascotaDAO.BuscarInfoVet(ID);
                try
                {
                    if (dt != null)
                    {
                        GridView1.DataSource = dt;
                        GridView1.DataBind();
                        LabelOk.Text    = "Datos encontrados";
                        LabelError.Text = "";
                    }
                }
                catch (IndexOutOfRangeException)
                {
                    LabelOk.Text    = "";
                    LabelError.Text = "Error, no hay datos  no disponibles";
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Error, no hay datos disponibles" + "');", true);
                }
            }
        }
        protected void btnActualizar_Click(object sender, EventArgs e)
        {
            MascotaDAO mascotaDAO = new MascotaDAO();
            Mascotas   mascotaDTO = new Mascotas();

            mascotaDTO.ID_mascota             = (int.Parse(Session["idMascotaActualizar"].ToString()));
            mascotaDTO.Tipo_documento_usuario = (Session["tipoDocBusquedaPerfilAdmin"].ToString());
            mascotaDTO.Cedula_usuario         = (int.Parse(Session["numeroDocBusquedaPerfilAdmin"].ToString()));
            mascotaDTO.Nombre             = txtNombreMascota.Text;
            mascotaDTO.Especie            = txtEspecie.Text;
            mascotaDTO.Raza               = txtRazaMascota.Text;
            mascotaDTO.Color              = txtColorMascota.Text;
            mascotaDTO.Sexo               = ddlSexoMascota.SelectedValue;
            mascotaDTO.Señas_particulares = txtSeñasMascota.Text;
            mascotaDTO.Fecha_nacimiento   = ClFechaNacimiento.SelectedDate;
            if (rbEstadoMascota.SelectedItem.Value.ToString() == "Activo")
            {
                mascotaDTO.ID_estado_mascota = 1;
            }
            else
            {
                mascotaDTO.ID_estado_mascota = 2;
            }

            bool resultado = mascotaDAO.ActualizarMascotas(mascotaDTO);

            if (resultado == true)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alarm", "update_success_modal()", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alarm", "update_fail_modal()", true);
            }
        }
示例#11
0
        protected void CargarGrilla()
        {
            MascotaDAO mascotaDAO = new MascotaDAO();

            gvdListaMascotas.DataSource = mascotaDAO.ConsultarTodasUsuario(int.Parse(Session["cedula"].ToString())).ToList();
            gvdListaMascotas.DataBind();
        }
        protected void CargarGrillas()
        {
            MascotaDAO mascotaDAO = new MascotaDAO();

            gvdListaMascotas.DataSource = mascotaDAO.ConsultarMascotasActivasUsuario(int.Parse(Session["numeroDocBusquedaPerfilAdmin"].ToString())).ToList();
            gvdListaMascotas.DataBind();
            gvdListadoMascotasInactivas.DataSource = mascotaDAO.ConsultarMascotasInactivasUsuario(int.Parse(Session["numeroDocBusquedaPerfilAdmin"].ToString())).ToList();
            gvdListadoMascotasInactivas.DataBind();
        }
示例#13
0
        public void listar()

        {
            DataTable dt = MascotaDAO.ObtenerDatos();

            GridView1.DataSource = dt;

            GridView1.DataBind();
        }
        protected void btnActualizar_Click(object sender, EventArgs e)
        {
            MascotaDAO mascotaDAO = new MascotaDAO();
            Mascotas   mascotaDTO = new Mascotas();

            mascotaDTO.ID_mascota = int.Parse(txtIdMascota.Text);
            mascotaDTO.Nombre     = txtNombreMascota.Text;
            // igual con todos los atributos
            mascotaDAO.ActualizarMascotas(mascotaDTO);
            Response.Redirect("BusquedaUsuarioAdmin.aspx");
        }
示例#15
0
        public int guardar_Mascota(object obj)
        {
            oMascotaDAO = new MascotaDAO();
            int i = oMascotaDAO.guardarMascota(obj);

            if (i <= 0)
            {
                return(0);
            }
            return(1);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         MascotaDAO mascotaDAO = new MascotaDAO();
         Mascotas   mascotaDTO = mascotaDAO.ConsultaPorId(int.Parse(Session["idMascotaActualizar"].ToString()));
         txtIdMascota.Text     = mascotaDTO.ID_mascota.ToString();
         txtNombreMascota.Text = mascotaDTO.Nombre.ToString();
         // agregar los demas campos que deseo actualizar
     }
 }
示例#17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                MascotaDAO mascotaDAO = new MascotaDAO();
                Mascotas   mascotaDTO = mascotaDAO.ConsultaPorId(int.Parse(Session["idMascotaEscogidaDoctor"].ToString()));

                lblNombreMascota.Text = ("Hola! soy" + " " + mascotaDTO.Nombre);
                var genero = mascotaDTO.Sexo.ToLower() == "m" ? "Masculino" : "Femenino";
                lblTexto.Text = ("Soy un" + " " + mascotaDTO.Especie + " de Raza" + " " + mascotaDTO.Raza + "; Y soy de Sexo" + " " + genero + " . Naci el" + " " + mascotaDTO.Fecha_nacimiento.ToString("dd/MM/yyyy") + " y mi dueño se llama" + " " + mascotaDTO.Usuarios.Nombres + " " + mascotaDTO.Usuarios.Apellidos);
                CargarGrilla();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            MascotaDAO mascotaDAO = new MascotaDAO();
            Mascotas   mascotaDTO = mascotaDAO.ConsultaPorId(int.Parse(Session["idMascotaVer"].ToString()));

            txtNombreMascota.Text     = mascotaDTO.Nombre.ToString();
            txtEspecieMascota.Text    = mascotaDTO.Especie.ToString();
            txtRazaMascota.Text       = mascotaDTO.Raza.ToString();
            txtColorMascota.Text      = mascotaDTO.Color.ToString();
            txtSexoMascota.Text       = mascotaDTO.Sexo.ToString();
            txtSeñasParticulares.Text = mascotaDTO.Señas_particulares.ToString();
            txtFechaNacimiento.Text   = mascotaDTO.Fecha_nacimiento.ToString();
            txtEstado.Text            = mascotaDTO.Estados.Descripcion;
        }
示例#19
0
        protected void ddlMascota_SelectedIndexChanged(object sender, EventArgs e)
        {
            string Rut = txtRutDueno.Text;

            if (ddlMascota.SelectedItem != null)
            {
                txtNombreMascota.Text = ddlMascota.SelectedItem.Text.ToString();

                string Nombre = txtNombreMascota.Text;

                DataTable dt = MascotaDAO.BuscarFicha(Nombre, Rut);

                if (Nombre.ToString() != null)
                {
                    txtNombreMascota.Text      = dt.Rows[0][0].ToString();
                    txtRaza.Text               = dt.Rows[0][1].ToString();
                    txtEspecie.Text            = dt.Rows[0][2].ToString();
                    txtSexo.Text               = dt.Rows[0][3].ToString();
                    txtFechaNacimiento.Text    = dt.Rows[0][4].ToString();
                    txtPeso.Text               = dt.Rows[0][5].ToString();
                    txtTemperatura.Text        = dt.Rows[0][6].ToString();
                    txtFrecCardiaca.Text       = dt.Rows[0][7].ToString();
                    txtFrecRespiratoria.Text   = dt.Rows[0][8].ToString();
                    txtAnamnesis.InnerText     = dt.Rows[0][9].ToString();
                    txtSVitales.Text           = dt.Rows[0][10].ToString();
                    txtPDiagnostico.Text       = dt.Rows[0][11].ToString();
                    txtDiagnostico.Text        = dt.Rows[0][12].ToString();
                    txtPronostico.InnerText    = dt.Rows[0][13].ToString();
                    txtTratamiento.InnerText   = dt.Rows[0][14].ToString();
                    txtObservaciones.InnerText = dt.Rows[0][15].ToString();
                }



                DataTable dt1 = VacunaDAO.BuscarFicha(Nombre, Rut);
                gvVacunas.DataSource = dt1;
                gvVacunas.DataBind();

                DataTable dt2 = FarmacoDAO.BuscarFicha(Nombre, Rut);
                gvFarmacos.DataSource = dt2;
                gvFarmacos.DataBind();

                DataTable dt3 = ExamenDAO.BuscarFicha(Nombre, Rut);
                gvExamen.DataSource = dt3;
                gvExamen.DataBind();
            }
            else
            {
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         MascotaDAO mascotaDAO = new MascotaDAO();
         Mascotas   mascotaDTO = mascotaDAO.ConsultaPorId(int.Parse(Session["idMascotaActualizar"].ToString()));
         txtNombreMascota.Text          = mascotaDTO.Nombre;
         txtEspecie.Text                = mascotaDTO.Especie;
         txtRazaMascota.Text            = mascotaDTO.Raza;
         txtColorMascota.Text           = mascotaDTO.Color;
         ddlSexoMascota.SelectedValue   = mascotaDTO.Sexo;
         ClFechaNacimiento.SelectedDate = (DateTime)mascotaDTO.Fecha_nacimiento;
         txtSeñasMascota.Text           = mascotaDTO.Señas_particulares;
         rbEstadoMascota.SelectedIndex  = mascotaDTO.ID_estado_mascota == 1 ? 0 : 1;
     }
 }
示例#21
0
        protected void gvdListaMascotas_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            GridViewRow fila   = (GridViewRow)((Control)e.CommandSource).NamingContainer;
            int         indice = fila.RowIndex;

            if (e.CommandName == "Eliminar")
            {
                int        idMascota  = int.Parse(gvdListaMascotas.Rows[indice].Cells[0].Text);
                MascotaDAO mascotaDAO = new MascotaDAO();
                CargarGrilla();
                lblMensaje.Text = mascotaDAO.EliminarMascota(idMascota);
            }

            if (e.CommandName == "Actualizar")
            {
                Session["idMascotaActualizar"] = gvdListaMascotas.Rows[indice].Cells[0].Text;
                Response.Redirect("VerInfoMascotaAdmin.aspx");
            }
        }
        protected void gvdListadoMascotasInactivas_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            GridViewRow fila   = (GridViewRow)((Control)e.CommandSource).NamingContainer;
            int         indice = fila.RowIndex;

            if (e.CommandName == "Reactivar")
            {
                MascotaDAO mascotaDAO = new MascotaDAO();
                int        idMascota  = int.Parse(gvdListadoMascotasInactivas.Rows[indice].Cells[0].Text);
                bool       reactivar  = mascotaDAO.ReactivarMascota(idMascota);
                if (reactivar == true)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alarm", "activate_success_modal()", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alarm", "activate_fail_modal()", true);
                }
                CargarGrillas();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                MascotaDAO mascotaDAO = new MascotaDAO();
                Mascotas   mascotaDTO = mascotaDAO.ConsultaPorId(int.Parse(Session["idMascotaEscogidaDoctor"].ToString()));

                lblNombreMascota.Text = mascotaDTO.Nombre;
                lblRaza.Text          = mascotaDTO.Raza;

                if (mascotaDTO.Especie == "Perro")
                {
                    imgFotoMascota.ImageUrl = "~/Images/Perro_Perfil.jpg";
                }
                else if (mascotaDTO.Especie == "Gato")
                {
                    imgFotoMascota.ImageUrl = "~/Images/Perfil_gato.jpg";
                }
                else if (mascotaDTO.Especie == "Hamster")
                {
                    imgFotoMascota.ImageUrl = "~/Images/Raton_Perfil.jpg";
                }
                else
                {
                    imgFotoMascota.ImageUrl = "~/Images/Perfil_Otras mascotas.jpg";
                }

                DetalleHistoriaDAO detalleHistoriaDAO  = new DetalleHistoriaDAO();
                Detalle_historia   detalle_HistoriaDTO = detalleHistoriaDAO.ConsultarDetalle(int.Parse(Session["idDetalleHistoriaSelect"].ToString()));

                lblNombreDoctor.Text    = detalle_HistoriaDTO.Nombre_doctor;
                lblMotivoConsulta.Text  = detalle_HistoriaDTO.Motivo_consulta;
                lblDescripcionCaso.Text = detalle_HistoriaDTO.Descripcion_caso;
                lblAntecedentes.Text    = detalle_HistoriaDTO.Antecedentes;
                lblValoracion.Text      = detalle_HistoriaDTO.Valoracion_resultado;
                lblPrescripcion.Text    = detalle_HistoriaDTO.Prescripcion_medica;
                lblFechaConsulta.Text   = detalle_HistoriaDTO.Fecha_consulta_medica.ToShortDateString();
                lblProximaConsulta.Text = detalle_HistoriaDTO.Fecha_proxima_consulta.ToString();
            }
        }
示例#24
0
        protected void btnActualizar_Click(object sender, EventArgs e)
        {
            string Rut    = txtRutDueno.Text;
            string nombre = txtNombreMascota.Text;

            int    peso          = int.Parse(txtPeso.Text);
            int    temperatura   = int.Parse(txtTemperatura.Text);
            int    fcardiaca     = int.Parse(txtFrecCardiaca.Text);
            int    frespiratoria = int.Parse(txtFrecRespiratoria.Text);
            string anamnesis     = txtAnamnesis.InnerText;
            string svitale       = txtSVitales.Text;
            string pdiagnostico  = txtPDiagnostico.InnerText;
            string diagnostivo   = txtDiagnostico.InnerText;
            string pronostico    = txtPronostico.InnerText;
            string tratamiento   = txtTratamiento.InnerText;
            string observaciones = txtObservaciones.InnerText;

            DataTable dt = MascotaDAO.ActualizarFicha(nombre, Rut, peso, temperatura, fcardiaca, frespiratoria, anamnesis, svitale, pdiagnostico, diagnostivo, pronostico, tratamiento, observaciones);

            if (dt != null)
            {
                LabelOk.Text = "Ficha actualizada" + dt;
            }
        }