示例#1
0
    protected void rptNoticiaInactivo_OnItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Activar")
        {
            HiddenField hdnNoticiaId = new HiddenField();
            hdnNoticiaId = (HiddenField)e.Item.FindControl("hdnNoticiaId");

            NoticiaDTO theNoticiaDTO = new NoticiaDTO();
            theNoticiaDTO.NoticiaId           = decimal.Parse(hdnNoticiaId.Value);
            theNoticiaDTO.UsuarioModificacion = myUsuario.Rut;
            bool respuesta = YouCom.bll.NoticiaBLL.ActivaNoticia(theNoticiaDTO);
            if (respuesta)
            {
                cargarNoticiaInactivo();
                if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                {
                    string script = "alert('Noticia activada correctamente.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                }
            }
            else
            {
            }
        }
    }
示例#2
0
        public async Task <IHttpActionResult> NoticiaGet(NoticiaRequest noticia)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    NoticiaDTO noticiaDTO = Mapper.Map <NoticiaRequest, NoticiaDTO>(noticia);
                    var        resultado  = await informacionnoticia.GetBy_NoticiaDto(noticia.Codigo);

                    if (resultado.Success)
                    {
                        if (resultado.Result != null)
                        {
                            NoticiaResponse datosNoticiaResponse = Mapper.Map <NoticiaDTO, NoticiaResponse>(resultado.Result);
                            return(Ok(datosNoticiaResponse));
                        }
                        else
                        {
                            return(NotFound());
                        }
                    }
                    else
                    {
                        return(BadRequest(resultado.Error.ToString()));
                    }
                }
                return(BadRequest(ModelState));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }
示例#3
0
        public async Task <IHttpActionResult> NoticiaDelete(NoticiaRequest noticia)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    NoticiaDTO noticiaDTO = Mapper.Map <NoticiaRequest, NoticiaDTO>(noticia);
                    var        resultado  = await informacionnoticia.DeleteNoticiaDto(noticiaDTO);

                    if (resultado.Success)
                    {
                        return(Ok(resultado.Result));
                    }
                    else
                    {
                        return(BadRequest(resultado.Error.ToString()));
                    }
                }
                return(BadRequest(ModelState));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }
示例#4
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 <NoticiaDTO> noticias = new List <NoticiaDTO>();

        noticias = (Session["noticia"] as List <NoticiaDTO>);

        NoticiaDTO theNoticiaDTO = new NoticiaDTO();

        theNoticiaDTO.NotiTitulo  = this.txtNoticiaTitulo.Text.ToUpper();
        theNoticiaDTO.NotiResumen = this.txtNoticiaResumen.Text.ToUpper();
        theNoticiaDTO.NotiDetalle = this.FCKeditorDetalle.Value;
        theNoticiaDTO.NotiAutor   = this.TxtNotiAutor.Text.ToUpper();

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

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

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

        theNoticiaDTO.UsuarioIngreso = myUsuario.Rut;

        if (this.FileImagenNoticia.HasFile)
        {
            if (System.IO.Path.GetExtension(FileImagenNoticia.PostedFile.FileName) == ".swf")
            {
                theNoticiaDTO.NotiImagen = this.ProcessOtherFile(FileImagenNoticia, null, YouCom.Service.Generales.General.GetPropiedad("UploadsPathNoticiaPub"));
            }
            else
            {
                theNoticiaDTO.NotiImagen = YouCom.Service.Imagenes.Imagen.ProcessFileResize(FileImagenNoticia, YouCom.Service.Generales.General.GetPropiedad("UploadsPathNoticiaPub"), 198, 118, Page);
            }
        }

        theNoticiaDTO.NotiPublicacion = DateTime.ParseExact(this.FechaPublicacion.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture);
        theNoticiaDTO.NotiInicio      = DateTime.ParseExact(this.FechaPublicacion.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture);

        theNoticiaDTO.NotiExpira = string.Copy(RdbNotiExpira.SelectedItem.Value);

        if (RdbNotiExpira.SelectedValue.Equals("S"))
        {
            theNoticiaDTO.NotiExpiracion = DateTime.ParseExact(this.FechaExpiracion.Text + " 00:00", "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture);
        }
        else
        {
            theNoticiaDTO.NotiExpiracion = DateTime.MaxValue;
        }

        noticias = noticias.Where(x => x.NotiTitulo == theNoticiaDTO.NotiTitulo).ToList();
        if (noticias.Any())
        {
            foreach (var item in noticias)
            {
                if (item.Estado == "2")
                {
                    string script = "alert('Noticia existe pero fue eliminado para activarlo dirigase a Papelera.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                    return;
                }
                else
                {
                    string script = "alert('Noticia ya Existe .');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                    return;
                }
            }
        }

        bool respuesta = YouCom.bll.NoticiaBLL.Insert(theNoticiaDTO);

        if (respuesta)
        {
            this.TxtNotiAutor.Text      = string.Empty;
            this.txtNoticiaTitulo.Text  = string.Empty;
            this.txtNoticiaResumen.Text = string.Empty;
            string script = "alert('Noticia ingresada correctamente.');";
            Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
            cargarNoticia();
        }
        else
        {
        }
    }
示例#5
0
    protected void rptNoticia_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 hdnNoticiaId = new HiddenField();
            hdnNoticiaId = (HiddenField)e.Item.FindControl("hdnNoticiaId");

            YouCom.DTO.NoticiaDTO theNoticiaDTO = new YouCom.DTO.NoticiaDTO();
            theNoticiaDTO = YouCom.bll.NoticiaBLL.detalleNoticia(decimal.Parse(hdnNoticiaId.Value));

            this.hdnNoticiaId.Value = theNoticiaDTO.NoticiaId.ToString();
            txtNoticiaTitulo.Text   = theNoticiaDTO.NotiTitulo;
            txtNoticiaResumen.Text  = theNoticiaDTO.NotiResumen;
            FCKeditorDetalle.Value  = theNoticiaDTO.NotiDetalle;
            TxtNotiAutor.Text       = theNoticiaDTO.NotiAutor;

            this.FechaPublicacion.Text = theNoticiaDTO.NotiPublicacion.ToShortDateString();
            this.FechaExpiracion.Text  = theNoticiaDTO.NotiExpiracion.ToShortDateString();

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

            ddlCategoria.SelectedIndex = ddlCategoria.Items.IndexOf(ddlCategoria.Items.FindByValue(theNoticiaDTO.TheCategoriaDTO.IdCategoria.ToString()));

            RdbNotiExpira.SelectedIndex = RdbNotiExpira.Items.IndexOf(RdbNotiExpira.Items.FindByValue(theNoticiaDTO.NotiExpira.ToString()));

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


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

            NoticiaDTO theNoticiaDTO = new NoticiaDTO();
            theNoticiaDTO.NoticiaId           = decimal.Parse(hdnNoticiaId.Value);
            theNoticiaDTO.UsuarioModificacion = myUsuario.Rut;

            bool respuesta = YouCom.bll.NoticiaBLL.Delete(theNoticiaDTO);
            if (respuesta)
            {
                cargarNoticia();
                if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                {
                    string script = "alert('Noticia Eliminada correctamente.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                }
            }
            else
            {
            }
        }
    }
示例#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;

        NoticiaDTO theNoticiaDTO = new NoticiaDTO();

        theNoticiaDTO.NoticiaId   = decimal.Parse(this.hdnNoticiaId.Value);
        theNoticiaDTO.NotiTitulo  = this.txtNoticiaTitulo.Text.ToUpper();
        theNoticiaDTO.NotiResumen = this.txtNoticiaResumen.Text.ToUpper();
        theNoticiaDTO.NotiDetalle = this.FCKeditorDetalle.Value;
        theNoticiaDTO.NotiAutor   = this.TxtNotiAutor.Text.ToUpper();

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

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

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

        theNoticiaDTO.UsuarioModificacion = myUsuario.Rut;

        if (this.FileImagenNoticia.HasFile)
        {
            theNoticiaDTO.NotiImagen = YouCom.Service.Imagenes.Imagen.ProcessFileResize(FileImagenNoticia, YouCom.Service.Generales.General.GetPropiedad("UploadsPathBann"), 198, 118, Page);
        }
        else
        {
            YouCom.DTO.NoticiaDTO myNoticiaDTO = new YouCom.DTO.NoticiaDTO();
            myNoticiaDTO = YouCom.bll.NoticiaBLL.detalleNoticia(decimal.Parse(hdnNoticiaId.Value));

            theNoticiaDTO.NotiImagen = myNoticiaDTO.NotiImagen;
        }


        theNoticiaDTO.NotiPublicacion = DateTime.ParseExact(this.FechaPublicacion.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture);
        theNoticiaDTO.NotiInicio      = DateTime.ParseExact(this.FechaPublicacion.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture);

        theNoticiaDTO.NotiExpira = string.Copy(RdbNotiExpira.SelectedItem.Value);

        if (RdbNotiExpira.SelectedValue.Equals("S"))
        {
            theNoticiaDTO.NotiExpiracion = DateTime.ParseExact(this.FechaExpiracion.Text + " 00:00", "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture);
        }
        else
        {
            theNoticiaDTO.NotiExpiracion = DateTime.MaxValue;
        }

        bool respuesta = YouCom.bll.NoticiaBLL.Update(theNoticiaDTO);

        if (respuesta)
        {
            cargarNoticia();
            this.TxtNotiAutor.Text      = string.Empty;
            this.txtNoticiaTitulo.Text  = string.Empty;
            this.txtNoticiaResumen.Text = string.Empty;

            if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
            {
                string script = "alert('Noticia editada correctamente.');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
            }
        }
        else
        {
        }
    }
示例#7
0
        public static bool ValidaEliminacionNoticia(NoticiaDTO theNoticiaDTO)
        {
            bool respuesta = facade.Noticia.ValidaEliminacionNoticia(theNoticiaDTO);

            return(respuesta);
        }
示例#8
0
        public static bool ActivaNoticia(NoticiaDTO theNoticiaDTO)
        {
            bool respuesta = NoticiaDAL.ActivaNoticia(theNoticiaDTO);

            return(respuesta);
        }