Exemplo n.º 1
0
    protected void btnResponder_Click(object sender, EventArgs 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");

        btnResponder.Visible = false;
        btnGrabar.Visible    = true;

        MensajeDirectivaDTO theMensajeDirectivaDTO = new MensajeDirectivaDTO();

        theMensajeDirectivaDTO.MensajeTitulo      = this.txtTituloMensaje.Text.ToUpper();
        theMensajeDirectivaDTO.MensajeDescripcion = this.txtMensaje.Text.ToUpper();
        theMensajeDirectivaDTO.MensajeFecha       = DateTime.Now;
        theMensajeDirectivaDTO.IdPadre            = decimal.Parse(this.hdnIdMensajeDirectiva.Value);

        YouCom.DTO.Mensajeria.MensajeTipoEnvioDTO myMensajeTipoEnvioDTO = new YouCom.DTO.Mensajeria.MensajeTipoEnvioDTO();
        myMensajeTipoEnvioDTO.IdMensajeTipoEnvio      = 2;
        theMensajeDirectivaDTO.TheMensajeTipoEnvioDTO = myMensajeTipoEnvioDTO;

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

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

        YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO();
        myFamiliaDTO.IdFamilia = decimal.Parse(ddlFamilia.SelectedValue);
        theMensajeDirectivaDTO.TheFamiliaDTO = myFamiliaDTO;

        YouCom.DTO.DirectivaDTO myDirectivaDTO = new YouCom.DTO.DirectivaDTO();
        myDirectivaDTO.IdDirectiva             = decimal.Parse(ddlDirectiva.SelectedValue);
        theMensajeDirectivaDTO.TheDirectivaDTO = myDirectivaDTO;

        theMensajeDirectivaDTO.UsuarioIngreso = myUsuario.Rut;

        bool respuesta = YouCom.bll.Mensajeria.MensajeDirectivaBLL.Insert(theMensajeDirectivaDTO);

        if (respuesta)
        {
            cargarMensajeDirectiva();
            this.txtTituloMensaje.Text = string.Empty;
            this.txtMensaje.Text       = string.Empty;

            if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
            {
                string script = "alert('Mensaje respondido correctamente.');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
            }
        }
        else
        {
        }
    }
Exemplo n.º 2
0
        public static IList <YouCom.DTO.DirectivaDTO> getListadoDirectiva()
        {
            IList <YouCom.DTO.DirectivaDTO> IDirectiva = new List <YouCom.DTO.DirectivaDTO>();

            DataTable pobjDataTable = new DataTable();

            if (YouCom.DAL.DirectivaDAL.getListadoDirectiva(ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    YouCom.DTO.DirectivaDTO directiva = new YouCom.DTO.DirectivaDTO();

                    directiva.IdDirectiva = decimal.Parse(wobjDataRow["idDirectiva"].ToString());

                    YouCom.DTO.CargoDTO myCargoDTO = new YouCom.DTO.CargoDTO();
                    myCargoDTO.IdCargo     = decimal.Parse(wobjDataRow["idCargo"].ToString());
                    myCargoDTO.NombreCargo = wobjDataRow["nombreCargo"].ToString();
                    directiva.TheCargoDTO  = myCargoDTO;

                    YouCom.DTO.Seguridad.CondominioDTO myCondominio = new YouCom.DTO.Seguridad.CondominioDTO();
                    myCondominio.IdCondominio  = decimal.Parse(wobjDataRow["idCondominio"].ToString());
                    directiva.TheCondominioDTO = myCondominio;

                    YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO();
                    myComunidadDTO.IdComunidad         = decimal.Parse(wobjDataRow["idComunidad"].ToString());
                    directiva.TheComunidadDTO          = myComunidadDTO;
                    directiva.RutDirectiva             = wobjDataRow["rutDirectiva"].ToString();
                    directiva.NombreDirectiva          = wobjDataRow["nombreDirectiva"].ToString();
                    directiva.ApellidoPaternoDirectiva = wobjDataRow["apellidoPaternoDirectiva"].ToString();
                    directiva.ApellidoMaternoDirectiva = wobjDataRow["apellidoMaternoDirectiva"].ToString();
                    directiva.TelefonoDirectiva        = wobjDataRow["telefonoDirectiva"].ToString();
                    directiva.ImagenDirectiva          = wobjDataRow["imagenDirectiva"].ToString();
                    directiva.EmailDirectiva           = wobjDataRow["correoDirectiva"].ToString();
                    directiva.FechaNacimientoDirectiva = Convert.ToDateTime(wobjDataRow["fechaNacimientoDirectiva"].ToString());

                    directiva.UsuarioIngreso      = wobjDataRow["usuario_ingreso"].ToString();
                    directiva.FechaIngreso        = wobjDataRow["fecha_ingreso"].ToString();
                    directiva.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString();
                    directiva.FechaModificacion   = wobjDataRow["fecha_modificacion"].ToString();

                    directiva.Estado = wobjDataRow["estado"].ToString();

                    IDirectiva.Add(directiva);
                }
            }

            return(IDirectiva);
        }
    protected bool enviarMail()
    {
        try
        {
            string[] _server = YouCom.Service.Generales.General.GetPropiedad("SMTP").Split(new Char[] { ';' });
            string[] _to     = YouCom.Service.Generales.General.GetPropiedad("MAILTO").Split(new Char[] { ';' });
            string[] _from   = YouCom.Service.Generales.General.GetPropiedad("MAILFROM").Split(new Char[] { ';' });

            System.Net.Mail.MailMessage _mail = new System.Net.Mail.MailMessage();

            YouCom.DTO.DirectivaDTO theDirectivaDTO = new YouCom.DTO.DirectivaDTO();

            theDirectivaDTO = YouCom.bll.DirectivaBLL.detalleDirectiva(decimal.Parse(idDirectiva));


            _mail.From = new MailAddress(_from[0], _from[1], System.Text.Encoding.UTF8);
            _mail.To.Add(new MailAddress(theDirectivaDTO.EmailDirectiva, theDirectivaDTO.NombreCompleto, System.Text.Encoding.UTF8));

            _mail.Subject = "Contacto " + " " + DateTime.Now.ToString("D");

            _mail.SubjectEncoding = System.Text.Encoding.UTF8;
            _mail.Body            = this.creaCuerpo().Replace("", "");

            _mail.BodyEncoding = System.Text.Encoding.UTF8;
            _mail.IsBodyHtml   = true;

            SmtpClient _smtp = new SmtpClient();

            _smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;
            _smtp.UseDefaultCredentials = false;

            _smtp.Host = _server[0];
            _smtp.Port = int.Parse(_server[1]);

            _smtp.Credentials = new System.Net.NetworkCredential(_server[2], _server[3]);
            _smtp.EnableSsl   = true;

            _smtp.Send(_mail);
            return(true);
        }
        catch (Exception ex)
        {
            return(false);
        }
    }
    protected bool setEnviaMensaje()
    {
        bool retorno = false;

        YouCom.DTO.Mensajeria.MensajeDirectivaDTO theMensajeDirectivaDTO = new YouCom.DTO.Mensajeria.MensajeDirectivaDTO();

        YouCom.DTO.Mensajeria.MensajeTipoEnvioDTO myMensajeTipoEnvioDTO = new YouCom.DTO.Mensajeria.MensajeTipoEnvioDTO();
        myMensajeTipoEnvioDTO.IdMensajeTipoEnvio      = 3;
        theMensajeDirectivaDTO.TheMensajeTipoEnvioDTO = myMensajeTipoEnvioDTO;

        YouCom.DTO.CategoriaDTO myCategoriaDTO = new YouCom.DTO.CategoriaDTO();
        myCategoriaDTO.IdCategoria             = decimal.Parse(ddlCategoria.SelectedValue);
        theMensajeDirectivaDTO.TheCategoriaDTO = myCategoriaDTO;

        theMensajeDirectivaDTO.MensajeTitulo      = TxtAsunto.Text;
        theMensajeDirectivaDTO.MensajeDescripcion = TxtComentarios.Text;
        theMensajeDirectivaDTO.MensajeFecha       = DateTime.Now;

        theMensajeDirectivaDTO.TheComunidadDTO  = myUsuario.TheComunidadSeleccionDTO;
        theMensajeDirectivaDTO.TheCondominioDTO = myUsuario.TheCondominioSeleccionDTO;

        YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO();

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

        YouCom.DTO.DirectivaDTO myDirectivaDTO = new YouCom.DTO.DirectivaDTO();
        myDirectivaDTO.IdDirectiva             = decimal.Parse(idDirectiva);
        theMensajeDirectivaDTO.TheDirectivaDTO = myDirectivaDTO;

        if (Session["MensajeId"] != null)
        {
            theMensajeDirectivaDTO.IdPadre = decimal.Parse(Session["MensajeId"].ToString());
        }

        theMensajeDirectivaDTO.UsuarioIngreso = myUsuario.Rut;

        retorno = YouCom.bll.Mensajeria.MensajeDirectivaBLL.Insert(theMensajeDirectivaDTO);

        return(retorno);
    }
Exemplo n.º 5
0
    protected void rptDirectiva_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 hdnDirectivaId = new HiddenField();
            hdnDirectivaId = (HiddenField)e.Item.FindControl("hdnDirectivaId");

            YouCom.DTO.DirectivaDTO myDirectivaDTO = new YouCom.DTO.DirectivaDTO();
            myDirectivaDTO = YouCom.bll.DirectivaBLL.detalleDirectiva(decimal.Parse(hdnDirectivaId.Value));

            this.hdnDirectivaId.Value    = myDirectivaDTO.IdDirectiva.ToString();
            this.txtRut.Text             = YouCom.Service.Generales.Formato.FormatoRut(myDirectivaDTO.RutDirectiva);
            this.txtNombre.Text          = myDirectivaDTO.NombreDirectiva;
            this.txtApellidoPaterno.Text = myDirectivaDTO.ApellidoPaternoDirectiva;
            this.txtApellidoMaterno.Text = myDirectivaDTO.ApellidoMaternoDirectiva;
            this.txtTelefono.Text        = myDirectivaDTO.TelefonoDirectiva;
            this.txtMail.Text            = myDirectivaDTO.EmailDirectiva;

            ddlCondominio.SelectedIndex = ddlCondominio.Items.IndexOf(ddlCondominio.Items.FindByValue(myDirectivaDTO.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(myDirectivaDTO.TheComunidadDTO.IdComunidad.ToString()));

            ddlCargo.SelectedIndex = ddlCargo.Items.IndexOf(ddlCargo.Items.FindByValue(myDirectivaDTO.TheCargoDTO.IdCargo.ToString()));

            if (!string.IsNullOrEmpty(myDirectivaDTO.ImagenDirectiva))
            {
                this.lnkImagen.Visible     = true;
                this.chkImagen.Visible     = true;
                this.lnkImagen.NavigateUrl = YouCom.Service.Generales.General.GetPropiedad("UploadsPathDirectivaPub") + myDirectivaDTO.ImagenDirectiva;
            }

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

            DirectivaDTO theDirectivaDTO = new DirectivaDTO();
            theDirectivaDTO.IdDirectiva         = decimal.Parse(hdnDirectivaId.Value);
            theDirectivaDTO.UsuarioModificacion = myUsuario.Rut;

            bool validacionIntegridad = YouCom.bll.DirectivaBLL.ValidaEliminacionDirectiva(theDirectivaDTO);
            if (validacionIntegridad)
            {
                string script = "alert(' No es posible eliminar una directiva con informacion asociada.');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                return;
            }
            else
            {
                bool respuesta = YouCom.bll.DirectivaBLL.Delete(theDirectivaDTO);
                if (respuesta)
                {
                    cargarDirectiva();
                    if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                    {
                        string script = "alert('Directiva eliminada correctamente.');";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                    }
                }
                else
                {
                }
            }
        }
    }
Exemplo 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;

        DirectivaDTO theDirectivaDTO = new DirectivaDTO();

        theDirectivaDTO.IdDirectiva              = decimal.Parse(this.hdnDirectivaId.Value);
        theDirectivaDTO.RutDirectiva             = this.txtRut.Text.ToUpper();
        theDirectivaDTO.NombreDirectiva          = this.txtNombre.Text.ToUpper();
        theDirectivaDTO.ApellidoPaternoDirectiva = this.txtApellidoPaterno.Text.ToUpper();
        theDirectivaDTO.ApellidoMaternoDirectiva = this.txtApellidoMaterno.Text.ToUpper();
        theDirectivaDTO.TelefonoDirectiva        = this.txtTelefono.Text;
        theDirectivaDTO.EmailDirectiva           = this.txtMail.Text;

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

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

        YouCom.DTO.CargoDTO myCargoDTO = new YouCom.DTO.CargoDTO();
        myCargoDTO.IdCargo                  = decimal.Parse(ddlCargo.SelectedValue);
        theDirectivaDTO.TheCargoDTO         = myCargoDTO;
        theDirectivaDTO.UsuarioModificacion = myUsuario.Rut;

        if (this.FileImagenDirectiva.HasFile)
        {
            theDirectivaDTO.ImagenDirectiva = YouCom.Service.Imagenes.Imagen.ProcessFileResize(FileImagenDirectiva, YouCom.Service.Generales.General.GetPropiedad("UploadsPathDirectivaPub"), 198, 118, Page);
        }
        else
        {
            YouCom.DTO.DirectivaDTO myDirectivaDTO = new YouCom.DTO.DirectivaDTO();
            myDirectivaDTO = YouCom.bll.DirectivaBLL.detalleDirectiva(decimal.Parse(hdnDirectivaId.Value));

            theDirectivaDTO.ImagenDirectiva = myDirectivaDTO.ImagenDirectiva;
        }

        bool respuesta = YouCom.bll.DirectivaBLL.Update(theDirectivaDTO);

        if (respuesta)
        {
            cargarDirectiva();
            this.txtRut.Text             = string.Empty;
            this.txtNombre.Text          = string.Empty;
            this.txtApellidoPaterno.Text = string.Empty;
            this.txtApellidoMaterno.Text = string.Empty;
            this.txtTelefono.Text        = string.Empty;
            this.txtMail.Text            = string.Empty;

            this.ddlCargo.ClearSelection();
            ddlCondominio.ClearSelection();

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