public bool AgregarCliente(T_Cliente tCliente) { try { using (var contexto = new DBTallerEntities2()) { var existCliente = contexto.T_Cliente.FirstOrDefault(f => f.CI_Identificacion == tCliente.CI_Identificacion); if (existCliente != null) { return(false); } var clientes = new T_Cliente { CI_Nombre1 = tCliente.CI_Nombre1, CI_Nombre2 = tCliente.CI_Nombre2, CI_Apellido1 = tCliente.CI_Apellido1, CI_Apellido2 = tCliente.CI_Apellido2, CI_Identificacion = tCliente.CI_Identificacion, CI_Telefono = tCliente.CI_Telefono, CI_Direccion = tCliente.CI_Direccion }; contexto.T_Cliente.Add(clientes); contexto.SaveChanges(); return(true); } } catch (Exception ex) { return(false); } }
public object getProducto() { try { using (var contexto = new DBTallerEntities2()) { var ListaProducto = contexto.T_Producto.Select(s => new { Pr_Id = s.Pr_Id, P_Id = s.P_Id, Pr_CodigoRefaccion = s.Pr_CodigoRefaccion, Pr_Descripcion = s.Pr_Descripcion, Pr_Existencia = s.Pr_Existencia, Pr_Marca = s.Pr_Marca, Pr_Nombre = s.Pr_Nombre, Pr_PrecioUnitario = s.Pr_PrecioUnitario, Pr_Descuento = s.Pr_Descuento, Pr_ExistenciaMin = s.Pr_ExistenciaMin }).ToList(); return(ListaProducto); } } catch (Exception ex) { return(null); } }
public bool EditarCliente(T_Cliente tCliente) { try { using (var contexto = new DBTallerEntities2()) { var clientes = contexto.T_Cliente.Find(tCliente.CI_ID); if (clientes == null) { return(false); } clientes.CI_Nombre1 = tCliente.CI_Nombre1; clientes.CI_Nombre2 = tCliente.CI_Nombre2; clientes.CI_Apellido1 = tCliente.CI_Apellido1; clientes.CI_Apellido2 = tCliente.CI_Apellido2; clientes.CI_Identificacion = tCliente.CI_Identificacion; clientes.CI_Telefono = tCliente.CI_Telefono; clientes.CI_Direccion = tCliente.CI_Direccion; contexto.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public bool EditarProducto(int?id, int ide, int codigorefaccion, string descripcion, int existencia, string marca, string nombre, double preciounitario, double descuento, int existenciaminima) { try { using (var contexto = new DBTallerEntities2()) { var Producto = contexto.T_Producto.Find(id); if (Producto == null) { return(false); } Producto.P_Id = ide; Producto.Pr_CodigoRefaccion = codigorefaccion; Producto.Pr_Descripcion = descripcion; Producto.Pr_Existencia = existencia; Producto.Pr_Marca = marca; Producto.Pr_Nombre = nombre; Producto.Pr_PrecioUnitario = (decimal)preciounitario; Producto.Pr_Descuento = (decimal)descuento; Producto.Pr_ExistenciaMin = existenciaminima; contexto.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public bool AgregarProducto(int ide, int codigorefaccion, string descripcion, int existencia, string marca, string nombre, double preciounitario, double descuento, int existenciaminima) { try { using (var contexto = new DBTallerEntities2()) { var Producto = new T_Producto { P_Id = ide, Pr_CodigoRefaccion = codigorefaccion, Pr_Descripcion = descripcion, Pr_Existencia = existencia, Pr_Marca = marca, Pr_Nombre = nombre, Pr_PrecioUnitario = (decimal)preciounitario, Pr_Descuento = (decimal)descuento, Pr_ExistenciaMin = existenciaminima }; contexto.T_Producto.Add(Producto); contexto.SaveChanges(); return(true); } } catch (Exception ex) { return(false); } }
public bool AgregarEmpleado(string direccion, int edad, string nombre1, string nombre2, string apellido1, string apellido2, double salario, string tiposalario, string tipo, string telefono, string identidad, string usuario, string password) { try { using (var contexto = new DBTallerEntities2()) { var Empleado = new T_Empleado { E_Direccion = direccion, E_edad = edad, E_Nombre1 = nombre1, E_Nombre2 = nombre2, E_Apellido1 = apellido1, E_Apellido2 = apellido2, E_Salario = (decimal)salario, E_TipoSalario = tiposalario, E_Tipo = tipo, E_Telefono = telefono, E_Identificacion = identidad, E_Usuario = usuario, E_Password = password }; contexto.T_Empleado.Add(Empleado); contexto.SaveChanges(); return(true); } } catch (Exception ex) { return(false); } }
public bool EditarVehiculo(int?id, int idcliente, string color, string estado, string marca, string modelo, string placa) { try { using (var contexto = new DBTallerEntities2()) { var Vehiculo = contexto.T_Vehiculo.Find(id); if (Vehiculo == null) { return(false); } Vehiculo.CI_ID = idcliente; Vehiculo.V_Color = color; Vehiculo.V_Estado = estado; Vehiculo.V_Marca = marca; Vehiculo.V_Modelo = modelo; Vehiculo.V_Placa = placa; contexto.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public object getEmpleado() { try { using (var contexto = new DBTallerEntities2()) { var ListaEmpleados = contexto.T_Empleado.Select(s => new { E_ID = s.E_ID, E_Nombre1 = s.E_Nombre1, E_Nombre2 = s.E_Nombre2, E_Apellido1 = s.E_Apellido1, E_Apellido2 = s.E_Apellido2, E_Identificacion = s.E_Identificacion, E_Telefono = s.E_Telefono, E_Direccion = s.E_Direccion, E_edad = s.E_edad, E_Salario = s.E_Salario, E_TipoSalario = s.E_TipoSalario, E_Tipo = s.E_Tipo, E_Usuario = s.E_Usuario, E_Password = s.E_Password }).ToList(); return(ListaEmpleados); } } catch (Exception ex) { return(null); } }
public bool EditarEmpleado(int?id, string direccion, int edad, string nombre1, string nombre2, string apellido1, string apellido2, double salario, string tiposalario, string tipo, string telefono, string identidad, string usuario, string password) { try { using (var contexto = new DBTallerEntities2()) { var Empleados = contexto.T_Empleado.Find(id); if (Empleados == null) { return(false); } Empleados.E_Direccion = direccion; Empleados.E_edad = edad; Empleados.E_Nombre1 = nombre1; Empleados.E_Nombre2 = nombre2; Empleados.E_Apellido1 = apellido1; Empleados.E_Apellido2 = apellido2; Empleados.E_Salario = (decimal)salario; Empleados.E_TipoSalario = tiposalario; Empleados.E_Tipo = tipo; Empleados.E_Telefono = telefono; Empleados.E_Identificacion = identidad; Empleados.E_Usuario = usuario; Empleados.E_Password = password; contexto.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public bool AgregarVehiculo(int idcliente, string color, string estado, string marca, string modelo, string placa) { try { using (var contexto = new DBTallerEntities2()) { var Vehiculo = new T_Vehiculo { CI_ID = idcliente, V_Color = color, V_Estado = estado, V_Marca = marca, V_Modelo = modelo, V_Placa = placa }; contexto.T_Vehiculo.Add(Vehiculo); contexto.SaveChanges(); return(true); } } catch (Exception ex) { return(false); } }
public object getClientes() { try { using (var contexto = new DBTallerEntities2()) { var ListaClientes = contexto.T_Cliente.Select(s => new { s.CI_ID, s.CI_Nombre1, s.CI_Nombre2, s.CI_Apellido1, s.CI_Apellido2, s.CI_Identificacion, s.CI_Telefono, s.CI_Direccion }).ToList(); return(ListaClientes); } } catch (Exception ex) { return(null); } }
private void CargaDatos() { using (DBTallerEntities2 db = new DBTallerEntities2()) { clitabla = db.T_Cliente.Find(id); txtNombre1.Text = clitabla.CI_Nombre1; txtNombre2.Text = clitabla.CI_Nombre2; txtApellido1.Text = clitabla.CI_Apellido1; txtApellido2.Text = clitabla.CI_Apellido2; txtIdentidad.Text = clitabla.CI_Identificacion; txtTelefono.Text = clitabla.CI_Telefono; txtDireccion.Text = clitabla.CI_Direccion; } }
public T_Empleado ObtenerDetalle(int?id) { try { using (var contexto = new DBTallerEntities2()) { var Empleados = contexto.T_Empleado.Find(id); return(Empleados); } } catch (Exception e) { return(null); } }
public T_Estacion ObtenerDetalle(int?id) { try { using (var contexto = new DBTallerEntities2()) { var Estacion = contexto.T_Estacion.Find(id); return(Estacion); } } catch (Exception e) { return(null); } }
public T_Cliente ObtenerDetalle(int?id) { try { using (var contexto = new DBTallerEntities2()) { var clientes = contexto.T_Cliente.Find(id); return(clientes); } } catch (Exception e) { return(null); } }
public T_Caja ObtenerDetalle(int?id) { try { using (var contexto = new DBTallerEntities2()) { var caja = contexto.T_Caja.Find(id); return(caja); } } catch (Exception e) { return(null); } }
public T_Proveedores ObtenerDetalle(int?id) { try { using (var contexto = new DBTallerEntities2()) { var Proveedores = contexto.T_Proveedores.Find(id); return(Proveedores); } } catch (Exception e) { return(null); } }
public T_Mecanico ObtenerDetalle(int?id) { try { using (var contexto = new DBTallerEntities2()) { var Mecanico = contexto.T_Mecanico.Find(id); return(Mecanico); } } catch (Exception e) { return(null); } }
public T_Vehiculo ObtenerDetalle(int?id) { try { using (var contexto = new DBTallerEntities2()) { var Vehiculo = contexto.T_Vehiculo.Find(id); return(Vehiculo); } } catch (Exception e) { return(null); } }
public T_Cliente GetClienteByIdentificacion(string identificacion) { try { using (var contexto = new DBTallerEntities2()) { var cliente = contexto.T_Cliente.FirstOrDefault(c => c.CI_Identificacion == identificacion.Trim()); return(cliente); } } catch (Exception e) { return(null); } }
public bool EliminarCaja(int?id) { try { using (var contexto = new DBTallerEntities2()) { var caja = contexto.T_Caja.Find(id); contexto.T_Caja.Remove(caja); contexto.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public bool EliminarMecanico(int?id) { try { using (var contexto = new DBTallerEntities2()) { var Mecanico = contexto.T_Mecanico.Find(id); contexto.T_Mecanico.Remove(Mecanico); contexto.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public bool EliminarEmpleado(int?id) { try { using (var contexto = new DBTallerEntities2()) { var Empleados = contexto.T_Empleado.Find(id); contexto.T_Empleado.Remove(Empleados); contexto.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public bool EliminarProveedores(int?id) { try { using (var contexto = new DBTallerEntities2()) { var Proveedores = contexto.T_Proveedores.Find(id); contexto.T_Proveedores.Remove(Proveedores); contexto.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public object getEstacion() { try { using (var contexto = new DBTallerEntities2()) { var ListaEstacion = contexto.T_Estacion.Select(s => new { Es_Id = s.Es_Id, Es_Nombre = s.Es_Nombre, Ac_Id = s.Ac_Id }).ToList(); return(ListaEstacion); } } catch (Exception ex) { return(null); } }
private void refrescar() { using (DBTallerEntities2 db = new DBTallerEntities2()) { var ls = from d in db.T_Caja select d; dataGridView1.DataSource = ls.ToList(); } /* * try * { * // var caja = Servicios.getServicios(); * // dataGridView1.DataSource = caja; * } * catch(Exception ex) * { * MessageBox.Show(ex.Message); * }*/ }
public object getCaja() { try { using (var contexto = new DBTallerEntities2()) { var ListaCaja = contexto.T_Caja.Select(s => new { C_Id = s.C_Id, C_SaldoInicial = s.C_SaldoInicial, C_SaldoFinal = s.C_SaldoFinal, E_Id = s.E_Id }).ToList(); return(ListaCaja); } } catch (Exception ex) { return(null); } }
public object getMecanico() { try { using (var contexto = new DBTallerEntities2()) { var ListaMecanico = contexto.T_Mecanico.Select(s => new { M_ID = s.M_ID, E_ID = s.E_ID, M_Especialidad = s.M_Especialidad, M_Estado = s.M_Estado }).ToList(); return(ListaMecanico); } } catch (Exception ex) { return(null); } }
public object getProveedores() { try { using (var contexto = new DBTallerEntities2()) { var ListaProveedores = contexto.T_Proveedores.Select(s => new { P_Id = s.P_Id, P_Descripcion = s.P_Descripcion, P_FormaPago = s.P_FormaPago, P_Nombre = s.P_Nombre }).ToList(); return(ListaProveedores); } } catch (Exception ex) { return(null); } }
public bool AgregarEstacion(string nombre, int ide) { try { using (var contexto = new DBTallerEntities2()) { var Estacion = new T_Estacion { Es_Nombre = nombre, Ac_Id = ide }; contexto.T_Estacion.Add(Estacion); contexto.SaveChanges(); return(true); } } catch (Exception ex) { return(false); } }