protected void rptParentescoInactivo_OnItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Activar")
        {
            HiddenField hdnIdParentesco = new HiddenField();
            hdnIdParentesco = (HiddenField)e.Item.FindControl("hdnIdParentesco");

            ParentescoDTO theParentescoDTO = new ParentescoDTO();
            theParentescoDTO.IdParentesco        = decimal.Parse(hdnIdParentesco.Value);
            theParentescoDTO.UsuarioModificacion = myUsuario.Rut;
            bool respuesta = YouCom.bll.ParentescoBLL.ActivaParentesco(theParentescoDTO);
            if (respuesta)
            {
                cargarParentescoInactivo();
                if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                {
                    string script = "alert('Parentesco activado correctamente.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                }
            }
            else
            {
            }
        }
    }
    protected void btnEditar_Click(object sender, EventArgs e)
    {
        btnEditar.Visible = false;
        btnGrabar.Visible = true;

        ParentescoDTO theParentescoDTO = new ParentescoDTO();

        theParentescoDTO.IdParentesco        = decimal.Parse(this.hdnIdParentesco.Value);
        theParentescoDTO.NombreParentesco    = this.txtNombre.Text;
        theParentescoDTO.UsuarioModificacion = myUsuario.Rut;
        bool respuesta = YouCom.bll.ParentescoBLL.Update(theParentescoDTO);

        if (respuesta)
        {
            cargarParentesco();
            this.txtNombre.Text = string.Empty;

            if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
            {
                string script = "alert('Parentesco editada correctamente.');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
            }
        }
        else
        {
        }
    }
    protected void rptParentesco_OnItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Editar")
        {
            HiddenField hdnIdParentesco = new HiddenField();
            hdnIdParentesco = (HiddenField)e.Item.FindControl("hdnIdParentesco");

            YouCom.DTO.Propietario.ParentescoDTO theParentescoDTO = new YouCom.DTO.Propietario.ParentescoDTO();
            theParentescoDTO = YouCom.bll.ParentescoBLL.detalleParentesco(decimal.Parse(hdnIdParentesco.Value));

            this.hdnIdParentesco.Value = theParentescoDTO.IdParentesco.ToString();
            txtNombre.Text             = theParentescoDTO.NombreParentesco;

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

            ParentescoDTO theParentescoDTO = new ParentescoDTO();
            theParentescoDTO.IdParentesco        = decimal.Parse(hdnIdParentesco.Value);
            theParentescoDTO.UsuarioModificacion = myUsuario.Rut;

            bool validacionIntegridad = YouCom.bll.ParentescoBLL.ValidaEliminacionParentesco(theParentescoDTO);
            if (validacionIntegridad)
            {
                string script = "alert(' No es posible eliminar un Parentesco con integrante de familia asociado.');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                return;
            }
            else
            {
                bool respuesta = YouCom.bll.ParentescoBLL.Delete(theParentescoDTO);
                if (respuesta)
                {
                    cargarParentesco();
                    if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                    {
                        string script = "alert('Parentesco Eliminada correctamente.');";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                    }
                }
                else
                {
                }
            }
        }
    }
    protected void btnGrabar_Click(object sender, EventArgs e)
    {
        IList <ParentescoDTO> Parentesco = new List <ParentescoDTO>();

        Parentesco = (Session["Parentesco"] as List <ParentescoDTO>);

        ParentescoDTO theParentescoDTO = new ParentescoDTO();

        theParentescoDTO.NombreParentesco = this.txtNombre.Text.ToUpper();
        theParentescoDTO.UsuarioIngreso   = myUsuario.Rut;

        Parentesco = Parentesco.Where(x => x.NombreParentesco == theParentescoDTO.NombreParentesco).ToList();
        if (Parentesco.Any())
        {
            foreach (var item in Parentesco)
            {
                if (item.Estado == "2")
                {
                    string script = "alert('Ocupación Existe pero Fue Eliminado Para Activarlo dirigase a Papelera.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                    return;
                }
                else
                {
                    string script = "alert('Ocupación ya Existe .');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                    return;
                }
            }
        }

        bool respuesta = YouCom.bll.ParentescoBLL.Insert(theParentescoDTO);

        if (respuesta)
        {
            this.txtNombre.Text = string.Empty;
            string script = "alert('Parentesco Ingresada correctamente.');";
            Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
            cargarParentesco();
        }
        else
        {
        }
    }
Esempio n. 5
0
        public bool Salvar(ParentescoDTO dto)
        {
            if (dto == null)
            {
                throw new ArgumentNullException("dto");
            }

            bool novoItem = false;

            var parentesco = parentescoRepository.ObterPeloId(dto.Id);

            if (parentesco == null)
            {
                parentesco = new Parentesco();
                novoItem   = true;
            }

            parentesco.Descricao  = dto.Descricao;
            parentesco.Automatico = dto.Automatico;

            if (Validator.IsValid(parentesco, out validationErrors))
            {
                if (novoItem)
                {
                    parentescoRepository.Inserir(parentesco);
                }
                else
                {
                    parentescoRepository.Alterar(parentesco);
                }

                parentescoRepository.UnitOfWork.Commit();
                messageQueue.Add(Resource.Sigim.SuccessMessages.SalvoComSucesso, TypeMessage.Success);
                return(true);
            }
            else
            {
                messageQueue.AddRange(validationErrors, TypeMessage.Error);
            }

            return(false);
        }
Esempio n. 6
0
        public static bool ValidaEliminacionParentesco(ParentescoDTO theParentescoDTO)
        {
            bool respuesta = facade.Parentesco.ValidaEliminacionParentesco(theParentescoDTO);

            return(respuesta);
        }
Esempio n. 7
0
        public static bool ActivaParentesco(ParentescoDTO theParentescoDTO)
        {
            bool respuesta = YouCom.DAL.ParentescoDAL.ActivaParentesco(theParentescoDTO);

            return(respuesta);
        }
Esempio n. 8
0
        public static bool Delete(ParentescoDTO theParentescoDTO)
        {
            bool resultado = ParentescoDAL.Delete(theParentescoDTO);

            return(resultado);
        }