Example #1
0
        protected void btntxt_Click(object sender, ImageClickEventArgs e)
        {
            StringBuilder sw           = new StringBuilder();
            NOferta       oferta       = new NOferta();
            var           listaOfertas = oferta.ToList();
            int           conteo       = listaOfertas.Count;

            foreach (var item in listaOfertas)
            {
                if (conteo == 1)
                {
                    sw.Append(item.IdOferta);
                }
                else
                {
                    sw.Append(item.IdOferta + ";" + item.Descripcion + ";" + item.Valor + ";"); //adjuntar las cosas q quiero para archivo plano
                }


                conteo--;
            }


            Response.Clear();

            Response.ContentType = "application/octet-stream";
            Response.AddHeader("Content-Disposition", "attachment;filename=LISTAOFERTAS.txt");
            Response.Buffer = true;
            Response.Write(sw.ToString());
            Response.End();
        }
Example #2
0
        private void CargarGV()
        {
            NOferta oferta       = new NOferta();
            var     listaOfertas = oferta.ToList();

            GvOfertas.DataSource = listaOfertas;
            GvOfertas.DataBind();
        }
Example #3
0
 private List <CapaDatos.Models.Oferta> CargarOferta(int id)
 {
     try
     {
         NOferta negocio = new NOferta();
         List <CapaDatos.Models.Oferta> oferta = negocio.ToList().Where(x => x.IdOferta == id).ToList();
         return(oferta);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #4
0
        private void CargarDatos(string id)
        {
            CargarCombo();

            NOferta noferta = new NOferta();
            var     oferta  = noferta.ToList().FirstOrDefault(x => x.IdOferta == intId);

            txtCompraMax.Text        = oferta.CompraMax.ToString();
            txtcompraMin.Text        = oferta.CompraMin.ToString();
            txtDescuento.Text        = oferta.PorcentajeDescuento.ToString();
            txtDescripcion.InnerText = oferta.Descripcion.ToString();
            txtfechaProduct.Text     = oferta.FechaDisponibilidad.ToString();
            txtValor.Text            = oferta.Valor.ToString();
        }
Example #5
0
        public static OfertasModel ToOfertasModel()
        {
            NOferta      negocio = new NOferta();
            OfertasModel ofertas = new OfertasModel();

            ofertas.ofertas = new List <OfertaHelper>();

            var negocioOfertas = negocio.ToList();

            foreach (var item in negocioOfertas)
            {
                OfertaHelper oferta = new OfertaHelper();
                oferta.CompraMax           = item.CompraMax;
                oferta.CompraMin           = item.CompraMin;
                oferta.Descripcion         = item.Descripcion;
                oferta.FechaDisponibilidad = item.FechaDisponibilidad;
                oferta.IdOferta            = item.IdOferta;
                oferta.IdUsuario           = item.Usuario.IdUsuario;
                oferta.PorcentajeDescuento = item.PorcentajeDescuento;
                oferta.Valor = item.Valor;

                ProductoModel Producto = new ProductoModel();

                Producto.Descripcion      = item.Producto.Descripcion;
                Producto.FechaVencimiento = item.Producto.FechaVencimiento;
                Producto.IdCategoria      = item.Producto.Categoria.IdCategoria;
                Producto.IdEmpresa        = item.Producto.Empresa.IdEmpresa;
                Producto.IdProducto       = item.Producto.IdProducto;
                Producto.Imagen           = item.Producto.Imagen;
                Producto.Marca            = item.Producto.Marca;
                Producto.Modelo           = item.Producto.Modelo;
                Producto.Nombre           = item.Producto.Nombre;
                Producto.PrecioNormal     = item.Producto.PrecioNormal;
                Producto.Stock            = item.Producto.Stock;
                Producto.Temporada        = item.Producto.Temporada;

                oferta.Producto = Producto;

                ofertas.ofertas.Add(oferta);
            }

            return(ofertas);
        }
Example #6
0
        public static List <ComentarioModel> ComentariosOferta(int id)
        {
            NOferta ofertas                    = new NOferta();
            var     listaComentarios           = ofertas.ToList().FirstOrDefault(o => o.IdOferta == id).OpinionOfertas;
            List <ComentarioModel> comentarios = new List <ComentarioModel>();

            foreach (var item in listaComentarios)
            {
                ComentarioModel comentario = new ComentarioModel();

                comentario.Comentario       = item.Comentario;
                comentario.FechaPublicacion = item.FechaPublicacion;
                comentario.IdProducto       = item.Oferta.Producto.IdProducto;
                comentario.Imagen           = item.Imagen;
                comentario.NombreCompleto   = item.Usuario.Nombre + " " + item.Usuario.Apellido;
                comentarios.Add(comentario);
            }

            return(comentarios);
        }
Example #7
0
        public static List <OfertaProductoModel> OfertasProductosSegunOferta(int id)
        {
            NOferta ofertas      = new NOferta();
            var     listaOfertas = ofertas.ToList().Where(o => o.IdOferta == id).ToList();
            List <OfertaProductoModel> ofertaProductos = new List <OfertaProductoModel>();

            foreach (var item in listaOfertas)
            {
                OfertaProductoModel ofertaproducto = new OfertaProductoModel();
                ofertaproducto.CompraMax           = item.CompraMax;
                ofertaproducto.CompraMin           = item.CompraMin;
                ofertaproducto.Descripcion         = item.Descripcion;
                ofertaproducto.DescripcionProducto = item.Producto.Descripcion;
                ofertaproducto.FechaDisponibilidad = item.FechaDisponibilidad;
                ofertaproducto.FechaVencimiento    = item.Producto.FechaVencimiento;
                ofertaproducto.IdOferta            = item.IdOferta;
                ofertaproducto.IdProducto          = item.Producto.IdProducto;
                ofertaproducto.Imagen = item.Producto.Imagen;
                ofertaproducto.Marca  = item.Producto.Marca;
                ofertaproducto.Modelo = item.Producto.Modelo;
                ofertaproducto.Nombre = item.Producto.Nombre;
                ofertaproducto.PorcentajeDescuento = item.PorcentajeDescuento;
                ofertaproducto.PrecioNormal        = item.Producto.PrecioNormal;
                ofertaproducto.Stock           = item.Producto.Stock;
                ofertaproducto.Temporada       = item.Producto.Temporada;
                ofertaproducto.Valor           = item.Valor;
                ofertaproducto.IdCategoria     = item.Producto.Categoria.IdCategoria;
                ofertaproducto.IdEmpresa       = item.Producto.Empresa.IdEmpresa;
                ofertaproducto.NombreCategoria = item.Producto.Categoria.Descripcion;
                ofertaproducto.NombreEmpresa   = item.Producto.Empresa.Nombre;


                ofertaProductos.Add(ofertaproducto);
            }

            return(ofertaProductos);
        }