public static bool Modificar(int id, Clientes cli) { bool retorno = false; try { using (var db = new SistemaVentasDb()) { Clientes c = db.Clientes.Find(id); c.Nombre = cli.Nombre; c.Celular = cli.Celular; c.Ciudad = cli.Ciudad; c.Direccion = cli.Direccion; c.Cedula = cli.Cedula; c.Sexo = cli.Sexo; c.Telefono = cli.Telefono; db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }
public static bool Modificar(int id, Empleados emp) { bool retorno = false; try { using (var db = new SistemaVentasDb()) { Empleados e = db.Empleados.Find(id); e.Nombre = emp.Nombre; e.Celular = emp.Celular; e.Ciudad = emp.Ciudad; e.Direccion = emp.Direccion; e.Cedula = emp.Cedula; e.Sexo = emp.Sexo; e.Telefono = emp.Telefono; e.FechaNacimiento = emp.FechaNacimiento; db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }
public static bool Modificar(int id, Proveedores prov) { bool retorno = false; try { using (var db = new SistemaVentasDb()) { Proveedores p = db.Proveedores.Find(id); p.NombreProveedor = prov.NombreProveedor; p.Telefono = prov.Telefono; p.Ciudad = prov.Ciudad; p.Correo = prov.Correo; p.Direccion = prov.Direccion; p.Fax = prov.Fax; db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }
public static bool Insertar(Articulos articulo) { bool obtener = false; using (var db = new SistemaVentasDb()) { try { if (Buscar(articulo.ArticuloId) == null) { db.Articulos.Add(articulo); } else { db.Entry(articulo).State = EntityState.Modified; } db.SaveChanges(); obtener = true; } catch (Exception e) { MessageBox.Show(e.ToString()); //throw; } return(obtener); } }
public static bool Guardar(FacturasProductos relacion) { bool resultado = false; using (var conexion = new SistemaVentasDb()) { try { conexion.FacturasProductos.Add(relacion); conexion.SaveChanges(); resultado = true; } catch (Exception) { throw; } } return(resultado); }
public static bool Insertar(Usuarios u) { bool retorna = false; try { using (var db = new SistemaVentasDb()) { db.Usuarios.Add(u); db.SaveChanges(); //db.Dispose(); retorna = true; } } catch (Exception) { throw; } return(retorna); }
public static bool Modificar(int id, CondicionPagos cps) { bool retorno = false; try { using (var db = new SistemaVentasDb()) { CondicionPagos cp = db.CodicionPagos.Find(id); cp.Descripcion = cps.Descripcion; db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }
public static void Eliminar(Articulos articulo) { using (var db = new SistemaVentasDb()) { try { if (articulo != null) { db.Entry(articulo).State = EntityState.Deleted; db.SaveChanges(); } } catch (Exception e) { MessageBox.Show(e.ToString()); throw; } } }
public static bool Insertar(Ventas factura) { bool resultado = false; using (var conexion = new SistemaVentasDb()) { try { conexion.Ventas.Add(factura); conexion.SaveChanges(); resultado = true; } catch (Exception e) { MessageBox.Show(e.ToString()); throw; } return(resultado); } }
public static bool Modificar(int id, Categorias cat) { bool retorno = false; try { using (var db = new SistemaVentasDb()) { Categorias c = db.Categorias.Find(id); c.Descripcion = cat.Descripcion; db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }
public static void Eliminar(Ventas factura) { using (var conexion = new SistemaVentasDb()) { try { if (factura != null) { conexion.Entry(factura).State = EntityState.Deleted; conexion.SaveChanges(); } } catch (Exception e) { MessageBox.Show(e.ToString()); throw; } } }
public static bool Modificard(int id, TipoUsuarios tip) { bool retorno = false; try { using (var db = new SistemaVentasDb()) { TipoUsuarios t = db.TipoUsuarios.Find(id); t.Detalle = tip.Detalle; db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }
public static bool Eliminar(int id) { try { using (var db = new SistemaVentasDb()) { CondicionPagos cps = new CondicionPagos(); cps = db.CodicionPagos.Find(id); db.CodicionPagos.Remove(cps); db.SaveChanges(); db.Dispose(); return(false); } } catch (Exception) { return(true); throw; } }
public static bool Insertar(Clientes c) { bool retorna = false; try { using (var db = new SistemaVentasDb()) { db.Clientes.Add(c); db.SaveChanges(); //db.Dispose(); retorna = true; } } catch (Exception) { return(false); throw; } return(retorna); }
public static bool Modificar(int id, Usuarios us) { bool retorno = false; try { using (var db = new SistemaVentasDb()) { Usuarios usa = db.Usuarios.Find(id); usa.NombreUsuario = us.NombreUsuario; usa.Contrasena = us.Contrasena; usa.Tipo = us.Tipo; db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }
public static bool Eliminar(int id) { try { using (var db = new SistemaVentasDb()) { TipoUsuarios t = new TipoUsuarios(); t = db.TipoUsuarios.Find(id); db.TipoUsuarios.Remove(t); db.SaveChanges(); db.Dispose(); return(false); } } catch (Exception) { return(true); throw; } }
public static bool Insertar(Empleados e) { //bool retorna = false; try { using (var db = new SistemaVentasDb()) { db.Empleados.Add(e); db.SaveChanges(); db.Dispose(); //retorna = true; return(true); } } catch (Exception) { return(false); throw; } // return retorna; }
public static bool Eliminar(int id) { //bool retorna = false; try { using (var db = new SistemaVentasDb()) { Usuarios us = new Usuarios(); us = db.Usuarios.Find(id); db.Usuarios.Remove(us); db.SaveChanges(); db.Dispose(); return(false); } } catch (Exception) { return(true); throw; } }
public static bool Insertar(Proveedores p) { /// bool retorna = false; try { using (var db = new SistemaVentasDb()) { db.Proveedores.Add(p); db.SaveChanges(); //db.Dispose(); // retorna = true; return(true); } } catch (Exception e) { return(false); throw e; } /// return retorna; }
public static bool Eliminar(int id) { //bool retorna = false; try { using (var db = new SistemaVentasDb()) { Proveedores p = new Proveedores(); p = db.Proveedores.Find(id); db.Proveedores.Remove(p); db.SaveChanges(); //db.Dispose(); return(false); } } catch (Exception) { return(true); throw; } }
public static bool Eliminar(int id) { //bool retorna = false; try { using (var db = new SistemaVentasDb()) { Categorias c = new Categorias(); c = db.Categorias.Find(id); db.Categorias.Remove(c); db.SaveChanges(); //db.Dispose(); return(false); } } catch (Exception) { return(true); throw; } }
public static bool Eliminar(int id) { //bool retorna = false; try { using (var db = new SistemaVentasDb()) { Empleados e = new Empleados(); e = db.Empleados.Find(id); db.Empleados.Remove(e); db.SaveChanges(); //db.Dispose(); return(false); } } catch (Exception) { return(true); throw; } }
public static bool Modificar(int id, Articulos art) { bool retorno = false; try { using (var db = new SistemaVentasDb()) { Articulos a = db.Articulos.Find(id); a.Nombre = art.Nombre; a.Marca = art.Marca; a.Precio = art.Precio; a.Cantidad = art.Cantidad; db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }