Example #1
0
    protected void rptFamiliaInactivo_OnItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Activar")
        {
            HiddenField hdnIdFamilia = new HiddenField();
            hdnIdFamilia = (HiddenField)e.Item.FindControl("hdnIdFamilia");

            FamiliaDTO theFamiliaDTO = new FamiliaDTO();
            theFamiliaDTO.IdFamilia           = decimal.Parse(hdnIdFamilia.Value);
            theFamiliaDTO.UsuarioModificacion = myUsuario.Rut;
            bool respuesta = YouCom.bll.FamiliaBLL.ActivaFamilia(theFamiliaDTO);
            if (respuesta)
            {
                cargarFamiliaInactivo();
                if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                {
                    string script = "alert('Integrante de la Familia Activado correctamente.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                }
            }
            else
            {
            }
        }
    }
        public async Task AddAsync(FamiliaDTO obj)
        {
            try
            {
                var objNew = Mapeador.Mapear <FamiliaDTO, Familia>(obj);

                await _serviceFamilia.AddAsync(objNew);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void Update(FamiliaDTO obj)
        {
            try
            {
                var objNew = Mapeador.Mapear <FamiliaDTO, Familia>(obj);

                _serviceFamilia.Update(objNew);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #4
0
        public IActionResult Post([FromBody] FamiliaDTO Familia)
        {
            try
            {
                if (Familia == null || (string.IsNullOrEmpty(Familia.Nome)))
                {
                    return(NotFound());
                }

                _applicationServiceFamilia.Add(Familia);
                return(Ok("Familia cadastrada com sucesso!"));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal Server Error"));
            }
        }
Example #5
0
        public ActionResult PutPut(int id, [FromBody] FamiliaDTO Familia)
        {
            try
            {
                if (Familia == null)
                {
                    return(NotFound());
                }

                _applicationServiceFamilia.Update(Familia);

                return(Ok("Familia atualizada com sucesso!"));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #6
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var familia = await _applicationServiceFamilia.GetByIdAsync(id);

                if (familia is null)
                {
                    return(NotFound());
                }

                var familiaNew = new FamiliaDTO {
                    Id = id
                };

                _applicationServiceFamilia.Remove(familiaNew);
                return(Ok("Familia removido com sucesso!"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #7
0
        public static bool ValidaEliminacionFamilia(FamiliaDTO theFamiliaDTO)
        {
            bool respuesta = facade.Familia.ValidaEliminacionFamilia(theFamiliaDTO);

            return(respuesta);
        }
Example #8
0
        public static bool ActivaFamilia(FamiliaDTO theFamiliaDTO)
        {
            bool respuesta = YouCom.DAL.FamiliaDAL.ActivaFamilia(theFamiliaDTO);

            return(respuesta);
        }
        public void Remove(FamiliaDTO obj)
        {
            var objNew = Mapeador.Mapear <FamiliaDTO, Familia>(obj);

            _serviceFamilia.Remove(objNew);
        }
Example #10
0
    protected void btnGrabar_Click(object sender, EventArgs e)
    {
        UserControl  wucCondominio = (UserControl)Page.Master.FindControl("ContentPlaceHolder1").FindControl("wucCondominio1");
        DropDownList ddlCondominio = (DropDownList)wucCondominio.FindControl("ddlCondominio");
        DropDownList ddlComunidad  = (DropDownList)wucCondominio.FindControl("ddlComunidad");

        List <FamiliaDTO> familia = new List <FamiliaDTO>();

        familia = (Session["familia"] as List <FamiliaDTO>);

        FamiliaDTO theFamiliaDTO = new FamiliaDTO();

        theFamiliaDTO.RutFamilia             = this.txtRut.Text.ToUpper();
        theFamiliaDTO.NombreFamilia          = this.txtNombre.Text.ToUpper();
        theFamiliaDTO.ApellidoPaternoFamilia = this.txtApellidoPaterno.Text.ToUpper();
        theFamiliaDTO.ApellidoMaternoFamilia = this.txtApellidoMaterno.Text.ToUpper();
        theFamiliaDTO.TelefonoFamilia        = this.txtTelefono.Text;
        theFamiliaDTO.EmailFamilia           = this.txtEmail.Text;
        theFamiliaDTO.CelularFamilia         = this.txtCelular.Text;

        YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO();
        myCondominioDTO.IdCondominio   = decimal.Parse(ddlCondominio.SelectedValue);
        theFamiliaDTO.TheCondominioDTO = myCondominioDTO;

        YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO();
        myComunidadDTO.IdComunidad    = decimal.Parse(ddlComunidad.SelectedValue);
        theFamiliaDTO.TheComunidadDTO = myComunidadDTO;

        YouCom.DTO.Propietario.ParentescoDTO myParentescoDTO = new YouCom.DTO.Propietario.ParentescoDTO();
        myParentescoDTO.IdParentesco   = decimal.Parse(ddlParentesco.SelectedValue);
        theFamiliaDTO.TheParentescoDTO = myParentescoDTO;

        YouCom.DTO.Propietario.OcupacionDTO myOcupacionDTO = new YouCom.DTO.Propietario.OcupacionDTO();
        myOcupacionDTO.IdOcupacion    = decimal.Parse(ddlOcupacion.SelectedValue);
        theFamiliaDTO.TheOcupacionDTO = myOcupacionDTO;

        YouCom.DTO.Propietario.CasaDTO myCasaDTO = new YouCom.DTO.Propietario.CasaDTO();
        myCasaDTO.IdCasa         = decimal.Parse(ddlCasa.SelectedValue);
        theFamiliaDTO.TheCasaDTO = myCasaDTO;

        theFamiliaDTO.UsuarioIngreso = myUsuario.Rut;

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

        bool respuesta = YouCom.bll.FamiliaBLL.Insert(theFamiliaDTO);

        if (respuesta)
        {
            this.txtNombre.Text          = string.Empty;
            this.txtRut.Text             = string.Empty;
            this.txtApellidoPaterno.Text = string.Empty;
            this.txtApellidoMaterno.Text = string.Empty;
            this.txtTelefono.Text        = string.Empty;
            this.txtEmail.Text           = string.Empty;
            this.txtCelular.Text         = string.Empty;
            this.ddlCasa.ClearSelection();
            this.ddlOcupacion.ClearSelection();
            this.ddlParentesco.ClearSelection();

            string script = "alert('Familia Ingresada correctamente.');";
            Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
            cargarFamilia();
        }
        else
        {
        }
    }
Example #11
0
    protected void rptFamilia_OnItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        UserControl  wucCondominio = (UserControl)Page.Master.FindControl("ContentPlaceHolder1").FindControl("wucCondominio1");
        DropDownList ddlCondominio = (DropDownList)wucCondominio.FindControl("ddlCondominio");
        DropDownList ddlComunidad  = (DropDownList)wucCondominio.FindControl("ddlComunidad");

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

            YouCom.DTO.Propietario.FamiliaDTO theFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO();
            theFamiliaDTO = YouCom.bll.FamiliaBLL.detalleFamilia(decimal.Parse(hdnIdFamilia.Value));

            this.hdnIdFamilia.Value = theFamiliaDTO.IdFamilia.ToString();
            txtNombre.Text          = theFamiliaDTO.NombreFamilia;
            txtApellidoPaterno.Text = theFamiliaDTO.ApellidoPaternoFamilia;
            txtApellidoMaterno.Text = theFamiliaDTO.ApellidoMaternoFamilia;
            txtEmail.Text           = theFamiliaDTO.EmailFamilia;
            txtTelefono.Text        = theFamiliaDTO.TelefonoFamilia;
            txtCelular.Text         = theFamiliaDTO.CelularFamilia;
            this.txtRut.Text        = YouCom.Service.Generales.Formato.FormatoRut(theFamiliaDTO.RutFamilia);

            ddlOcupacion.SelectedIndex  = ddlOcupacion.Items.IndexOf(ddlOcupacion.Items.FindByValue(theFamiliaDTO.TheOcupacionDTO.IdOcupacion.ToString()));
            ddlParentesco.SelectedIndex = ddlParentesco.Items.IndexOf(ddlParentesco.Items.FindByValue(theFamiliaDTO.TheParentescoDTO.IdParentesco.ToString()));

            ddlCondominio.SelectedIndex = ddlCondominio.Items.IndexOf(ddlCondominio.Items.FindByValue(theFamiliaDTO.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(theFamiliaDTO.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));

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

            FamiliaDTO theFamiliaDTO = new FamiliaDTO();
            theFamiliaDTO.IdFamilia           = decimal.Parse(hdnIdFamilia.Value);
            theFamiliaDTO.UsuarioModificacion = myUsuario.Rut;

            bool validacionIntegridad = YouCom.bll.FamiliaBLL.ValidaEliminacionFamilia(theFamiliaDTO);
            if (validacionIntegridad)
            {
                string script = "alert(' No es posible eliminar una familia con informacion asociada.');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                return;
            }
            else
            {
                bool respuesta = YouCom.bll.FamiliaBLL.Delete(theFamiliaDTO);
                if (respuesta)
                {
                    cargarFamilia();
                    if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                    {
                        string script = "alert('Integrante Familia Eliminada correctamente.');";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                    }
                }
                else
                {
                }
            }
        }
    }
Example #12
0
    protected void btnEditar_Click(object sender, EventArgs e)
    {
        UserControl  wucCondominio = (UserControl)Page.Master.FindControl("ContentPlaceHolder1").FindControl("wucCondominio1");
        DropDownList ddlCondominio = (DropDownList)wucCondominio.FindControl("ddlCondominio");
        DropDownList ddlComunidad  = (DropDownList)wucCondominio.FindControl("ddlComunidad");

        btnEditar.Visible = false;
        btnGrabar.Visible = true;

        FamiliaDTO theFamiliaDTO = new FamiliaDTO();

        theFamiliaDTO.IdFamilia              = decimal.Parse(this.hdnIdFamilia.Value);
        theFamiliaDTO.RutFamilia             = YouCom.Service.Generales.Formato.LimpiarRut(this.txtRut.Text.ToUpper());
        theFamiliaDTO.NombreFamilia          = this.txtNombre.Text.ToUpper();
        theFamiliaDTO.ApellidoPaternoFamilia = this.txtApellidoPaterno.Text.ToUpper();
        theFamiliaDTO.ApellidoMaternoFamilia = this.txtApellidoMaterno.Text.ToUpper();
        theFamiliaDTO.EmailFamilia           = this.txtEmail.Text.ToUpper();
        theFamiliaDTO.TelefonoFamilia        = this.txtTelefono.Text.ToUpper();
        theFamiliaDTO.CelularFamilia         = this.txtCelular.Text;

        YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO();
        myCondominioDTO.IdCondominio   = decimal.Parse(ddlCondominio.SelectedValue);
        theFamiliaDTO.TheCondominioDTO = myCondominioDTO;

        YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO();
        myComunidadDTO.IdComunidad    = decimal.Parse(ddlComunidad.SelectedValue);
        theFamiliaDTO.TheComunidadDTO = myComunidadDTO;

        YouCom.DTO.Propietario.ParentescoDTO myParentescoDTO = new YouCom.DTO.Propietario.ParentescoDTO();
        myParentescoDTO.IdParentesco   = decimal.Parse(ddlParentesco.SelectedValue);
        theFamiliaDTO.TheParentescoDTO = myParentescoDTO;

        YouCom.DTO.Propietario.OcupacionDTO myOcupacionDTO = new YouCom.DTO.Propietario.OcupacionDTO();
        myOcupacionDTO.IdOcupacion    = decimal.Parse(ddlOcupacion.SelectedValue);
        theFamiliaDTO.TheOcupacionDTO = myOcupacionDTO;

        YouCom.DTO.Propietario.CasaDTO myCasaDTO = new YouCom.DTO.Propietario.CasaDTO();
        myCasaDTO.IdCasa         = decimal.Parse(ddlCasa.SelectedValue);
        theFamiliaDTO.TheCasaDTO = myCasaDTO;

        theFamiliaDTO.UsuarioModificacion = myUsuario.Rut;
        bool respuesta = YouCom.bll.FamiliaBLL.Update(theFamiliaDTO);

        if (respuesta)
        {
            cargarFamilia();
            this.txtNombre.Text          = string.Empty;
            this.txtRut.Text             = string.Empty;
            this.txtApellidoPaterno.Text = string.Empty;
            this.txtApellidoMaterno.Text = string.Empty;
            this.txtTelefono.Text        = string.Empty;
            this.txtEmail.Text           = string.Empty;
            this.txtCelular.Text         = string.Empty;
            this.ddlCasa.ClearSelection();
            this.ddlOcupacion.ClearSelection();
            this.ddlParentesco.ClearSelection();

            if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
            {
                string script = "alert('Familia editada correctamente.');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
            }
        }
        else
        {
        }
    }