private void EliminarButton_Click(object sender, RoutedEventArgs e) { Proveedores existe = ProveedoresBLL.Buscar(proveedor.ProveedorId); if (proveedor == null) { MessageBox.Show("Primero seleccione un un proveedor", "Error", MessageBoxButton.OK); return; } else { MessageBoxResult opcion = MessageBox.Show("Estas seguro de que desear eliminar a " + proveedor.Nombres + "?", "Proveedores", MessageBoxButton.YesNo); if (opcion.Equals(MessageBoxResult.Yes)) { if (ProveedoresBLL.Delete(proveedor.ProveedorId)) { Limpiar(); ProveedoresBLL.Eliminar(proveedor.ProveedorId); MessageBox.Show("Ha sido eliminado exitosamente", "Exito", MessageBoxButton.OK, MessageBoxImage.Information); } } } }
public ActionResult Edit(int id) { ProveedoresBLL oBLL = new ProveedoresBLL(); proveedor proveedor = oBLL.Retrieve(id); return(View(proveedor)); }
public ActionResult Details(int id) { ProveedoresBLL oBLL = new ProveedoresBLL(); proveedor cate = oBLL.Retrieve(id); return(View(cate)); }
private void guardarButton_Click(object sender, RoutedEventArgs e) { bool paso = false; if (!ValidarCampos()) { return; } if (IdTextBox.Text == "0") { paso = ProveedoresBLL.Guardar(proveedores); } else { if (!ExisteEnLaBaseDatos()) { MessageBox.Show("No se puede modificar, no existe!!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } paso = ProveedoresBLL.Modificar(proveedores); } if (paso) { MessageBox.Show("Guardado", "Exito", MessageBoxButton.OK, MessageBoxImage.Information); LimpiarCampos(); } else { MessageBox.Show("No se Guardo", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
// GET: Proveedores public ActionResult Index() { ProveedoresBLL oBLL = new ProveedoresBLL(); List <proveedor> proveedors = oBLL.RetrieveAll(); return(View(proveedors)); }
public ActionResult Delete(int id) { ProveedoresBLL oBLL = new ProveedoresBLL(); oBLL.Delete(id); return(RedirectToAction("Index")); }
public ActionResult Editar(Proveedores proveedores) { if (ModelState.IsValid) { ProveedoresBLL.Insertar(proveedores); return(RedirectToAction("Consulta")); } return(View(proveedores)); }
private void eliminarButton_Click(object sender, RoutedEventArgs e) { if (ProveedoresBLL.Eliminar(proveedores.ProveedorId)) { LimpiarCampos(); MessageBox.Show("Eliminado", "Exito", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { MessageBox.Show("No Eliminado", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void IniciarCombobox() { compra.Fecha = DateTime.Now; Limpiar(); ProductosComboBox.ItemsSource = ProductosBLL.GetList(); ProductosComboBox.SelectedValuePath = "ProductoId"; ProductosComboBox.DisplayMemberPath = "Descripcion"; ProveedoresComboBox.ItemsSource = ProveedoresBLL.GetList(c => true); ProveedoresComboBox.SelectedValuePath = "ProveedorId"; ProveedoresComboBox.DisplayMemberPath = "Nombres"; }
private void buscarButton_Click(object sender, RoutedEventArgs e) { Proveedores proveedorlocal = ProveedoresBLL.Buscar(proveedores.ProveedorId); if (proveedorlocal != null) { proveedores = proveedorlocal; Llenar(); } else { LimpiarCampos(); MessageBox.Show("No Encontrado", "Salir", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
private void BuscarButton_Click(object sender, RoutedEventArgs e) { Proveedores encontrado = ProveedoresBLL.Buscar(proveedor.ProveedorId); if (encontrado != null) { proveedor = encontrado; this.DataContext = proveedor; } else { Limpiar(); MessageBox.Show("No existe en la base de datos", "Mensaje", MessageBoxButton.OK, MessageBoxImage.Information); } }
private Proveedores GetSelectedProveedor() { object Proveedores = DatosDataGrid.SelectedItem; if (Proveedores != null) { return(ProveedoresBLL.Search( Convert.ToInt32( Proveedores.GetType(). GetProperty("ProveedorId"). GetValue(Proveedores). ToString()))); } else { return(null); } }
public ActionResult Edit(proveedor proveedor) { ActionResult Result; try { if (ModelState.IsValid) { ProveedoresBLL oBLL = new ProveedoresBLL(); oBLL.Update(proveedor); Result = RedirectToAction("Index"); } else { Result = View(proveedor); } return(Result); } catch (Exception e) { return(View(proveedor)); } }
private void Buscar() { var listado = new List <Object>(); string criterio = CriterioTextBox.Text.Trim(); if (CriterioTextBox.Text.Trim().Length > 0) { switch (FiltroCombobox.SelectedIndex) { case 0: listado = ProveedoresBLL.GetList("", ""); break; case 1: listado = ProveedoresBLL.GetList("ProveedorId", criterio); break; case 2: listado = ProveedoresBLL.GetList("Nombres", criterio); break; case 3: listado = ProveedoresBLL.GetList("RNC", criterio); break; case 4: listado = ProveedoresBLL.GetList("Telefono", criterio); break; case 5: listado = ProveedoresBLL.GetList("Usuario", criterio); break; } } else { listado = ProveedoresBLL.GetList("", ""); } DatosDataGrid.ItemsSource = null; DatosDataGrid.ItemsSource = listado; }
private void consultarButton_Click(object sender, RoutedEventArgs e) { var listado = new List <Proveedores>(); if (criterioTextBox.Text.Trim().Length > 0) { switch (filtroComboBox.SelectedIndex) { case 0: listado = ProveedoresBLL.GetList(p => true); break; case 1: int ID = Convert.ToInt32(criterioTextBox.Text); listado = ProveedoresBLL.GetList(p => p.ProveedorId == ID); break; case 2: int rnc = Convert.ToInt32(criterioTextBox.Text); listado = ProveedoresBLL.GetList(p => p.RNC == Convert.ToString(rnc)); break; case 3: listado = ProveedoresBLL.GetList(p => p.Nombre.Contains(criterioTextBox.Text)); break; case 4: listado = ProveedoresBLL.GetList(p => p.Telefono.Contains(criterioTextBox.Text)); break; } listado = listado.Where(c => c.Fecha.Date >= desdeDatePicker.SelectedDate.Value && c.Fecha.Date <= hastaDatePicker.SelectedDate.Value).ToList(); } else { listado = ProveedoresBLL.GetList(p => true); } consultarDataGrid.ItemsSource = listado; }
private void GuardarButton_Click(object sender, RoutedEventArgs e) { if (!Validar()) { return; } proveedor.UsuarioId = user; proveedor.RNC = RNCMaskEdit.Value.ToString(); proveedor.Telefono = TelefonoMaskEdit.Value.ToString(); var paso = ProveedoresBLL.Save(proveedor); if (paso) { Limpiar(); MessageBox.Show("Guardado con Exito", "Exito", MessageBoxButton.OK); } else { MessageBox.Show("Ha ocurrido un error", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void EliminarBoton_Click(object sender, RoutedEventArgs e) { Proveedores Proveedor = GetSelectedProveedor(); if (Proveedor == null) { MessageBox.Show("Primero seleccione una Proveedor", "Error", MessageBoxButton.OK); return; } MessageBoxResult opcion = MessageBox.Show("Estas seguro de que desear eliminar a la proveedor " + Proveedor.Nombres + "?", "Proveedor", MessageBoxButton.YesNo); if (opcion.Equals(MessageBoxResult.Yes)) { if (ProveedoresBLL.Delete(Proveedor.ProveedorId)) { Inicializar(); MessageBox.Show("Proveedor eliminada", "Exito"); } } Inicializar(); }
public void LlenaComboboxProveedor() { var lista = ProveedoresBLL.GetLista(); if (lista.Count <= 0) { var proveedor1 = new Proveedores("Productos German"); var proveedor2 = new Proveedores("Prod.Dolis"); var proveedor3 = new Proveedores("Suavecito"); var proveedor4 = new Proveedores("Dulce Tonis"); var proveedor5 = new Proveedores("Dulce Chichi"); var proveedor6 = new Proveedores("Dulce Pedro"); ProveedoresBLL.Insertar(proveedor1); ProveedoresBLL.Insertar(proveedor2); ProveedoresBLL.Insertar(proveedor3); ProveedoresBLL.Insertar(proveedor4); ProveedoresBLL.Insertar(proveedor5); ProveedoresBLL.Insertar(proveedor6); } ProveedorProductoscomboBox.DataSource = lista; ProveedorProductoscomboBox.ValueMember = "Nombre"; ProveedorProductoscomboBox.DisplayMember = " ProveedorId"; }
public ActionResult DeleteConfirmed(int id) { ProveedoresBLL.Eliminar(id); return(RedirectToAction("Consulta")); }
private bool ExisteEnLaBaseDatos() { Proveedores proveedores = ProveedoresBLL.Buscar((int)Convert.ToInt32(IdTextBox.Text)); return(proveedores != null); }
// GET: Proveedores public ActionResult Consulta() { return(View(ProveedoresBLL.GetLista())); }
private void LlenaComboProveedor() { proveedorComboBox.ItemsSource = ProveedoresBLL.GetList(a => true); proveedorComboBox.DisplayMemberPath = "Nombre"; proveedorComboBox.SelectedValuePath = "ProveedorId"; }
private void ListaProveedores() { List <Proveedores> listaproveedor = ProveedoresBLL.GetList(a => true); this.proveedorComboBox.ItemsSource = listaproveedor; }