Beispiel #1
0
        private void CargarGrillaProductos()
        {
            ProductosDeEmpresa.Clear();

            ProductoCore ProductoBLL = new ProductoCore();

            ProductosDeEmpresa = ProductoBLL.FindAllByCUIT(1).Where(o => o.FecBaja == null).ToList();

            foreach (var prod in ProductosDeEmpresa)
            {
                ProductoDTO producto = new ProductoDTO();
                producto.IdProducto     = prod.IdProducto;
                producto.CodigoProducto = prod.CodigoProducto;
                producto.Descripcion    = prod.DescripProducto;
                producto.DescripLarga   = prod.DescripLarga;
                producto.PrecioUnitario = prod.PrecioUnitario;
                producto.URL            = prod.URL;

                ProductosenGrilla.Add(producto);
            }

            grillaproductos.DataSource          = ProductosenGrilla;
            grillaproductos.AutoGenerateColumns = false;



            grillaproductos.DataBind();
        }
Beispiel #2
0
        public static List <String> ObtenerProductosEmpresa()
        {
            var cotizacion = (MonedaEmpresaEntidad)HttpContext.Current.Session["Cotizacion"];
            var core       = new ProductoCore();


            // var pedidos = core.FindAllByCUIT();
            var pedidos = core.FindAllByCUIT(cotizacion.IdMoneda);

            return(pedidos.Select(x => x.DescripProducto).ToList());
        }
        public static List <String> ObtenerProductos()
        {
            var core = new ProductoCore();
            // var usuarioentidad = (UsuarioEntidad)HttpContext.Current.Session["Usuario"];
            // var cotizacion = new MonedaEmpresaEntidad();
            // cotizacion = (MonedaEmpresaEntidad)HttpContext.Current.Session["Cotizacion"];
            // var cot2 = Convert.ToInt32(cotizacion.IdMoneda);
            var productosEmpresa = core.FindAllByCUIT(1);

            return(productosEmpresa.Select(x => x.DescripProducto).ToList());
        }
Beispiel #4
0
        ////Para mantener la sesión activa
        //[WebMethod(EnableSession = true)]
        //public static void MantenerSesion()
        //{

        //}

        protected void Page_Load(object sender, EventArgs e)
        {
            idioma = new LenguajeEntidad();

            if (!IsPostBack)
            {
                cargarFiltros();

                idioma     = (LenguajeEntidad)Session["Idioma"];
                cotizacion = (MonedaEmpresaEntidad)Session["Cotizacion"];

                if (cotizacion == null)
                {
                    cotizacion            = new MonedaEmpresaEntidad();
                    cotizacion.IdMoneda   = 1;
                    Session["Cotizacion"] = cotizacion;
                }

                if (idioma == null)
                {
                    idioma = new LenguajeEntidad();
                    idioma.DescripcionLenguaje = "es";
                    Session["Idioma"]          = idioma;
                }
                if (cotizacion != null)
                {
                    moneda = _coremoneda.selectMoneda(cotizacion.IdMoneda);
                }

                stringBusqueda  = Page.Request.QueryString["search"];
                stringCategoria = Page.Request.QueryString["Categoria"];
                Session.Add("ProductosEnSesion", unosProductos);



                if (!string.IsNullOrEmpty(stringBusqueda))
                {
                    if (stringBusqueda == "*")
                    {
                        //unosProductos = _manager.ProductoSelectMasVendidosByCUIT(TFI.CORE.Helpers.ConfigSection.Default.Site.Cuit);
                        unosProductos       = _manager.FindAllByCUIT(cotizacion.IdMoneda).Where(o => o.FecBaja == null).ToList();
                        catalogo.DataSource = unosProductos;
                        catalogo.DataBind();
                        Session["ProductosEnSesion"] = unosProductos;
                    }
                    else
                    {
                        var cotizacionStatic = new MonedaEmpresaEntidad();
                        cotizacionStatic = (MonedaEmpresaEntidad)Current.Session["Cotizacion"];
                        //                      unosProductos = _manager.FindAllByDescripProducto(stringBusqueda);
                        unosProductos       = _manager.FindAllByDescripProducto(stringBusqueda, cotizacionStatic.IdMoneda).Where(o => o.FecBaja == null).ToList();
                        catalogo.DataSource = unosProductos;
                        catalogo.DataBind();
                        Session["ProductosEnSesion"] = unosProductos;
                    }
                }


                if (!string.IsNullOrEmpty(stringCategoria))
                {
                    if (Int32.Parse(stringCategoria) > 0 && Int32.Parse(stringCategoria) < 500)
                    {
                        unosProductos       = _manager.ProductoSelectByCategoria(Int32.Parse(stringCategoria), cotizacion.IdMoneda).Where(o => o.FecBaja == null).ToList();
                        catalogo.DataSource = unosProductos;
                        catalogo.DataBind();
                        Session["ProductosEnSesion"] = unosProductos;
                    }
                    else
                    {
                        notif.Attributes.Remove("hidden");
                        notif.InnerHtml = string.Format("<span>{0}</span>", "No existe la categoría ingresada");
                    }
                }



                if (!unosProductos.Any())
                {
                    notif.Attributes.Remove("hidden");
                    notif.InnerHtml = string.Format("<span>{0}</span>", "No se encontraron productos, por favor realice otra búsqueda");
                }
            }

            else
            {
                idioma.DescripcionLenguaje = Master.obtenerIdiomaCombo();
                Session["Idioma"]          = idioma;
                cotizacion.IdMoneda        = Convert.ToInt16(Master.obtenerValorDropDown());
                unosProductos         = (List <ProductoEntidad>)Session["ProductosEnSesion"];
                cotizacion            = _coremoneda.Select(cotizacion.IdMoneda);
                Session["Cotizacion"] = cotizacion;
                foreach (var item in unosProductos)
                {
                    var item2 = _manager.Find(item.IdProducto, cotizacion.IdMoneda);
                    //if (cotizacion.Cotizacion >1)
                    //{
                    //    item.PrecioUnitario = item2.PrecioUnitario / cotizacion.Cotizacion;
                    //}
                    //else
                    //{ item.PrecioUnitario = item2.PrecioUnitario * cotizacion.Cotizacion; }
                    item.PrecioUnitario = decimal.Round(item2.PrecioUnitario, 2);
                }
                catalogo.DataSource = unosProductos;
                catalogo.DataBind();
            }
            if (cotizacion != null)
            {
                moneda = _coremoneda.selectMoneda(cotizacion.IdMoneda);
            }
            //CargarCategorias

            unasCategorias           = ManagerCategoria.SeleccionarCategorias();
            rptCategorias.DataSource = unasCategorias;
            rptCategorias.DataBind();
            //seteo el combo de moneda cuando refresco en el elegido sino se pierde
            DropDownList lblStatus = FindControlFromMaster <DropDownList>("MonedaDRW");
            DropDownList lblIdioma = FindControlFromMaster <DropDownList>("ddlLanguages");

            if (lblIdioma != null)
            {
                lblIdioma.SelectedValue = idioma.DescripcionLenguaje;
                //  lblIdioma.Items.FindByValue(CultureInfo.CurrentCulture.Name).Selected = true;
                //Thread.CurrentThread.CurrentCulture = new CultureInfo(idioma.DescripcionLenguaje);
                //Thread.CurrentThread.CurrentUICulture = new CultureInfo(idioma.DescripcionLenguaje);
            }
            if (lblStatus != null)
            {
                if (cotizacion != null)
                {
                    lblStatus.SelectedValue = cotizacion.IdMoneda.ToString();
                }
            }

            var valordropdown = Session["ValorDrop"];

            if (valordropdown != null)
            {
                if (Convert.ToInt32(valordropdown) == 0)
                {
                    catalogo.DataSource = unosProductos.OrderByDescending(x => x.PrecioUnitario);;
                    catalogo.DataBind();
                }
                else if (Convert.ToInt32(valordropdown) == 1)
                {
                    catalogo.DataSource = unosProductos.OrderBy(x => x.PrecioUnitario);;
                    catalogo.DataBind();
                }
                else if (Convert.ToInt32(valordropdown) == 2)
                {
                    catalogo.DataSource = unosProductos.OrderByDescending(x => x.DescripProducto);;
                    catalogo.DataBind();
                }
                else if (Convert.ToInt32(valordropdown) == 3)
                {
                    catalogo.DataSource = unosProductos.OrderBy(x => x.DescripProducto);;
                    catalogo.DataBind();
                }
            }
        }
Beispiel #5
0
        ////Para mantener la sesión activa
        //[WebMethod(EnableSession = true)]
        //public static void MantenerSesion()
        //{

        //}


        protected void Page_Load(object sender, EventArgs e)
        {
            idioma        = new LenguajeEntidad();
            _coremoneda   = new MonedaCore();
            cotizacion    = new MonedaEmpresaEntidad();
            moneda        = new MonedaEntidad();
            listaRecursos = CargarRecursos();
            ProductoCore unProductoCore = new ProductoCore();

            if (!IsPostBack)
            {
                cotizacion = (MonedaEmpresaEntidad)Session["Cotizacion"];

                idioma = (LenguajeEntidad)Session["Idioma"];
                if (cotizacion == null)
                {
                    cotizacion            = new MonedaEmpresaEntidad();
                    cotizacion.IdMoneda   = 1;
                    Session["Cotizacion"] = cotizacion;
                }
                if (cotizacion != null)
                {
                    moneda = _coremoneda.selectMoneda(cotizacion.IdMoneda);
                }
                // ProductoCore unProductoCore = new ProductoCore();
                if (idioma == null)
                {
                    idioma = new LenguajeEntidad();
                    idioma.DescripcionLenguaje = "es";
                    Session["Idioma"]          = idioma;
                }



                //**************MOSTRAR PRODUCTOS DESTACADOS**********************************************************************
                //SI ESTA LOGUEADO
                //MUESTRA PRODUCTOS PRODUCTOS QUE ESTAN DENTRO DE LA MISMA CATEGORIA DE LOS ULTIMOS QUE COMPRO

                //SI NO
                //MUESTRA LOS ULTIMOS AGREGADOS AL ECOMMERCE
                unosProductosDestacados           = (List <ProductoEntidad>)unProductoCore.FindAllByCUIT(cotizacion.IdMoneda).Where(o => o.FecBaja == null).OrderByDescending(x => x.IdProducto).Take(2).ToList();
                lstProductosDestacados.DataSource = unosProductosDestacados;
                lstProductosDestacados.DataBind();


                //**************MOSTRAR PRODUCTOS MAS VENDIDOS (PARA LA SEGUNDA PESTAÑA)**********************************************************************
                unosProductosMasVendidos  = unProductoCore.ProductoSelectMasVendidosByCUIT(ConfigSection.Default.Site.Cuit, cotizacion.IdMoneda).Where(o => o.FecBaja == null).ToList();
                lstMasVendidos.DataSource = unosProductosMasVendidos;
                lstMasVendidos.DataBind();
            }
            else
            {
                //Response.Redirect("LayoutBasico.aspx");
                idioma.DescripcionLenguaje = Master.obtenerIdiomaCombo();
                Session["Idioma"]          = idioma;
                cotizacion.IdMoneda        = Convert.ToInt16(Master.obtenerValorDropDown());
                Session["Cotizacion"]      = cotizacion;

                if (cotizacion != null)
                {
                    moneda = _coremoneda.selectMoneda(cotizacion.IdMoneda);
                }
                unosProductosDestacados = (List <ProductoEntidad>)unProductoCore.FindAllByCUIT(cotizacion.IdMoneda).Where(o => o.FecBaja == null).OrderByDescending(x => x.IdProducto).Take(2).ToList();
                // var miDropMoneda = Master.combo.SelectedItem.Value;

                // Master.FindControl("DRWMoneda");
                lstProductosDestacados.DataSource = unosProductosDestacados;
                // cotizacion.Cotizacion = this.Master.cotizacion.Cotizacion;
                lstProductosDestacados.DataBind();
                unosProductosMasVendidos  = unProductoCore.ProductoSelectMasVendidosByCUIT(ConfigSection.Default.Site.Cuit, cotizacion.IdMoneda).Where(o => o.FecBaja == null).ToList();
                lstMasVendidos.DataSource = unosProductosMasVendidos;
                lstMasVendidos.DataBind();
            }

            DropDownList lblStatus = FindControlFromMaster <DropDownList>("MonedaDRW");

            if (lblStatus != null)
            {
                if (cotizacion != null)
                {
                    lblStatus.SelectedValue = cotizacion.IdMoneda.ToString();
                }
            }

            //pruebo lo de idioma para que quede seteado el combo cuando vuelve a home desde cualquier otra pagina

            DropDownList lblIdioma = FindControlFromMaster <DropDownList>("ddlLanguages");

            if (lblIdioma != null)
            {
                lblIdioma.SelectedValue = idioma.DescripcionLenguaje;
                //  lblIdioma.Items.FindByValue(CultureInfo.CurrentCulture.Name).Selected = true;
                //Thread.CurrentThread.CurrentCulture = new CultureInfo(idioma.DescripcionLenguaje);
                //Thread.CurrentThread.CurrentUICulture = new CultureInfo(idioma.DescripcionLenguaje);
            }
        }