protected void rptAutorizaciones_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            if (e.CommandName.Equals("Eliminar"))
            {
                HiddenField HdnIdAccesoHogar = (HiddenField)e.Item.FindControl("HdnIdAccesoHogar");

                YouCom.DTO.AccesoHogar.AccesoHogarDTO myAccesoHogarDTO = new YouCom.DTO.AccesoHogar.AccesoHogarDTO();

                myAccesoHogarDTO.IdAccesoHogar       = decimal.Parse(HdnIdAccesoHogar.Value);
                myAccesoHogarDTO.UsuarioModificacion = myUsuario.Rut;

                if (YouCom.bll.AccesoHogar.AccesoHogarBLL.Delete(myAccesoHogarDTO))
                {
                    if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                    {
                        string script = "alert('Autorización eliminada correctamente.');";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                    }
                }
            }

            if (e.CommandName.Equals("ListaNegra"))
            {
                HiddenField HdnIdAccesoHogar = (HiddenField)e.Item.FindControl("HdnIdAccesoHogar");

                YouCom.DTO.AccesoHogar.AccesoHogarDTO theAccesoHogarDTO = new YouCom.DTO.AccesoHogar.AccesoHogarDTO();
                YouCom.DTO.Propietario.FamiliaDTO     theFamiliaDTO     = new YouCom.DTO.Propietario.FamiliaDTO();

                theFamiliaDTO     = YouCom.bll.FamiliaBLL.detalleFamiliabyRut(myUsuario.Rut);
                theAccesoHogarDTO = YouCom.bll.AccesoHogar.AccesoHogarBLL.detalleAccesoHogar(decimal.Parse(HdnIdAccesoHogar.Value));

                YouCom.DTO.ListaNegraDTO theListaNegraDTO = new YouCom.DTO.ListaNegraDTO();
                theListaNegraDTO.RutListaNegra             = YouCom.Service.Generales.Formato.LimpiarRut(theAccesoHogarDTO.RutVisita.ToUpper());
                theListaNegraDTO.NombreListaNegra          = theAccesoHogarDTO.NombreVisita.ToUpper();
                theListaNegraDTO.ApellidoPaternoListaNegra = "";
                theListaNegraDTO.ApellidoMaternoListaNegra = "";
                theListaNegraDTO.MotivoListaNegra          = "";
                theListaNegraDTO.TheCondominioDTO          = myUsuario.TheCondominioSeleccionDTO;
                theListaNegraDTO.TheComunidadDTO           = myUsuario.TheComunidadSeleccionDTO;
                theListaNegraDTO.TheFamiliaDTO             = theFamiliaDTO;
                theListaNegraDTO.UsuarioIngreso            = myUsuario.Rut;

                bool respuesta = YouCom.bll.ListaNegraBLL.Insert(theListaNegraDTO);
                if (respuesta)
                {
                    string script = "alert('Autorización agregada como lista negra correctamente.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                }
                else
                {
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void rptListaNegra_OnItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        UserControl  wucCondominio = (UserControl)Page.Master.FindControl("ContentPlaceHolder1").FindControl("wucCondominioCasaFamilia1");
        DropDownList ddlCondominio = (DropDownList)wucCondominio.FindControl("ddlCondominio");
        DropDownList ddlComunidad  = (DropDownList)wucCondominio.FindControl("ddlComunidad");
        DropDownList ddlCasa       = (DropDownList)wucCondominio.FindControl("ddlCasa");
        DropDownList ddlFamilia    = (DropDownList)wucCondominio.FindControl("ddlFamilia");

        if (e.CommandName == "Editar")
        {
            HiddenField hdnIdListaNegra = new HiddenField();
            hdnIdListaNegra = (HiddenField)e.Item.FindControl("hdnIdListaNegra");

            YouCom.DTO.ListaNegraDTO theListaNegraDTO = new YouCom.DTO.ListaNegraDTO();
            theListaNegraDTO = YouCom.bll.ListaNegraBLL.detalleListaNegra(decimal.Parse(hdnIdListaNegra.Value));

            this.hdnIdListaNegra.Value   = theListaNegraDTO.IdListaNegra.ToString();
            this.txtNombre.Text          = theListaNegraDTO.NombreListaNegra;
            this.txtRut.Text             = YouCom.Service.Generales.Formato.FormatoRut(theListaNegraDTO.RutListaNegra);
            this.txtApellidoPaterno.Text = theListaNegraDTO.ApellidoPaternoListaNegra;
            this.txtApellidoMaterno.Text = theListaNegraDTO.ApellidoMaternoListaNegra;
            this.txtMotivo.Text          = theListaNegraDTO.MotivoListaNegra;

            ddlCondominio.SelectedIndex = ddlCondominio.Items.IndexOf(ddlCondominio.Items.FindByValue(theListaNegraDTO.TheCondominioDTO.IdCondominio.ToString()));

            ddlComunidad.DataSource     = YouCom.bll.ComunidadBLL.getListadoComunidadByCondominio(decimal.Parse(ddlCondominio.SelectedValue));
            ddlComunidad.DataTextField  = "NombreComunidad";
            ddlComunidad.DataValueField = "IdComunidad";
            ddlComunidad.DataBind();
            ddlComunidad.Items.Insert(0, new ListItem("Seleccione Comunidad", string.Empty));

            ddlComunidad.SelectedIndex = ddlComunidad.Items.IndexOf(ddlComunidad.Items.FindByValue(theListaNegraDTO.TheComunidadDTO.IdComunidad.ToString()));

            ddlCasa.DataSource     = YouCom.bll.CasaBLL.getListadoCasaByComunidad(decimal.Parse(ddlComunidad.SelectedValue));
            ddlCasa.DataTextField  = "NombreCasa";
            ddlCasa.DataValueField = "IdCasa";
            ddlCasa.DataBind();
            ddlCasa.Items.Insert(0, new ListItem("Seleccione Casa", string.Empty));

            YouCom.DTO.Propietario.FamiliaDTO theFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO();
            theFamiliaDTO = YouCom.bll.FamiliaBLL.detalleFamilia(theListaNegraDTO.TheFamiliaDTO.IdFamilia);

            ddlCasa.SelectedIndex = ddlCasa.Items.IndexOf(ddlCasa.Items.FindByValue(theFamiliaDTO.TheCasaDTO.IdCasa.ToString()));

            List <YouCom.DTO.Propietario.FamiliaDTO> familias = new List <YouCom.DTO.Propietario.FamiliaDTO>();
            familias = YouCom.bll.FamiliaBLL.listaFamiliaActivo().Where(x => x.TheCasaDTO.IdCasa == decimal.Parse(ddlCasa.SelectedValue)).ToList();

            ddlFamilia.DataSource     = familias;
            ddlFamilia.DataTextField  = "NombreCompleto";
            ddlFamilia.DataValueField = "IdFamilia";
            ddlFamilia.DataBind();
            ddlFamilia.Items.Insert(0, new ListItem("Seleccione Integrante Familia", string.Empty));

            ddlFamilia.SelectedIndex = ddlFamilia.Items.IndexOf(ddlFamilia.Items.FindByValue(theListaNegraDTO.TheFamiliaDTO.IdFamilia.ToString()));

            btnGrabar.Visible = false;
            btnEditar.Visible = true;
        }
        if (e.CommandName == "Eliminar")
        {
            HiddenField hdnIdListaNegra = new HiddenField();
            hdnIdListaNegra = (HiddenField)e.Item.FindControl("hdnIdListaNegra");

            ListaNegraDTO theListaNegraDTO = new ListaNegraDTO();
            theListaNegraDTO.IdListaNegra        = decimal.Parse(hdnIdListaNegra.Value);
            theListaNegraDTO.UsuarioModificacion = myUsuario.Rut;

            bool respuesta = YouCom.bll.ListaNegraBLL.Delete(theListaNegraDTO);
            if (respuesta)
            {
                cargarListaNegra();
                if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                {
                    string script = "alert('Lista Negra Eliminada correctamente.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                }
            }
            else
            {
            }
        }
    }