private void button1_Click(object sender, EventArgs e) { Entidades.Productos producto; Entidades.Clientes cliente; Entidades.Cotizaciones cotizacion; producto = new Entidades.Productos { ProductoId = 0, Descripcion = "Cebolla", Precio = 100 }; cliente = new Entidades.Clientes(); cliente.ClienteId = 0; cliente.Nombres = "Enel"; producto = BLL.Productos.Guardar(producto); cliente = BLL.Clientes.Guardar(cliente); cotizacion = new Entidades.Cotizaciones(); cotizacion.ClienteId = cliente.ClienteId; cotizacion.Fecha = DateTime.Now; cotizacion.Monto = 100; cotizacion.AgregarDetalle(producto, 1); cotizacion = BLL.Cotizaciones.Guardar(cotizacion); MessageBox.Show("Cotizaciones creada" + cotizacion.ClienteId.ToString()); }
private void LlenarGrid(Entidades.Cotizaciones producto) { //DetalledataGridView.DataSource = null; DetalledataGridView.DataSource = producto.Detalle.ToList(); this.DetalledataGridView.Columns["Id"].Visible = false; this.DetalledataGridView.Columns["CotizacionId"].Visible = false; this.DetalledataGridView.Columns["Producto"].Visible = false; this.DetalledataGridView.Columns["Cotizaciones"].Visible = false; }
public static bool Eliminar(Entidades.Cotizaciones cotizacion) { bool eliminado = false; using (var repositorio = new Repositorio <Entidades.Cotizaciones>()) { eliminado = repositorio.Eliminar(cotizacion); } return(eliminado); }
public static Entidades.Cotizaciones Guardar(Entidades.Cotizaciones cotizacion) { Entidades.Cotizaciones creado = null; using (var repositorio = new Repositorio <Entidades.Cotizaciones>()) { //todo: validar que el nombre de producto no exista creado = repositorio.Guardar(cotizacion); } return(creado); }
public static Entidades.Cotizaciones Buscar(Expression <Func <Entidades.Cotizaciones, bool> > tipo) { Entidades.Cotizaciones Result = null; using (var repositorio = new Repositorio <Entidades.Cotizaciones>()) { Result = repositorio.Buscar(tipo); if (Result != null) { Result.Detalle.Count();//para oblibar el lazyloading a cargar los datos } } return(Result); }
private void Limpiar() { detalle = new Entidades.CotizacionesDetalle(); //Producto = new Entidades.Cotizaciones(); Cotizacion = new Entidades.Cotizaciones(); CotizacionIdtextBox.Clear(); FechadateTimePicker.Value = DateTime.Today; ClienteIdcomboBox.Text = " "; MontomaskedTextBox.Clear(); ValidarerrorProvider.Clear(); DetalledataGridView.DataSource = null; ProductoIdtextBox.Clear(); PrecioProductotextBox.Clear(); NombreProductotextBox.Clear(); ImportetextBox.Clear(); CantidadnumericUpDown.Value = 0; }
private void searchButton_Click(object sender, EventArgs e) { var cotizacion = new Entidades.Cotizaciones(); int id = Utilidades.TOINT(CotizacionIdtextBox.Text); cotizacion = BLL.Cotizaciones.Buscar(p => p.CotizacionId == id); if (cotizacion != null) { FechadateTimePicker.Value = cotizacion.Fecha; MontomaskedTextBox.Text = cotizacion.Monto.ToString(); ClienteIdcomboBox.Text = cotizacion.ClienteId.ToString(); LlenarGrid(cotizacion); } else { MessageBox.Show("No existe cliente con ese Id."); Limpiar(); } }