コード例 #1
0
        public async Task <ActionResult <ListaPrecios> > PostListaPrecios(ListaPrecios listaPrecios)
        {
            _context.listaPrecios.Add(listaPrecios);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetListaPrecios", new { id = listaPrecios.Id }, listaPrecios));
        }
コード例 #2
0
        public void InsertarListaP(EntityConnectionStringBuilder connection, ListaPrecios l)
        {
            var context = new samEntities(connection.ToString());

            context.INSERT_lista_precios_MDL(l.PLTYP,
                                             l.PTEXT);
        }
コード例 #3
0
        public async Task ClonarLista(int Id)
        {
            ListaPrecios listaAClonar = await http.GetJsonAsync <ListaPrecios>($"api/ListaPrecios/{Id}");

            ListaPrecios.DetalleListaPrecios = new List <DetalleListaPrecios>();
            listaAClonar.DetalleListaPrecios.ForEach(x => { x.Id = 0; ListaPrecios.DetalleListaPrecios.Add(x); });
            cargando = false;
        }
コード例 #4
0
        public int insListaPrecios(ListaPrecios listaPrecios)
        {
            sp_Pedidos spRequestPedidos = new sp_Pedidos();
            DataDB     data             = new DataDB("SIVEDIBDEntities");

            StoreProcedure SP          = spRequestPedidos.insListaPrecios("SPR_IU_LISTA_PRECIOS", listaPrecios);
            int            codigoLista = data.ExecuteInsert(SP, "PO_NRESULT");

            return(codigoLista);
        }
コード例 #5
0
        public async Task EliminarListaDePrecios(ListaPrecios lista)
        {
            await repositorio.Delete($"api/ListaPrecios/{lista.Id}");

            await ListarListas();

            toastService.ShowSuccess($"Se creó eliminó la Lista de Precio");

            this.StateHasChanged();
        }
コード例 #6
0
        public StoreProcedure insListaPrecios(string spName, ListaPrecios listaPrecios)
        {
            StoreProcedure storeProcedure = new StoreProcedure();

            storeProcedure.Nombre     = spName;
            storeProcedure.Parametros = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@PI_NLPR_NID",
                    SqlDbType     = System.Data.SqlDbType.Int,
                    Value         = listaPrecios.CODIGO
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_CCODIGO_LISTA",
                    SqlDbType     = System.Data.SqlDbType.VarChar,
                    Value         = listaPrecios.CODIGO_LISTA
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_CNOMBRE_LISTA",
                    SqlDbType     = System.Data.SqlDbType.VarChar,
                    Value         = listaPrecios.NOMBRE
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OES_ESTANDAR",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = listaPrecios.ES_ESTANDAR
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OESTADO",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = listaPrecios.ESTADO
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_NCODIGO_CAMPANA",
                    SqlDbType     = System.Data.SqlDbType.Int,
                    Value         = listaPrecios.CODIGO_CAMPANA
                },
                new SqlParameter()
                {
                    ParameterName = "@PO_NRESULT",
                    SqlDbType     = System.Data.SqlDbType.Int,
                    Direction     = System.Data.ParameterDirection.Output,
                    Value         = listaPrecios.CODIGO
                }
            };

            return(storeProcedure);
        }
コード例 #7
0
        protected override async Task OnParametersSetAsync()
        {
            if (ListaPreciosId != 0)
            {
                ListaPrecios = await http.GetJsonAsync <ListaPrecios>($"api/ListaPrecios/{ListaPreciosId}");

                ListarProductosPresentacion();

                productos = productoPresentaciones.Select(x => x.Producto).Distinct().ToList();

                categorias = productos.Select(x => x.CategoriaProducto).Distinct().ToList();
            }
        }
コード例 #8
0
        protected override async Task OnInitializedAsync()
        {
            if (Id == 0)
            {
                ListaPrecios = new ListaPrecios();
            }
            else
            {
                ListaPrecios = await http.GetJsonAsync <ListaPrecios>($"api/ListaPrecios/{Id}");
            }

            await ListarTiposListaDePrecios();

            await ListarProductosPresentacion();

            productos  = productoPresentaciones.Select(x => x.Producto).Distinct().ToList();
            categorias = productos.Select(x => x.CategoriaProducto).Distinct().ToList();
        }
コード例 #9
0
        public async Task <IActionResult> PutListaPrecios(int id, ListaPrecios listaPrecios)
        {
            if (id != listaPrecios.Id)
            {
                return(BadRequest());
            }

            _context.Entry(listaPrecios).State = EntityState.Modified;
            listaPrecios.DetalleListaPrecios.ForEach(x =>
            {
                if (x.Id == 0)
                {
                    _context.Entry(x).State = EntityState.Added;
                }
                else
                {
                    _context.Entry(x).State = EntityState.Modified;
                }
            });
            var detallesId      = listaPrecios.DetalleListaPrecios.Select(x => x.Id).ToList();
            var detallesABorrar = _context.detalleListaPrecios.Where(x => !detallesId.Contains(x.Id) && x.ListaPreciosId == listaPrecios.Id).ToList();

            _context.detalleListaPrecios.RemoveRange(detallesABorrar);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ListaPreciosExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #10
0
        private void frmReporte1_Load(object sender, EventArgs e)
        {
            ListaPrecios f = new ListaPrecios();

            crvPrecios.ReportSource = f;
        }