Ejemplo n.º 1
0
        protected void grilladend_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            ProductoCore coreProducto = new ProductoCore();

            if (e.CommandName.Equals("VerDetalle"))
            {
                int                index           = Convert.ToInt32(e.CommandArgument);
                string             code            = grilladend.DataKeys[index].Value.ToString();
                string             ultimos8delcode = code.Substring(code.Length - 8);
                string             nrocomprobantesincerosalaizquierda = ultimos8delcode.TrimStart('0');
                ComprobanteEntidad ComprobanteRow = ComprobanteBLL.ComprobanteSelectAllByCUIT_NroComprobante(Convert.ToInt32(nrocomprobantesincerosalaizquierda));
                List <ComprobanteDetalleEntidad> ListadeDetalles = ComprobanteBLL.DetallesSelectByComprobante(ComprobanteRow.NroComprobante, ComprobanteRow.miSucursal.IdSucursal, ComprobanteRow.miTipoComprobante.IdTipoComprobante);

                List <NCDetalleDTO> ListaDetallesDTO = new List <NCDetalleDTO>();
                foreach (var item in ListadeDetalles)
                {
                    NCDetalleDTO NuevoDetalle = new NCDetalleDTO();
                    NuevoDetalle.Producto       = coreProducto.Find(item.miProducto.IdProducto, 1).DescripProducto;
                    NuevoDetalle.Cantidad       = item.CantidadProducto;
                    NuevoDetalle.PrecioUnitario = item.PrecioUnitarioFact;
                    NuevoDetalle.Total          = NuevoDetalle.Cantidad * NuevoDetalle.PrecioUnitario;

                    ListaDetallesDTO.Add(NuevoDetalle);
                }

                grilladedetallesdend.DataSource = ListaDetallesDTO;
                grilladedetallesdend.DataBind();
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#currentdetail').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "ModalScript", sb.ToString(), false);
            }
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
        public static void GrabarProducto(string codigoproducto, string descripcion, int marca, int iva, decimal precio, string url, string detalle, int categoria)
        {
            var usuarioEntity = new UsuarioEntidad();
            var Current       = HttpContext.Current;

            usuarioEntity = (UsuarioEntidad)Current.Session["Usuario"];

            ProductoEntidad NuevoProducto = new ProductoEntidad();

            NuevoProducto.CUIT                        = ConfigSection.Default.Site.Cuit;
            NuevoProducto.CodigoProducto              = codigoproducto;
            NuevoProducto.DescripProducto             = descripcion;
            NuevoProducto.miMarca                     = new MarcaEntidad();
            NuevoProducto.miMarca.IdMarca             = marca;
            NuevoProducto.miIvaProducto               = new IvaProductoEntidad();
            NuevoProducto.miIvaProducto.IdIvaProducto = iva;
            NuevoProducto.PrecioUnitario              = Convert.ToDecimal(precio);
            NuevoProducto.URL          = url;
            NuevoProducto.DescripLarga = detalle;

            if (NuevoProducto.PrecioUnitario > 0)
            {
                ProductoCore UnCoreProducto = new ProductoCore();
                int          id             = UnCoreProducto.ProductoInsert(NuevoProducto);

                ProdCategoriaEntidad NuevaIntermedia = new ProdCategoriaEntidad();
                NuevaIntermedia.IdCategoria = categoria;
                NuevaIntermedia.IdProducto  = id;
                NuevaIntermedia.CUIT        = ConfigSection.Default.Site.Cuit;

                UnCoreProducto.ProductoCategoriaInsert(NuevaIntermedia);
            }
        }
Ejemplo n.º 4
0
        public static void QuitarDeseo(string idProducto)
        {
            var Current        = HttpContext.Current;
            var logueadoStatic = (UsuarioEntidad)Current.Session["Usuario"];
            //List<ListaDeseoEntidad> unosDeseos = new List<ListaDeseoEntidad>();
            List <ProductoEntidad> unosProdDeseados = new List <ProductoEntidad>();
            ListaDeseosCore        ManagerDeseos    = new ListaDeseosCore();
            ListaDeseoEntidad      unaListaDeseo    = new ListaDeseoEntidad();
            ProductoCore           unProductoCore   = new ProductoCore();

            //Quitar al producto de la lista de deseos (solo de SESSION), no así de la bd
            unosProdDeseados = (List <ProductoEntidad>)Current.Session["ListaDeseos"];

            if (unosProdDeseados != null || unosProdDeseados.Any())
            {
                unosProdDeseados.RemoveAll(x => x.IdProducto == Int32.Parse(idProducto));
                Current.Session["ListaDeseos"] = unosProdDeseados;
            }

            //Quitar al producto en BD de la lista de deseos
            ListaDeseoEntidad DeseoEliminar = new ListaDeseoEntidad();

            DeseoEliminar.IdProducto    = Int32.Parse(idProducto);
            DeseoEliminar.NombreUsuario = logueadoStatic.NombreUsuario;
            ManagerDeseos.ListaDeseosDelete(DeseoEliminar);
        }
Ejemplo n.º 5
0
        public static void AgregarDeseo(string idProducto)
        {
            var Current        = HttpContext.Current;
            var logueadoStatic = (UsuarioEntidad)Current.Session["Usuario"];
            List <ListaDeseoEntidad> listaDeseosSesion  = new List <ListaDeseoEntidad>();
            List <ProductoEntidad>   unaListaProductos  = new List <ProductoEntidad>();
            ListaDeseosCore          unaListaDeseosCore = new ListaDeseosCore();
            ListaDeseoEntidad        unaListaDeseo      = new ListaDeseoEntidad();
            ProductoCore             unProductoCore     = new ProductoCore();

            unaListaProductos = (List <ProductoEntidad>)Current.Session["ListaDeseos"];

            unaListaDeseo.CUIT          = ConfigSection.Default.Site.Cuit;
            unaListaDeseo.NombreUsuario = logueadoStatic.NombreUsuario;
            unaListaDeseo.IdProducto    = Int32.Parse(idProducto);

            var cotizacionStatic = (MonedaEmpresaEntidad)Current.Session["Cotizacion"];

            //Guardar en BD el nuevo deseo
            if (unaListaDeseosCore.ListaDeseosInsert(unaListaDeseo) > 0)
            {
                //Agregar el deseo a la sesión actual
                ProductoEntidad unProductoEntidad = new ProductoEntidad();
                // unProductoEntidad = unProductoCore.Find(unaListaDeseo.IdProducto, 1);
                unProductoEntidad = unProductoCore.Find(unaListaDeseo.IdProducto, cotizacionStatic.IdMoneda);
                unaListaProductos.Add(unProductoEntidad);
                Current.Session["ListaDeseos"] = unaListaProductos;
            }
        }
Ejemplo n.º 6
0
 public Catalogo()
 {
     _manager    = new ProductoCore();
     moneda      = new MonedaEntidad();
     _coremoneda = new MonedaCore();
     cotizacion  = new MonedaEmpresaEntidad();
 }
Ejemplo n.º 7
0
        public static string AgregarItem(string id)
        {
            var Current          = HttpContext.Current;
            var manager          = new ProductoCore();
            var cotizacionStatic = new MonedaEmpresaEntidad();

            cotizacionStatic = (MonedaEmpresaEntidad)Current.Session["Cotizacion"];
            producto         = manager.Find(Int32.Parse(id), cotizacionStatic.IdMoneda);

            var list = (List <ProductoEntidad>)Current.Session["Productos"];

            if (list == null || !list.Any())
            {
                Current.Session["Productos"] = new List <ProductoEntidad>();
                ((List <ProductoEntidad>)Current.Session["Productos"]).Add(producto);
            }
            else
            {
                if (!list.Where(x => x.IdProducto == producto.IdProducto).Any())
                {
                    ((List <ProductoEntidad>)Current.Session["Productos"]).Add(producto);
                }
            }
            return(producto.DescripProducto);
        }
Ejemplo n.º 8
0
 public Producto()
 {
     cotizacion  = new MonedaEmpresaEntidad();
     moneda      = new MonedaEntidad();
     _coreMoneda = new MonedaCore();
     _manager    = new ProductoCore();
     idioma      = new LenguajeEntidad();
 }
Ejemplo n.º 9
0
 public Pedidos()
 {
     idioma        = new LenguajeEntidad();
     cotizacion    = new MonedaEmpresaEntidad();
     moneda        = new MonedaEntidad();
     _coreMoneda   = new MonedaCore();
     _coreProducto = new ProductoCore();
     _coreStock    = new StockCore();
 }
Ejemplo n.º 10
0
        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());
        }
Ejemplo n.º 11
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());
        }
Ejemplo n.º 12
0
 public IActionResult ProductosPorUsuario([FromQuery] int docente)
 {
     try
     {
         ProductoCore productoCore = new ProductoCore(dbContext);
         return(Ok(productoCore.ObtenerProductosDeUnUsuario(docente)));
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
     }
 }
Ejemplo n.º 13
0
 public IActionResult ObtenerMisProductos([FromRoute] int docenteEnSesion)
 {
     try
     {
         ProductoCore productoCore = new ProductoCore(dbContext);
         return(Ok(productoCore.ObtenerProductosDeUnUsuario(docenteEnSesion)));
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
     }
 }
Ejemplo n.º 14
0
 public IActionResult BusquedaPorCategoria([FromQuery] int categoria)
 {
     try
     {
         ProductoCore productoCore = new ProductoCore(dbContext);
         return(Ok(productoCore.ObtenerProductosPorCategoria(categoria)));
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
     }
 }
Ejemplo n.º 15
0
        public static string Temporal(string pAlgo)
        {
            ProductoCore producto = new ProductoCore();

            producto.Estado         = true;
            producto.FechaRegistro  = DateTime.Now;
            producto.IdProducto     = 0;
            producto.IdTipoProducto = "AB";
            producto.NombreProducto = pAlgo;
            producto.ValorProducto  = 1234578;

            return(JsonConvert.SerializeObject(producto));
        }
Ejemplo n.º 16
0
        public static string ComprarProducto(string IdProdC)
        {
            var Current = HttpContext.Current;
            var manager = new ProductoCore();

            producto = manager.Find(Int32.Parse(IdProdC), 1);
            List <ProductoEntidad> ListaDeseo = new List <ProductoEntidad>();
            UsuarioEntidad         logueadoStatic;

            logueadoStatic = (UsuarioEntidad)Current.Session["Usuario"];
            //var list = (List<ProductoEntidad>)Current.Session["ListaDeseos"];
            var list = (List <ProductoEntidad>)Current.Session["Productos"];

            if (logueadoStatic != null)
            {
                if (list == null || !list.Any())
                {
                    Current.Session["Productos"] = new List <ProductoEntidad>();
                    ((List <ProductoEntidad>)Current.Session["Productos"]).Add(producto);
                }
                else
                {
                    if (!list.Where(x => x.IdProducto == producto.IdProducto).Any())
                    {
                        ((List <ProductoEntidad>)Current.Session["Productos"]).Add(producto);
                    }
                }


                //Quitar al producto de la lista de deseos (solo de SESSION), no así de la bd
                ListaDeseo = (List <ProductoEntidad>)Current.Session["ListaDeseos"];

                if (ListaDeseo != null || ListaDeseo.Any())
                {
                    ListaDeseo.RemoveAll(x => x.IdProducto == producto.IdProducto);
                    //Current.Session["ListaDeseos"] = new List<ProductoEntidad>();
                    Current.Session["ListaDeseos"] = ListaDeseo;
                }

                //Quitar al producto en BD de la lista de deseos
                ListaDeseosCore   unListaDeseoCore = new ListaDeseosCore();
                ListaDeseoEntidad DeseoEliminar    = new ListaDeseoEntidad();
                DeseoEliminar.IdProducto    = producto.IdProducto;
                DeseoEliminar.NombreUsuario = logueadoStatic.NombreUsuario;
                unListaDeseoCore.ListaDeseosDelete(DeseoEliminar);
            }
            return(producto.DescripProducto);
        }
Ejemplo n.º 17
0
 public IActionResult Eliminar([FromRoute] int docenteEnSesion, [FromQuery] int id)
 {
     try
     {
         ProductoCore productoCore = new ProductoCore(dbContext);
         Resultado    resultado    = productoCore.Eliminar(id, docenteEnSesion);
         if (resultado.codigo == 200)
         {
             return(Ok(resultado.mensaje));
         }
         return(StatusCode(resultado.codigo, resultado.mensaje));
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
     }
 }
Ejemplo n.º 18
0
 public IActionResult Actualizar([FromBody] Producto producto, [FromRoute] int docenteEnSesion)
 {
     try
     {
         ProductoCore productoCore = new ProductoCore(dbContext);
         Resultado    resultado    = productoCore.Actualizar(producto, docenteEnSesion);
         if (resultado.codigo == 200)
         {
             return(Ok(resultado.mensaje));
         }
         return(StatusCode(resultado.codigo, resultado.mensaje));
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
     }
 }
Ejemplo n.º 19
0
 public IActionResult Crear([FromBody] Producto producto)
 {
     try
     {
         ProductoCore productoCore = new ProductoCore(dbContext);
         Resultado    resultado    = productoCore.Crear(producto);
         if (resultado.codigo == 200)
         {
             return(Ok(resultado.mensaje));
         }
         return(StatusCode(resultado.codigo, resultado.mensaje));
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
     }
 }
        //protected void CargarDropdownProductos()
        //{
        //    ddlProducto.DataSource = ProductoBLL.FindAllByCUIT(1);
        //    ddlProducto.DataValueField = "IdProducto";
        //    ddlProducto.DataTextField = "DescripProducto";
        //    ddlProducto.DataBind();
        //}

        //protected void grillacatprod_RowDeleting(object sender, GridViewDeleteEventArgs e)
        //{
        //    ProdCategoriaEntidad AsociacionAEliminar = new ProdCategoriaEntidad();
        //    GridViewRow row = (GridViewRow)grillacatprod.Rows[e.RowIndex];
        //    var IdCategoria = ((string)row.Cells[3].Text);
        //    AsociacionAEliminar.IdProducto = IdProdAux;
        //    AsociacionAEliminar.IdCategoria = Convert.ToInt32(IdCategoria);
        //    CategoriaBLL.CategoriaProdDelete(AsociacionAEliminar.IdProducto, AsociacionAEliminar.IdCategoria);
        //    ActualizarCategoriasFiltradas();

        //}


        protected void btnGrabarAsociacion_Click(object sender, EventArgs e)
        {
            List <CategoriaEntidad> CategoriasDeProducto = new List <CategoriaEntidad>();
            ProdCategoriaEntidad    NuevaAsociacion      = new ProdCategoriaEntidad();

            if (IdProdAux > 0)
            {
                CategoriasDeProducto = ProductoBLL.ProductoSelectAllCategorias(IdProdAux);
                if (!CategoriasDeProducto.Exists(X => X.IdCategoria == Int32.Parse(cboCategoria.SelectedValue)))
                {
                    NuevaAsociacion.IdProducto  = IdProdAux;
                    NuevaAsociacion.IdCategoria = Int32.Parse(cboCategoria.SelectedValue);
                    NuevaAsociacion.CUIT        = ConfigSection.Default.Site.Cuit;

                    ProductoCore UnCoreProducto = new ProductoCore();
                    UnCoreProducto.ProductoCategoriaInsert(NuevaAsociacion);

                    ActualizarCategoriasFiltradas();
                    Current.Session["unasCategoriasFiltradas"] = null;
                    unasCategorias.Clear();
                }
            }
        }
Ejemplo n.º 21
0
        public void CargarListaDeseosEnSession()
        {
            ListaDeseosCore        unaListaDeseosCore = new ListaDeseosCore();
            ProductoCore           unProductoCore     = new ProductoCore();
            List <ProductoEntidad> listaDeseos        = new List <ProductoEntidad>();

            usuario = (UsuarioEntidad)Current.Session["Usuario"];

            Current.Session["ListaDeseos"] = new List <ProductoEntidad>();

            List <ListaDeseoEntidad> unasListaDeseoEntidad = new List <ListaDeseoEntidad>();

            unasListaDeseoEntidad = unaListaDeseosCore.ListaDeseosSelectAllByCUIT_NombreUsuario(usuario.NombreUsuario);

            foreach (var item in unasListaDeseoEntidad)
            {
                ProductoEntidad unProductoEntidad = new ProductoEntidad();
                unProductoEntidad = unProductoCore.Find(item.IdProducto, 1);
                listaDeseos.Add(unProductoEntidad);
            }

            Current.Session["ListaDeseos"] = listaDeseos;
            //ActualizarDeseos();
        }
Ejemplo n.º 22
0
        public void CargarListaDeseosEnSession()
        {
            ListaDeseosCore        unaListaDeseosCore = new ListaDeseosCore();
            ProductoCore           unProductoCore     = new ProductoCore();
            List <ProductoEntidad> listaDeseos        = new List <ProductoEntidad>();

            usuario = (UsuarioEntidad)Current.Session["Usuario"];

            Current.Session["ListaDeseos"] = new List <ProductoEntidad>();

            List <ListaDeseoEntidad> unasListaDeseoEntidad = new List <ListaDeseoEntidad>();

            unasListaDeseoEntidad = unaListaDeseosCore.ListaDeseosSelectAllByCUIT_NombreUsuario(usuario.NombreUsuario);
            var valorMonedaDropDown = Convert.ToInt32(obtenerValorDropDown());

            foreach (var item in unasListaDeseoEntidad)
            {
                ProductoEntidad unProductoEntidad = new ProductoEntidad();
                unProductoEntidad = unProductoCore.Find(item.IdProducto, valorMonedaDropDown);
                listaDeseos.Add(unProductoEntidad);
            }

            Current.Session["ListaDeseos"] = listaDeseos;
        }
Ejemplo n.º 23
0
        public static void AgregarDeseo(string idProducto)
        {
            var Current        = HttpContext.Current;
            var logueadoStatic = (UsuarioEntidad)Current.Session["Usuario"];
            List <ListaDeseoEntidad> listaDeseosSesion  = new List <ListaDeseoEntidad>();
            List <ProductoEntidad>   unaListaProductos  = new List <ProductoEntidad>();
            ListaDeseosCore          unaListaDeseosCore = new ListaDeseosCore();
            ListaDeseoEntidad        unaListaDeseo      = new ListaDeseoEntidad();
            ProductoCore             unProductoCore     = new ProductoCore();

            unaListaProductos = (List <ProductoEntidad>)Current.Session["ListaDeseos"];

            unaListaDeseo.CUIT          = logueadoStatic.CUIT;
            unaListaDeseo.NombreUsuario = logueadoStatic.NombreUsuario;
            unaListaDeseo.IdProducto    = Int32.Parse(idProducto);
            var cotizacion = new MonedaEmpresaEntidad();

            cotizacion = (MonedaEmpresaEntidad)Current.Session["Productos"];
            //Guardar en BD el nuevo deseo
            if (unaListaDeseosCore.ListaDeseosInsert(unaListaDeseo) > 0)
            {
                //Agregar el deseo a la sesión actual
                //List<ListaDeseoEntidad> unasListaDeseoEntidad = new List<ListaDeseoEntidad>();
                //unasListaDeseoEntidad = unaListaDeseosCore.ListaDeseosSelectAllByCUIT_NombreUsuario(logueadoStatic.NombreUsuario);

                //foreach (var item in unasListaDeseoEntidad)
                //{
                ProductoEntidad unProductoEntidad = new ProductoEntidad();
                unProductoEntidad = unProductoCore.Find(unaListaDeseo.IdProducto, 1);
                unaListaProductos.Add(unProductoEntidad);
                //}
                //listaDeseosSesion.Add(unaListaDeseo);
                Current.Session["ListaDeseos"] = unaListaProductos;
                //ActualizarDeseos();
            }
        }
Ejemplo n.º 24
0
        protected void grilladeultimospedidos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            ProductoCore coreProducto = new ProductoCore();

            if (e.CommandName.Equals("VerDetalle"))
            {
                int           index     = Convert.ToInt32(e.CommandArgument);
                string        code      = grilladeultimospedidos.DataKeys[index].Value.ToString();
                PedidoEntidad PedidoRow = pedidoCore.PedidoSelectByCUIT_NroPedidoCliente(logueado.CUIT, Convert.ToInt64(code));
                List <PedidoDetalleEntidad> ListadeDetalles  = pedidoCore.PedidosDetalleSelect(PedidoRow.IdPedido);
                List <DetalleDTO>           ListaDetallesDTO = new List <DetalleDTO>();
                foreach (var item in ListadeDetalles)
                {
                    DetalleDTO NuevoDetalle = new DetalleDTO();
                    NuevoDetalle.Producto       = coreProducto.Find(item.miProducto.IdProducto, 1).DescripProducto;
                    NuevoDetalle.Cantidad       = item.Cantidad;
                    NuevoDetalle.PrecioUnitario = item.PrecioUnitario;
                    NuevoDetalle.Total          = NuevoDetalle.Cantidad * NuevoDetalle.PrecioUnitario;

                    ListaDetallesDTO.Add(NuevoDetalle);
                }
                grilladedetallesdelpedido.DataSource = ListaDetallesDTO;
                grilladedetallesdelpedido.DataBind();
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#currentdetail').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "ModalScript", sb.ToString(), false);
            }
            //if (e.CommandName.Equals("PagarPedido"))
            //{
            //    //Obtener IdPedido seleccionado
            //    int index = Convert.ToInt32(e.CommandArgument);
            //    Int64 unNroPedido = Int64.Parse(grilladeultimospedidos.DataKeys[index].Value.ToString());
            //    //variables
            //    PedidoCore unManagerPedido = new PedidoCore();
            //    var Current = HttpContext.Current;
            //    PedidoEntidad unPedidoPagar = new PedidoEntidad();
            //    SucursalCore ManagerSucursal = new SucursalCore();

            //    //Preparar parámetros a enviar a Avanzar()
            //    logueado = (UsuarioEntidad)Current.Session["Usuario"];
            //    unPedidoPagar = unManagerPedido.PedidoSelectByCUIT_NroPedido(unNroPedido);
            //    unPedidoPagar.misDetalles = unManagerPedido.PedidosDetalleSelect(unPedidoPagar.IdPedido);
            //    SucursalEntidad unaSucursal = ManagerSucursal.SucursalTraerPorDireccionSucursal(unPedidoPagar.miDireccionEntrega.IdDireccion);

            //    TarjetaEntidad unaTarjeta = new TarjetaEntidad();
            //    TarjetaCore coreTarjeta = new TarjetaCore();
            //    List<TarjetaEntidad> MisTarjetas = coreTarjeta.SelectAllTarjetasByCUIT_NombreUsuario(ConfigSection.Default.Site.Cuit, logueado.NombreUsuario);
            //    foreach (var t in MisTarjetas)
            //    {
            //        if (t.Predeterminada == true)
            //        {
            //            unaTarjeta = t;
            //        }
            //    }

            //    if (unManagerPedido.PagarPedido(unaTarjeta.Numero.ToString(), unaTarjeta.CodSeguridad, (decimal)unPedidoPagar.misDetalles.Select(x => x.Cantidad * x.miProducto.PrecioUnitario).Sum()))
            //    {
            //        unManagerPedido.AvanzarPaso(unPedidoPagar, unaSucursal, logueado);
            //        return true;
            //    }
            //    return false;

            //    CargarGrillaUltimosPedidos();
            //    Response.Redirect(Request.RawUrl);

            //}//END Pagar
        }//END GrillaMetodos
Ejemplo n.º 25
0
        protected void grilladeultimospedidos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            ProductoCore coreProducto = new ProductoCore();

            if (e.CommandName.Equals("VerDetalle"))
            {
                int           index     = Convert.ToInt32(e.CommandArgument);
                string        code      = grilladeultimospedidos.DataKeys[index].Value.ToString();
                PedidoEntidad PedidoRow = pedidoCore.PedidoSelectByCUIT_NroPedidoCliente(usuarioentidad.CUIT, Convert.ToInt64(code));
                List <PedidoDetalleEntidad> ListadeDetalles  = pedidoCore.PedidosDetalleSelect(PedidoRow.IdPedido);
                List <DetalleDTO>           ListaDetallesDTO = new List <DetalleDTO>();
                foreach (var item in ListadeDetalles)
                {
                    DetalleDTO NuevoDetalle = new DetalleDTO();
                    NuevoDetalle.Producto       = coreProducto.Find(item.miProducto.IdProducto, 1).DescripProducto;
                    NuevoDetalle.Cantidad       = item.Cantidad;
                    NuevoDetalle.PrecioUnitario = item.PrecioUnitario;
                    NuevoDetalle.Total          = NuevoDetalle.Cantidad * NuevoDetalle.PrecioUnitario;

                    ListaDetallesDTO.Add(NuevoDetalle);
                }

                grilladedetallesdelpedido.DataSource = ListaDetallesDTO;
                grilladedetallesdelpedido.DataBind();
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#currentdetail').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "ModalScript", sb.ToString(), false);
            }

            if (e.CommandName.Equals("CambiarEstado"))
            {
                string[] unosPermisosTest = new string[] { "PedidoMod" };
                if (usuarioentidad != null && this.Master.Autenticar(unosPermisosTest))
                {
                    //variables
                    PedidoCore    unManagerPedido = new PedidoCore();
                    var           Current         = HttpContext.Current;
                    PedidoEntidad unPedidoPagar   = new PedidoEntidad();
                    SucursalCore  ManagerSucursal = new SucursalCore();

                    //Inicializacion
                    int   index       = Convert.ToInt32(e.CommandArgument);
                    Int64 unNroPedido = Int64.Parse(grilladeultimospedidos.DataKeys[index].Value.ToString());

                    //Preparar parámetros a enviar a Avanzar()
                    logueado                  = (UsuarioEntidad)Current.Session["Usuario"];
                    unPedidoPagar             = pedidoCore.PedidoSelectByCUIT_NroPedidoCliente(usuarioentidad.CUIT, unNroPedido);
                    unPedidoPagar.misDetalles = unManagerPedido.PedidosDetalleSelect(unPedidoPagar.IdPedido);
                    SucursalEntidad unaSucursal = ManagerSucursal.SucursalTraerPorDireccionSucursal(unPedidoPagar.miDireccionEntrega.IdDireccion);

                    //No se puede descancelar un Pedido
                    if (unPedidoPagar.VerEstadoActual().IdEstadoPedido == (int)EstadoPedidoEntidad.Options.Cancelado)
                    {
                        System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
                        sb2.Append(@"<script type='text/javascript'>");
                        sb2.Append("$('#BloqueadoModifFinalizado').modal('show');");
                        sb2.Append(@"</script>");
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                                "ModalScript2", sb2.ToString(), false);
                    }

                    //Pendiente hacia Pago
                    if (unPedidoPagar.VerEstadoActual().IdEstadoPedido == (int)EstadoPedidoEntidad.Options.PendientePago)
                    {
                        unManagerPedido.AvanzarPaso(unPedidoPagar, unaSucursal, logueado, (int)FormaPagoEntidad.Options.Externa);
                    }

                    //Pago Hacia EnCamino
                    else if (unPedidoPagar.VerEstadoActual().IdEstadoPedido == (int)EstadoPedidoEntidad.Options.Pago && unPedidoPagar.miFormaEntrega.IdFormaEntrega == (int)FormaEntregaEntidad.Options.Correo)
                    {
                        string unNroTracking = "TNK9966784523234";
                        unManagerPedido.AvanzarPaso(unPedidoPagar, unNroTracking);
                    }

                    //Pago Hacia ListoRetirar
                    else if (unPedidoPagar.VerEstadoActual().IdEstadoPedido == (int)EstadoPedidoEntidad.Options.Pago && unPedidoPagar.miFormaEntrega.IdFormaEntrega == (int)FormaEntregaEntidad.Options.Sucursal)
                    {
                        unManagerPedido.AvanzarPaso(unPedidoPagar);
                    }

                    //EnCamino y/o ListoRetirar hacia Entregado
                    else if (unPedidoPagar.VerEstadoActual().IdEstadoPedido == (int)EstadoPedidoEntidad.Options.EnCamino | unPedidoPagar.VerEstadoActual().IdEstadoPedido == (int)EstadoPedidoEntidad.Options.ListoRetirar)
                    {
                        unManagerPedido.AvanzarPaso(unPedidoPagar);
                    }
                }
                else
                {
                    System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
                    sb2.Append(@"<script type='text/javascript'>");
                    sb2.Append("$('#PedidoModFalse').modal('show');");
                    sb2.Append(@"</script>");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                            "ModalScript10", sb2.ToString(), false);
                }
            }

            if (e.CommandName.Equals("CancelarPedido"))
            {
                string[] unosPermisosTest = new string[] { "PedidoCancelar" };
                if (usuarioentidad != null && this.Master.Autenticar(unosPermisosTest))
                {
                    //variables
                    PedidoCore    unManagerPedido = new PedidoCore();
                    var           Current         = HttpContext.Current;
                    PedidoEntidad unPedidoPagar   = new PedidoEntidad();
                    SucursalCore  ManagerSucursal = new SucursalCore();

                    //Inicializacion
                    int   index       = Convert.ToInt32(e.CommandArgument);
                    Int64 unNroPedido = Int64.Parse(grilladeultimospedidos.DataKeys[index].Value.ToString());

                    //Preparar parámetros a enviar a Avanzar()
                    logueado      = (UsuarioEntidad)Current.Session["Usuario"];
                    unPedidoPagar = pedidoCore.PedidoSelectByCUIT_NroPedidoCliente(usuarioentidad.CUIT, unNroPedido);

                    //Cancelar
                    if (unPedidoPagar.VerEstadoActual().IdEstadoPedido != (int)EstadoPedidoEntidad.Options.Cancelado)
                    {
                        unManagerPedido.CancelarPedido(unPedidoPagar);
                    }
                    //No se puede descancelar un pedido
                    else
                    {
                        System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
                        sb2.Append(@"<script type='text/javascript'>");
                        sb2.Append("$('#BloqueadoModifFinalizado').modal('show');");
                        sb2.Append(@"</script>");
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                                "ModalScript7", sb2.ToString(), false);
                    }

                    CargarGrillaUltimosPedidos();
                }
                else
                {
                    System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
                    sb2.Append(@"<script type='text/javascript'>");
                    sb2.Append("$('#PedidoModFalse').modal('show');");
                    sb2.Append(@"</script>");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                            "ModalScript11", sb2.ToString(), false);
                }
            }
        }
Ejemplo n.º 26
0
        public static List <String> ObtenerDeseosSession()
        {
            var                  Current         = HttpContext.Current;
            MonedaEntidad        moneda          = new MonedaEntidad();
            MonedaCore           _coreMoneda     = new MonedaCore();
            MonedaEmpresaEntidad cotizacion      = (MonedaEmpresaEntidad)Current.Session["Cotizacion"];
            ProductoCore         ManagerProducto = new ProductoCore();

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

            var plantilla =
                "<tr class=\"{0}\">" +
                "<td class=\"text-center\" style=\"padding: 7px;\">" +
                "<div class=\"img-thumbnail img-thumbnail-cart\">" +
                "<img class=\"img-responsive\" src=\"/Content/Images/Productos/{1}\" style=\"vertical-align: middle;\" />" +
                "</div>" +
                "</td>" +
                "<td class=\"product-descripcion\">" +
                "<h4>{2}</h4>" +
                "<small>SKU: {3}</small>" +
                "</td>" +
                "<td class=\"text-center\">" +
                "<p>" +
                "<span>{4}</span> <span>{5}</span>" +
                "</p>" +
                "</td>" +
                "<td class=\"text-center\">" +
                "<button class=\"btn btn-info\" id=\"btnComprar2\" data-producto2=\"{6}\" onclick=\"onBtnComprar(this)\">Comprar</button>" +
                "</td>" +
                "<td class=\"text-center\">" +
                "<button class=\"btn btn-danger\" id=\"btnEliminarDeseo\" data-prodeliminar=\"{7}\" onclick=\"onbtnEliminarDeseo(this)\">Eliminar</button>" +
                "</td>" +
                "</tr>";   //FIN Plantilla

            var pl = new List <String>();

            List <ProductoEntidad> unosDeseos = (List <ProductoEntidad>)Current.Session["ListaDeseos"];
            List <ProductoEntidad> unosDeseosPrecioCalculo = new List <ProductoEntidad>();

            if (unosDeseos != null && unosDeseos.Any())
            {
                foreach (ProductoEntidad unDeseo in unosDeseos)
                {
                    unosDeseosPrecioCalculo.Add(ManagerProducto.Find(unDeseo.IdProducto, moneda.IdMoneda));
                }


                //foreach (ProductoEntidad unDeseo in unosDeseos)
                //{
                //    if (cotizacion.Cotizacion > 1)
                //        unDeseo.PrecioUnitario = System.Decimal.Round(unDeseo.PrecioUnitario / cotizacion.Cotizacion, 2);
                //    else
                //        unDeseo.PrecioUnitario = System.Decimal.Round(unDeseo.PrecioUnitario * cotizacion.Cotizacion, 2);
                //}

                unosDeseosPrecioCalculo.ForEach(x => pl.Add(string.Format(plantilla, x.IdProducto, x.URL, x.DescripProducto, x.CodigoProducto, moneda.SimboloMoneda, x.PrecioUnitario, x.IdProducto, x.IdProducto)));
            }

            return(pl);
        }
Ejemplo n.º 27
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);
            }
        }
Ejemplo n.º 28
0
        ////Para mantener la sesión activa
        //[WebMethod(EnableSession = true)]
        //public static void MantenerSesion()
        //{

        //}


        protected void Page_Load(object sender, EventArgs e)
        {
            var          Current      = HttpContext.Current;
            SucursalCore coreSucursal = new SucursalCore();

            idioma = new LenguajeEntidad();
            PedidoCore    ManagerPedido   = new PedidoCore();
            PedidoEntidad unPedido        = new PedidoEntidad();
            ProductoCore  ManagerProducto = new ProductoCore();

            NroPedDUltPed = Page.Request.QueryString["NroPedDUltPed"];
            if (!string.IsNullOrEmpty(NroPedDUltPed))
            {
                Current.Session["NroPedidoDesdeUltimosPedidos"] = NroPedDUltPed;
            }
            else
            {
                Response.Redirect("/Areas/Public/Forms/Home.aspx");
            }

            logueado = (UsuarioEntidad)Current.Session["Usuario"];

            if (logueado == null)
            {
                Response.Redirect("/Areas/Public/Forms/Home.aspx");
            }
            if (!IsPostBack)
            {
                idioma = (LenguajeEntidad)Session["Idioma"];

                if (idioma == null)
                {
                    idioma = new LenguajeEntidad();
                    idioma.DescripcionLenguaje = "es";
                    Session["Idioma"]          = idioma;
                }
            }
            else
            {
                idioma.DescripcionLenguaje = Master.obtenerIdiomaCombo();
                Session["Idioma"]          = idioma;
            }
            DropDownList lblIdioma = FindControlFromMaster <DropDownList>("ddlLanguages");

            if (lblIdioma != null)
            {
                lblIdioma.SelectedValue = idioma.DescripcionLenguaje;
            }

            unPedido             = ManagerPedido.PedidoSelectByCUIT_NroPedido(Int64.Parse(NroPedDUltPed));
            unPedido.misDetalles = ManagerPedido.PedidosDetalleSelect(unPedido.IdPedido);
            MonedaEmpresaEntidad cotizacion = (MonedaEmpresaEntidad)Session["Cotizacion"];

            foreach (PedidoDetalleEntidad unDet in unPedido.misDetalles)
            {
                unDet.miProducto = ManagerProducto.Find(unDet.miProducto.IdProducto, cotizacion.IdMoneda);
            }

            FormaEntrega = unPedido.miFormaEntrega.IdFormaEntrega;
            pedido       = unPedido.IdPedido;
            totalizado   = unPedido.misDetalles.Select(x => x.Cantidad * x.miProducto.PrecioUnitario).Sum();
            //TODO: sacarle el precio de envio hardcodeado:
            if (FormaEntrega != null && FormaEntrega == (int)FormaEntregaEntidad.Options.Correo)
            {
                totalizado = totalizado + 100;
            }


            unPedido.misDetalles.ForEach(x => lista.Add(new PedidoLista()
            {
                Cantidad = x.Cantidad,
                Producto = x.miProducto,
                Stock    = true
            }));

            TarjetaCore           coreTarjeta = new TarjetaCore();
            List <TarjetaEntidad> MisTarjetas = coreTarjeta.SelectAllTarjetasByCUIT_NombreUsuario(ConfigSection.Default.Site.Cuit, logueado.NombreUsuario);

            foreach (var t in MisTarjetas)
            {
                if (t.Predeterminada == true)
                {
                    MiTarjeta = t;
                }
            }
        }
Ejemplo n.º 29
0
        protected void grilladefacturas_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            ProductoCore coreProducto = new ProductoCore();

            if (e.CommandName.Equals("VerDetalle"))
            {
                int                index           = Convert.ToInt32(e.CommandArgument);
                string             code            = grilladefacturas.DataKeys[index].Value.ToString();
                string             ultimos8delcode = code.Substring(code.Length - 8);
                string             nrocomprobantesincerosalaizquierda = ultimos8delcode.TrimStart('0');
                ComprobanteEntidad ComprobanteRow = ComprobanteBLL.ComprobanteSelectAllByCUIT_NroComprobante(Convert.ToInt32(nrocomprobantesincerosalaizquierda));
                List <ComprobanteDetalleEntidad> ListadeDetalles  = ComprobanteBLL.DetallesSelectByComprobante(ComprobanteRow.NroComprobante, ComprobanteRow.miSucursal.IdSucursal, ComprobanteRow.miTipoComprobante.IdTipoComprobante);
                List <FacturasDetalleDTO>        ListaDetallesDTO = new List <FacturasDetalleDTO>();
                foreach (var item in ListadeDetalles)
                {
                    FacturasDetalleDTO NuevoDetalle = new FacturasDetalleDTO();
                    NuevoDetalle.Producto       = coreProducto.Find(item.miProducto.IdProducto, 1).DescripProducto;
                    NuevoDetalle.Cantidad       = item.CantidadProducto;
                    NuevoDetalle.PrecioUnitario = item.PrecioUnitarioFact;
                    NuevoDetalle.Total          = NuevoDetalle.Cantidad * NuevoDetalle.PrecioUnitario;

                    ListaDetallesDTO.Add(NuevoDetalle);
                }

                grilladedetallesdefactura.DataSource = ListaDetallesDTO;
                grilladedetallesdefactura.DataBind();
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#currentdetail').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "ModalScript", sb.ToString(), false);
            }


            if (e.CommandName.Equals("GenerarNDeb"))
            {
                int    index           = Convert.ToInt32(e.CommandArgument);
                string code            = grilladefacturas.DataKeys[index].Value.ToString();
                string ultimos8delcode = code.Substring(code.Length - 8);
                string nrocomprobantesincerosalaizquierda = ultimos8delcode.TrimStart('0');
                var    comprobantes = ComprobanteBLL.ComprobanteSelectAllListadosByCUIT_NroComprobante(Convert.ToInt32(nrocomprobantesincerosalaizquierda));
                if (comprobantes.Any(c => c.miTipoComprobante.IdTipoComprobante > 4 && c.miTipoComprobante.IdTipoComprobante < 8))
                {
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append("alert('No es posible de realizar, la factura posee una Nota de crédito asociada');");
                    sb.Append(@"</script>");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                            "ModalScript2", sb.ToString(), false);
                }
                else if (comprobantes.Any(c => c.miTipoComprobante.IdTipoComprobante >= 8))
                {
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append("alert('No es posible de realizar, la factura ya posee una Nota de débito asociada');");
                    sb.Append(@"</script>");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                            "ModalScript4", sb.ToString(), false);
                }
                else
                {
                    //NroFactAsocND.Value = code;
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append("$('#NroFactAsocND').val('");
                    sb.Append(code);
                    sb.Append("');");
                    sb.Append("$('#mdl_MontoNotaDebito').modal('show');");
                    sb.Append(@"</script>");
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                            "ModalScript3", sb.ToString(), false);
                }
            }
        }
Ejemplo n.º 30
0
        protected void grilladenc_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            ProductoCore coreProducto = new ProductoCore();

            if (e.CommandName.Equals("VerDetalle"))
            {
                int                index           = Convert.ToInt32(e.CommandArgument);
                string             code            = grilladenc.DataKeys[index].Value.ToString();
                string             ultimos8delcode = code.Substring(code.Length - 8);
                string             nrocomprobantesincerosalaizquierda = ultimos8delcode.TrimStart('0');
                ComprobanteEntidad ComprobanteRow = ComprobanteBLL.ComprobanteSelectAllByCUIT_NroComprobante(Convert.ToInt32(nrocomprobantesincerosalaizquierda));
                List <ComprobanteDetalleEntidad> ListadeDetalles = ComprobanteBLL.DetallesSelectByComprobante(ComprobanteRow.NroComprobante, ComprobanteRow.miSucursal.IdSucursal, ComprobanteRow.miTipoComprobante.IdTipoComprobante);
                List <NCDetalleDTO> ListaDetallesDTO             = new List <NCDetalleDTO>();
                foreach (var item in ListadeDetalles)
                {
                    NCDetalleDTO NuevoDetalle = new NCDetalleDTO();
                    NuevoDetalle.Producto       = coreProducto.Find(item.miProducto.IdProducto, 1).DescripProducto;
                    NuevoDetalle.Cantidad       = item.CantidadProducto;
                    NuevoDetalle.PrecioUnitario = item.PrecioUnitarioFact;
                    NuevoDetalle.Total          = NuevoDetalle.Cantidad * NuevoDetalle.PrecioUnitario;

                    ListaDetallesDTO.Add(NuevoDetalle);
                }


                grilladedetallesdenc.DataSource = ListaDetallesDTO;
                grilladedetallesdenc.DataBind();
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#currentdetail').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "ModalScript", sb.ToString(), false);
            }


            //if (e.CommandName.Equals("GenerarND"))
            //{
            //    int index = Convert.ToInt32(e.CommandArgument);
            //    string code = grilladenc.DataKeys[index].Value.ToString();
            //    string ultimos8delcode = code.Substring(code.Length - 8);
            //    string nrocomprobantesincerosalaizquierda = ultimos8delcode.TrimStart('0');
            //    var comprobantes = ComprobanteBLL.ComprobanteSelectAllListadosByCUIT_NroComprobante(Convert.ToInt32(nrocomprobantesincerosalaizquierda));
            //    if (comprobantes.Any(c => c.IdTipoComprobante == 6 || c.IdTipoComprobante > 8))
            //    {
            //        System.Text.StringBuilder sb = new System.Text.StringBuilder();
            //        sb.Append(@"<script type='text/javascript'>");
            //        sb.Append("alert('Nota de debito ya fue generada previamente');");
            //        sb.Append(@"</script>");
            //        ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
            //                   "ModalScript", sb.ToString(), false);
            //    }
            //    else {
            //        ComprobanteEntidad ComprobanteRow = new ComprobanteEntidad();
            //         ComprobanteRow = ComprobanteBLL.ComprobanteSelectAllByCUIT_NroComprobante(Convert.ToInt32(nrocomprobantesincerosalaizquierda));
            //         List<ComprobanteDetalleEntidad> ListadeDetalles = new List<ComprobanteDetalleEntidad>();
            //        ListadeDetalles = ComprobanteBLL.DetallesSelectByComprobante(ComprobanteRow.NroComprobante, ComprobanteRow.IdSucursal, ComprobanteRow.IdTipoComprobante);

            //        ComprobanteEntidad Notadedebito = new ComprobanteEntidad();
            //            Notadedebito = ComprobanteRow;
            //            Notadedebito.FechaComprobante = DateTime.Now;
            //            Notadedebito.Detalles = new List<ComprobanteDetalleEntidad>();
            //        switch (ComprobanteRow.IdTipoComprobante)
            //        {
            //            case 1:
            //                Notadedebito.IdTipoComprobante = 6;
            //                break;
            //            case 2:
            //                Notadedebito.IdTipoComprobante = 9;
            //                break;
            //            case 3:
            //                Notadedebito.IdTipoComprobante = 10;
            //                break;
            //            default:
            //                Notadedebito.IdTipoComprobante = 6;
            //                break;
            //        }


            //        int ContadorDetalle = 0;

            //        foreach (var item in ListadeDetalles)
            //        {

            //            ComprobanteDetalleEntidad unDetalleComprobante = new ComprobanteDetalleEntidad();
            //            ContadorDetalle = ContadorDetalle + 1;
            //            unDetalleComprobante.IdComprobanteDetalle = ContadorDetalle;
            //            unDetalleComprobante.NroComprobante = ComprobanteRow.NroComprobante;
            //            unDetalleComprobante.IdSucursal = ComprobanteRow.IdSucursal;
            //            unDetalleComprobante.IdTipoComprobante = Notadedebito.IdTipoComprobante;
            //            unDetalleComprobante.CUIT = ConfigSection.Default.Site.Cuit;
            //            unDetalleComprobante.IdProducto = item.IdProducto;
            //            unDetalleComprobante.CantidadProducto = item.CantidadProducto;
            //            unDetalleComprobante.PrecioUnitarioFact = item.PrecioUnitarioFact;
            //            Notadedebito.Detalles.Add(unDetalleComprobante);

            //        }

            //        ComprobanteBLL.Create(Notadedebito);


            //        System.Text.StringBuilder sb = new System.Text.StringBuilder();
            //        sb.Append(@"<script type='text/javascript'>");
            //        sb.Append("alert('Nota de debito generada');");
            //        sb.Append(@"</script>");
            //        ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
            //                   "ModalScript", sb.ToString(), false);

            //    }
            //}
        }