private void Guardarbutton_Click(object sender, EventArgs e) { int id = 0; using (var db = new DAL.Repositorio <Libros>()) { if (id != libro.LibrosId) { db.Mdificar(libro); MessageBox.Show("Modificado"); } else { libro = LlenarCampos(); if (BLL.LibroBLL.Guardar(libro)) { MessageBox.Show("Correcto"); } else { MessageBox.Show("Error"); } } } }
private void searchButton_Click(object sender, EventArgs e) { var cliente = new Entidades.Clientes(); int id = Utilidades.TOINT(IdtextBox.Text); using (var conec = new DAL.Repositorio <Entidades.Clientes>()) { cliente = conec.Buscar(p => p.ClienteId == id); } if (cliente != null) { NombretextBox.Text = cliente.Nombres; DirecciontextBox.Text = cliente.Direccion; EmailtextBox.Text = cliente.Email; TelefonomaskedTextBox.Text = cliente.Telefono; CelularmaskedTextBox.Text = cliente.Celular; LimiteCreditotextBox.Text = cliente.LimiteCredito.ToString(); } else { MessageBox.Show("No existe cliente con ese id."); Limpiar(); } }
public static bool Guardar(Entidades.Facturas Facturag, List <Entidades.FacturaDetalles> listaRelaciones) { using (var repositorio = new DAL.Repositorio <Entidades.Facturas>()) { bool FacuraGuardada; bool relacionesGuardadas = false; if (Buscar(P => P.IdFactura == Facturag.IdFactura) == null) { FacuraGuardada = repositorio.GuardarBool(Facturag); } else { FacuraGuardada = repositorio.Modificar(Facturag); } if (FacuraGuardada) { relacionesGuardadas = true; if (listaRelaciones != null) { foreach (var relacion in listaRelaciones) { relacion.IdFactura = Facturag.IdFactura; if (!BLL.FacturaDetallesBLL.Guardar(relacion)) { relacionesGuardadas = false; } } } } return(relacionesGuardadas); } }
private void BuscarButton_Click(object sender, EventArgs e) { if (Utils.NoWhiteNoSpace(empleadoIdTextBox.Text)) { Empleado empleado; int id = int.Parse(empleadoIdTextBox.Text); using (var context = new DAL.Repositorio <Empleado>()) { empleado = context.Buscar(x => x.EmpleadoId == id); } if (empleado != null) { nombreTextBox.Text = empleado.Nombres; fechaDeNacimentoDateTimePicker.Value = empleado.FechaNacimientos; sueldoTextBox.Text = empleado.Sueldos.ToString(); IderrorProvider.Clear(); } else { MessageBox.Show("Este id de empleado no existe!"); } } else { IderrorProvider.SetError(empleadoIdTextBox, "Id vacio!"); } }
private void Guardarbutton_Click(object sender, EventArgs e) { Autores autor = new Autores(); int id = 0; using (var db = new DAL.Repositorio <Entidades.Autores>()) { if (!Validar()) { MessageBox.Show("Favor llenar"); } else { autor.AutoresId = Utilidades.TOINT(autoresIdTextBox.Text); autor.Nombre = nombreTextBox.Text; if (id != autor.AutoresId) { db.Mdificar(autor); MessageBox.Show("Se ha Modificado"); } else { if (BLL.AutoreBLL.Guardar(autor)) { MessageBox.Show("Correcto"); } else { MessageBox.Show("Error"); } } } } }
private void SaveButton_Click(object sender, EventArgs e) { var usuarios = new Entidades.Usuarios(); int id = 0; using (var conec = new DAL.Repositorio <Entidades.Usuarios>()) { if (!Validar()) { MessageBox.Show("Por favor llenar los campos vacios"); Limpiar(); } else { usuarios.UsuarioId = Utilidades.TOINT(IdtextBox.Text); usuarios.Nombre = NombretextBox.Text; usuarios.Clave = ClavetextBox.Text; if (id != usuarios.UsuarioId) { conec.Modificar(usuarios); MessageBox.Show("Usuario modificado."); } else { conec.Guardar(usuarios); MessageBox.Show("Usuario Guardado."); } } } }
private void searchButton_Click(object sender, EventArgs e) { int UsuarioId = int.Parse(ProductoIdTextBox.Text); Entidades.Productos producto; using (var buscar = new DAL.Repositorio <Entidades.Productos>()) { producto = buscar.Buscar(p => p.ProductoId == UsuarioId); if (producto != null) { ProductoIdTextBox.Text = Convert.ToString(producto.ProductoId); DescripcionTextBox.Text = producto.Descripcion; maskedTextBoxMedida.Text = producto.Medida; checkBoxesITBS.Checked = producto.Itbis; maskedTextBoxPrecio.Text = Convert.ToString(producto.Precio); maskedTextBoxCosto.Text = Convert.ToString(producto.Costo); MessageBox.Show("Busqueda correcta !!!"); } else { MessageBox.Show("No existe Este producto...."); } } }
private void button3_Click(object sender, EventArgs e) { int id = 0; using (var db = new DAL.Repositorio <Clientes>()) { cliente = LLenarCampos(); if (id != cliente.ClienteId) { db.Modificar(cliente); MessageBox.Show("Correcto"); } else { if (BLL.ClienteBLL.Guardar(cliente)) { MessageBox.Show("Correcto"); } else { MessageBox.Show("Error"); } } } }
public static List <Entidades.Clientes> GetList(Expression <Func <Entidades.Clientes, bool> > criterioBusqueda) { using (var repositorio = new DAL.Repositorio <Entidades.Clientes>()) { return(repositorio.GetList(criterioBusqueda)); } }
private void buttonGuardar_Click(object sender, EventArgs e) { int id = 0; Produtos producto = new Produtos(); using (var db = new DAL.Repositorio <Produtos>()) { if (!Validar()) { MessageBox.Show("Favor llenar"); } else { producto.ProductoId = Utilidades.TOINT(productoIdTextBox.Text); producto.Nombre = nombreTextBox.Text; if (id != producto.ProductoId) { db.Modificar(producto); MessageBox.Show("Modificado"); } else { if (BLL.ProductoBLL.Guardar(producto)) { MessageBox.Show("Correcto"); } else { MessageBox.Show("error"); } } } Limpiar(); } }
public static bool Guardar(Clientes nuevo) { bool result = false; using (var db = new DAL.Repositorio <Clientes>()) { result = db.Guardar(nuevo) != null; } return(result); }
public static List <Entidades.Usuarios> GetListodo() { using (var db = new DAL.Repositorio <Entidades.Usuarios>()) { try { return(db.ListaTodo()); } catch (Exception) { throw; } } }
private void SaveButton_Click(object sender, EventArgs e) { var Guardar = new Entidades.Productos(); using (var Context = new DAL.Repositorio <Entidades.Productos>()) { int id = 0; if (!ValidarTextBox()) { MessageBox.Show("Favor llenar los campos...."); } else { // guardar.TipoId = (Utilidades.TOINT(IDTipoTextBox.Text)); Guardar.ProductoId = Utilidades.TOINT(ProductoIdTextBox.Text); Guardar.Descripcion = DescripcionTextBox.Text; Guardar.Medida = maskedTextBoxMedida.Text; Guardar.Precio = Convert.ToDecimal(maskedTextBoxPrecio.Text); Guardar.Costo = Convert.ToDecimal(maskedTextBoxCosto.Text); //Asigna true o false al checkBox segun selecione el usuario if (checkBoxesITBS.Checked == false) { Guardar.Itbis = false; } else { Guardar.Itbis = true; } //////////////////////////////////////////// if (id != Guardar.ProductoId) { Context.Modificar(Guardar); MessageBox.Show("Se A Modificado correctamente !!!"); } else { BLL.Productos.Guardar(Guardar); MessageBox.Show("Se A Guardado correctamente !!!"); } } } }
private void Eliminarbutton_Click(object sender, EventArgs e) { int id = Utilidades.TOINT(librosIdTextBox.Text); using (var db = new DAL.Repositorio <Libros>()) { if (db.Eliminar(db.Buscar(p => p.LibrosId == id))) { MessageBox.Show("Correcto"); } else { MessageBox.Show("error"); } } }
private void buttonEliminar_Click(object sender, EventArgs e) { int id = Convert.ToInt32(productoIdTextBox.Text); using (var db = new DAL.Repositorio <Produtos>()) { if (db.Eliminar(db.Buscar(p => p.ProductoId == id))) { MessageBox.Show("Correcto"); } else { MessageBox.Show("Error"); } } }
public static List <Produtos> GetListTodo() { List <Produtos> list = null; using (var db = new DAL.Repositorio <Produtos>()) { try { list = db.GetListTodo(); } catch (Exception) { throw; } return(list); } }
public static List <Entidades.Produtos> GetList(Expression <Func <Produtos, bool> > criterio) { List <Produtos> list = null; using (var db = new DAL.Repositorio <Produtos>()) { try { list = db.GetList(criterio).ToList(); } catch (Exception) { throw; } return(list); } }
private void Deletebutton_Click(object sender, EventArgs e) { int UsuarioId = Convert.ToInt32(ProductoIdTextBox.Text); using (var eliminar = new DAL.Repositorio <Entidades.Productos>()) { if (eliminar.Eliminar(eliminar.Buscar(p => p.ProductoId == UsuarioId))) { MessageBox.Show("El Producto Fue eliminado..."); Limpiar(); } else { MessageBox.Show("No se pudo eliminar el producto..."); } } }
public static bool Guardar(Produtos nuevo) { bool result = false; using (var db = new DAL.Repositorio <Produtos>()) { try { result = db.Guardar(nuevo) != null; } catch (Exception) { throw; } } return(result); }
private void BuscarButton_Click_1(object sender, EventArgs e) { using (var context = new DAL.Repositorio <Empleado>()) { if (FiltrarCheckBox.Checked == false) { DataGridView.DataSource = context.GetListAll(); } else { if (FechaCheckBox.Checked == true && NombreCheckBox.Checked == true) { if (Utils.NoWhiteNoSpace(SearchTextBox.Text)) { DataGridView.DataSource = context.GetList(x => x.FechaNacimientos >= DesdeDateTimePicker.Value.Date && x.FechaNacimientos <= HastaDateTimePicker.Value.Date && x.Nombres == SearchTextBox.Text); ErrorProvider.Clear(); } else { ErrorProvider.SetError(SearchTextBox, "No puede estar vacio!"); } } else { if (FechaCheckBox.Checked == true) { DataGridView.DataSource = context.GetList(x => x.FechaNacimientos >= DesdeDateTimePicker.Value.Date && x.FechaNacimientos <= HastaDateTimePicker.Value.Date); } else if (NombreCheckBox.Checked == true) { if (Utils.NoWhiteNoSpace(SearchTextBox.Text)) { DataGridView.DataSource = context.GetList(x => x.Nombres == SearchTextBox.Text); ErrorProvider.Clear(); } else { ErrorProvider.SetError(SearchTextBox, "No puede estar vacio!"); } } } } } }
private void buttonBuscar_Click(object sender, EventArgs e) { int id = Convert.ToInt32(productoIdTextBox.Text); using (var db = new DAL.Repositorio <Produtos>()) { product = db.Buscar(p => p.ProductoId == id); if (product != null) { nombreTextBox.Text = product.Nombre; MessageBox.Show("Correcto"); } else { MessageBox.Show("No existe"); } } }
private void button1_Click(object sender, EventArgs e) { int id = Utilidades.TOINT(autoresIdTextBox.Text); Autores autor = new Autores(); using (var db = new DAL.Repositorio <Entidades.Autores>()) { autor = db.Buscar(p => p.AutoresId == id); if (autor != null) { nombreTextBox.Text = autor.Nombre; MessageBox.Show("Correcto"); } else { MessageBox.Show("No existe"); } } }
private void button1_Click(object sender, EventArgs e) { int id = Utilidades.TOINT(clienteIdTextBox.Text); using (var db = new DAL.Repositorio <Clientes>()) { cliente = db.Buscar(p => p.ClienteId == id); if (cliente != null) { nombreTextBox.Text = cliente.Nombre; direccionTextBox.Text = cliente.Direccion; productoComboBox.Text = cliente.Producto; MessageBox.Show("Correcto"); } else { MessageBox.Show("Error"); } } }
private void button1_Click(object sender, EventArgs e) { int id = Utilidades.TOINT(librosIdTextBox.Text); using (var db = new DAL.Repositorio <Libros>()) { libro = db.Buscar(p => p.LibrosId == id); if (libro != null) { nombreTextBox.Text = libro.Nombre; edicionTextBox.Text = Convert.ToString(libro.Edicion); autoresComboBox.SelectedValue = libro.Autores; //LLenarDataGrid(libro); MessageBox.Show("Correcto"); } else { MessageBox.Show("No existe"); } } }
private void searchButton_Click(object sender, EventArgs e) { var usuario = new Entidades.Usuarios(); int id = Utilidades.TOINT(IdtextBox.Text); using (var conec = new DAL.Repositorio <Entidades.Usuarios>()) { usuario = conec.Buscar(p => p.UsuarioId == id); } if (usuario != null) { NombretextBox.Text = usuario.Nombre; ClavetextBox.Text = usuario.Clave; ConfirmartextBox.Text = usuario.Clave; } else { MessageBox.Show("No existe el usuario con ese id."); Limpiar(); } }
private void EliminarButton_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(empleadoIdTextBox.Text)) { int id = int.Parse(empleadoIdTextBox.Text); using (var context = new DAL.Repositorio <Empleado>()) { if (context.Eliminar(context.Buscar(x => x.EmpleadoId == id))) { Limpiar(); MessageBox.Show("Este empleado eliminado!"); } else { MessageBox.Show("No se puedo eliminar!"); } } } else { IderrorProvider.SetError(empleadoIdTextBox, "Id vacio!"); } }
private void GuardarButton_Click(object sender, EventArgs e) { if (Utils.NoWhiteNoSpace(nombreTextBox.Text) && Utils.NoWhiteNoSpace(sueldoTextBox.Text)) { int id = 0; Empleado empleado; using (var context = new DAL.Repositorio <Empleado>()) { empleado = context.Guardar(new Empleado(Utils.NoWhiteNoSpace(empleadoIdTextBox.Text) == false ? 0 : int.Parse(empleadoIdTextBox.Text), nombreTextBox.Text, fechaDeNacimentoDateTimePicker.Value.Date, int.Parse(sueldoTextBox.Text))); id = empleado.EmpleadoId; } if (id != 0) { empleadoIdTextBox.Text = id.ToString(); MessageBox.Show("Empleado guardado!"); Limpiar(); } else { MessageBox.Show("Empleado no se puedo guardar!"); } } }
private void SaveButton_Click(object sender, EventArgs e) { var cliente = new Entidades.Clientes(); int id = 0; using (var conec = new DAL.Repositorio <Entidades.Clientes>()) { if (!Validar()) { MessageBox.Show("Por favor llenar los campos vacios"); Limpiar(); } else { cliente.ClienteId = Utilidades.TOINT(IdtextBox.Text); cliente.Nombres = NombretextBox.Text; cliente.Direccion = DirecciontextBox.Text; cliente.Email = EmailtextBox.Text; cliente.Telefono = TelefonomaskedTextBox.Text; cliente.Celular = CelularmaskedTextBox.Text; cliente.LimiteCredito = Utilidades.TOINT(LimiteCreditotextBox.Text); if (id != cliente.ClienteId) { conec.Modificar(cliente); MessageBox.Show("El cliente se a modificado."); } else { conec.Guardar(cliente); MessageBox.Show("El cliente se a guardado."); } } } Limpiar(); }
private void Deletebutton_Click(object sender, EventArgs e) { if (!Validar()) { MessageBox.Show("Los campos estan vacios"); } else { int id = Utilidades.TOINT(IdtextBox.Text); using (var conec = new DAL.Repositorio <Entidades.Clientes>()) { if (conec.Eliminar(conec.Buscar(p => p.ClienteId == id))) { Limpiar(); MessageBox.Show("Cliente eliminado con exito."); } else { MessageBox.Show("No se pudo eliminar el cliente."); } } } }
public static bool EliminarRelacion(Entidades.Facturas facturaG) { using (var repositorio = new DAL.Repositorio <Entidades.Facturas>()) { bool relacionesEliminadas = true; List <Entidades.FacturaDetalles> listaRelaciones = BLL.FacturaDetallesBLL.GetList(R => R.IdFactura == facturaG.IdFactura); foreach (var relacion in listaRelaciones) { if (!FacturaDetallesBLL.Eliminar(relacion)) { relacionesEliminadas = false; } } if (relacionesEliminadas) { return(repositorio.Eliminar(facturaG)); } return(false); } }