public EstadoVenta obtenerEstadoVenta(int codEstBol)
        {
            EstadoVenta estVen = null;

            SqlCommand comando = new SqlCommand("usp_obtener_estado_venta", conexion);

            comando.CommandType = CommandType.StoredProcedure;
            comando.Parameters.AddWithValue("@codEstBol", codEstBol);

            conexion.Open();
            SqlDataReader reader = comando.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    EstadoVenta est = new EstadoVenta();
                    est.codEstBol = int.Parse(reader["codEstBol"].ToString());
                    est.descriBol = reader["descriBol"].ToString();
                    estVen        = est;
                }
            }
            conexion.Close();

            return(estVen);
        }
        public List <EstadoVenta> listarComboEstadoVentas()
        {
            List <EstadoVenta> lstEstVen = null;
            SqlCommand         comando   = new SqlCommand("usp_Listar_Estado_Venta", conexion);

            conexion.Open();

            SqlDataReader reader = comando.ExecuteReader();

            if (reader.HasRows)
            {
                lstEstVen = new List <EstadoVenta>();
                while (reader.Read())
                {
                    EstadoVenta estVen = new EstadoVenta();
                    estVen.codEstBol = int.Parse(reader["codEstBol"].ToString());
                    estVen.descriBol = reader["descriBol"].ToString();

                    lstEstVen.Add(estVen);
                }
            }

            conexion.Close();

            return(lstEstVen);
        }
Beispiel #3
0
        public async Task <ActionResult <EstadoVenta> > PostEstadoVenta(EstadoVenta estadoVenta)
        {
            _context.EstadoVentas.Add(estadoVenta);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetEstadoVenta", new { id = estadoVenta.idEstadoVenta }, estadoVenta));
        }
Beispiel #4
0
        public async Task <IActionResult> PutEstadoVenta(int id, EstadoVenta estadoVenta)
        {
            if (id != estadoVenta.idEstadoVenta)
            {
                return(BadRequest());
            }
            _context.Entry(estadoVenta).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EstadoVentaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(NoContent());
        }
Beispiel #5
0
        public List <EstadoVenta> Listar()
        {
            List <EstadoVenta> lista = new List <EstadoVenta>();
            EstadoVenta        aux;
            SqlCommand         comando  = new SqlCommand();
            SqlConnection      conexion = new SqlConnection();
            SqlDataReader      lector;

            try
            {
                conexion.ConnectionString = @"data source =.\SQLEXPRESS; initial catalog=LEROSE_DB; integrated security=sspi;";
                comando.CommandType       = System.Data.CommandType.Text;
                comando.CommandText       = "SELECT * FROM GetEstados";
                comando.Connection        = conexion;

                conexion.Open();
                lector = comando.ExecuteReader();

                while (lector.Read())
                {
                    aux = new EstadoVenta((int)lector["Id"], (string)lector["Descripcion"]);

                    lista.Add(aux);
                }
                return(lista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conexion.Close();
            }
        }
Beispiel #6
0
 public Venta()
 {
     estado        = EstadoVenta.activa;
     vendedor      = new Vendedor();
     cliente       = new Cliente();
     transportista = new Transportista();
     direccion     = new Direccion();
 }
Beispiel #7
0
 public Venta(Vendedor vendedor, int idVenta, Cliente cliente, Transportista transportista, DateTime fecha_e, EstadoVenta estado, Direccion direccion)
 {
     this.vendedor      = vendedor;
     this.idVenta       = idVenta;
     this.cliente       = cliente;
     this.transportista = transportista;
     this.fecha_e       = fecha_e;
     this.estado        = estado;
     this.direccion     = direccion;
 }