protected void BtnEnviar_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO();

                myFamiliaDTO = YouCom.bll.FamiliaBLL.detalleFamiliabyRut(myUsuario.Rut);

                YouCom.DTO.ContactoFamiliaDTO myContactoFamiliaDTO = new YouCom.DTO.ContactoFamiliaDTO();
                //myContactoFamiliaDTO.TheCondominioDTO = myUsuario.TheCondominioSeleccionDTO;
                //myContactoFamiliaDTO.TheComunidadDTO = myUsuario.TheComunidadSeleccionDTO;
                myContactoFamiliaDTO.TheCasaDTO = myFamiliaDTO.TheCasaDTO;

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

                myContactoFamiliaDTO.TheParentescoDTO = myParentescoDTO;

                myContactoFamiliaDTO.NombreContacto   = this.TxtNombreIntegrante.Text;
                myContactoFamiliaDTO.TelefonoContacto = this.TxtTelefonoIntegrante.Text;
                myContactoFamiliaDTO.EmailContacto    = this.TxtEmailIntegrante.Text;
                myContactoFamiliaDTO.UsuarioIngreso   = myUsuario.Rut;

                bool respuesta = YouCom.bll.ContactoFamiliaBLL.Insert(myContactoFamiliaDTO);
                if (respuesta)
                {
                    if (enviarMail())
                    {
                        if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                        {
                            string script = "alert('Estimado Cliente, hemos recibido su mensaje, en breve nos contactaremos con usted.');";
                            script += "parent.location = '" + retorno1 + "';";
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                        }
                    }
                    else
                    {
                        if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                        {
                            string script = "alert('A ocurrido un error. Favor envíe su solicitud al mail [email protected] intente más tarde.');";
                            script += "parent.location = '" + retorno1 + "';";
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }
    protected void BtnEnviar_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                YouCom.DTO.VacacionesDTO myVacacionesDTO = new YouCom.DTO.VacacionesDTO();

                myVacacionesDTO.DestinoVacaciones = this.TxtComentarios.Text;
                myVacacionesDTO.FechaInicio       = DateTime.ParseExact(this.TxtDesde.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture);
                myVacacionesDTO.FechaTermino      = DateTime.ParseExact(this.TxtHasta.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture);
                myVacacionesDTO.TheCasaDTO        = myUsuario.TheFamiliaDTO.TheCasaDTO;
                myVacacionesDTO.TheCondominioDTO  = myUsuario.TheCondominioSeleccionDTO;
                myVacacionesDTO.TheComunidadDTO   = myUsuario.TheComunidadSeleccionDTO;

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

                myVacacionesDTO.TheParentescoDTO = myParentescoDTO;
                myVacacionesDTO.NombreContacto   = this.TxtNombreContacto.Text;
                myVacacionesDTO.TelefonoContacto = this.TxtTelefonoContacto.Text;

                myVacacionesDTO.UsuarioIngreso = myUsuario.Rut;

                bool respuesta = YouCom.bll.VacacionesBLL.Insert(myVacacionesDTO);
                if (respuesta)
                {
                    if (enviarMail())
                    {
                        if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                        {
                            string script = "alert('Estimado Cliente, hemos recibido su mensaje, en breve nos contactaremos con usted.');";
                            script += "parent.location = '" + retorno1 + "';";
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                        }
                    }
                    else
                    {
                        if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                        {
                            string script = "alert('A ocurrido un error. Favor envíe su solicitud al mail [email protected] intente más tarde.');";
                            script += "parent.location = '" + retorno1 + "';";
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }
    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
                {
                }
            }
        }
    }
Esempio n. 4
0
    protected void rptNucleoFamiliar_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        try
        {
            if (e.Item.ItemIndex > -1)
            {
                if (!string.IsNullOrEmpty(((YouCom.DTO.ContactoFamiliaDTO)e.Item.DataItem).IdContactoFamilia.ToString()))
                {
                    Literal myLitParentesco = new Literal();

                    myLitParentesco = (Literal)e.Item.FindControl("LitParentesco");

                    YouCom.DTO.Propietario.ParentescoDTO myParentescoDTO = new YouCom.DTO.Propietario.ParentescoDTO();

                    myParentescoDTO = YouCom.bll.ParentescoBLL.detalleParentesco(((YouCom.DTO.ContactoFamiliaDTO)e.Item.DataItem).TheParentescoDTO.IdParentesco);

                    myLitParentesco.Text = myParentescoDTO.NombreParentesco.ToString();
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
Esempio n. 5
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
        {
        }
    }
Esempio n. 6
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
        {
        }
    }