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 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 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 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 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 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);
     }
 }
Пример #9
0
 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 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 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);
     }
 }
Пример #12
0
 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 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);
     }
 }
Пример #14
0
 public bool AgregarMecanico(int ide, string especialidad, bool estado)
 {
     try
     {
         using (var contexto = new DBTallerEntities2())
         {
             var Mecanico = new T_Mecanico
             {
                 E_ID           = ide,
                 M_Especialidad = especialidad,
                 M_Estado       = estado
             };
             contexto.T_Mecanico.Add(Mecanico);
             contexto.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
 public bool AgregarCaja(double SaldoInicial, double SaldoFinal, int ide)
 {
     try
     {
         using (var contexto = new DBTallerEntities2())
         {
             var Caja = new T_Caja
             {
                 C_SaldoInicial = (decimal)SaldoInicial,
                 C_SaldoFinal   = (decimal)SaldoFinal,
                 E_Id           = ide
             };
             contexto.T_Caja.Add(Caja);
             contexto.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #16
0
 public bool AgregarProveedores(string descripcion, string formapago, string nombre)
 {
     try
     {
         using (var contexto = new DBTallerEntities2())
         {
             var Proveedores = new T_Proveedores
             {
                 P_Descripcion = descripcion,
                 P_FormaPago   = formapago,
                 P_Nombre      = nombre
             };
             contexto.T_Proveedores.Add(Proveedores);
             contexto.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
 public bool EditarEstacion(int?id, string nombre, int ide)
 {
     try
     {
         using (var contexto = new DBTallerEntities2())
         {
             var Estacion = contexto.T_Estacion.Find(id);
             if (Estacion == null)
             {
                 return(false);
             }
             Estacion.Es_Nombre = nombre;
             Estacion.Ac_Id     = ide;
             contexto.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool EditarCaja(int?id, double SaldoInicial, double SaldoFinal, int ide)
 {
     try
     {
         using (var contexto = new DBTallerEntities2())
         {
             var caja = contexto.T_Caja.Find(id);
             if (caja == null)
             {
                 return(false);
             }
             caja.C_SaldoInicial = (decimal)SaldoInicial;
             caja.C_SaldoFinal   = (decimal)SaldoFinal;
             caja.E_Id           = ide;
             contexto.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #19
0
 public bool AgregarPedido(int ide, int cantidad, string descripcion, double preciounitario)
 {
     try
     {
         using (var contexto = new DBTallerEntities2())
         {
             var Pedido = new T_Pedido
             {
                 Pr_Id             = ide,
                 Pd_Cantidad       = cantidad,
                 Pd_Descripcion    = descripcion,
                 Pd_PrecioUnitario = (decimal)preciounitario
             };
             contexto.T_Pedido.Add(Pedido);
             contexto.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #20
0
 public bool EditarMecanico(int?id, int ide, string especialidad, bool estado)
 {
     try
     {
         using (var contexto = new DBTallerEntities2())
         {
             var Mecanico = contexto.T_Mecanico.Find(id);
             if (Mecanico == null)
             {
                 return(false);
             }
             Mecanico.E_ID           = ide;
             Mecanico.M_Especialidad = especialidad;
             Mecanico.M_Estado       = estado;
             contexto.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #21
0
 public bool AgregarProyecto(int idestacion, int idmanodeobra, int idvehiculo, string comentario)
 {
     try
     {
         using (var contexto = new DBTallerEntities2())
         {
             var Proyecto = new T_Proyecto
             {
                 Es_Id          = idestacion,
                 Mdo_Id         = idmanodeobra,
                 V_id           = idvehiculo,
                 Pry_Comentario = comentario
             };
             contexto.T_Proyecto.Add(Proyecto);
             contexto.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #22
0
 public bool EditarProveedores(int?id, string descripcion, string formapago, string nombre)
 {
     try
     {
         using (var contexto = new DBTallerEntities2())
         {
             var Proveedores = contexto.T_Proveedores.Find(id);
             if (Proveedores == null)
             {
                 return(false);
             }
             Proveedores.P_Descripcion = descripcion;
             Proveedores.P_FormaPago   = formapago;
             Proveedores.P_Nombre      = nombre;
             contexto.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #23
0
 public bool EditarPedido(int?id, int ide, int cantidad, string descripcion, double preciounitario)
 {
     try
     {
         using (var contexto = new DBTallerEntities2())
         {
             var Pedido = contexto.T_Pedido.Find(id);
             if (Pedido == null)
             {
                 return(false);
             }
             Pedido.Pr_Id             = ide;
             Pedido.Pd_Cantidad       = cantidad;
             Pedido.Pd_Descripcion    = descripcion;
             Pedido.Pd_PrecioUnitario = (decimal)preciounitario;
             contexto.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #24
0
 public bool EditarProyecto(int?id, int idestacion, int idmanodeobra, int idvehiculo, string comentario)
 {
     try
     {
         using (var contexto = new DBTallerEntities2())
         {
             var Proyecto = contexto.T_Proyecto.Find(id);
             if (Proyecto == null)
             {
                 return(false);
             }
             Proyecto.Es_Id          = idestacion;
             Proyecto.Mdo_Id         = idmanodeobra;
             Proyecto.V_id           = idvehiculo;
             Proyecto.Pry_Comentario = comentario;
             contexto.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }