Ejemplo n.º 1
0
 public FrmOrdenReparaciones(ENT.Orden orden)
 {
     InitializeComponent();
     EntOrdenServicio = new ENT.OrdenServicio();
     EntVehiculo      = new ENT.Vehiculo();
     EntOrden         = new ENT.Orden();
     EntRepuesto      = new ENT.RepuestoVehiculo();
     EntOrdenRepuesto = new ENT.OrdenRepuesto();
     EntEmpleado      = new ENT.Empleado();
     EntServicio      = new ENT.Servicio();
     BllVehiculo      = new BLL.Vehiculo();
     BllEmpleado      = new BLL.Empleado();
     BllOrden         = new BLL.Orden();
     BllRepesto       = new BLL.Repuesto();
     BllServicio      = new BLL.Servicio();
     BllOrdenRepuesto = new BLL.OrdenRepuesto();
     BllOrdenServicio = new BLL.OrdenServicio();
     repuestos        = new List <ENT.RepuestoVehiculo>();
     servicios        = new List <ENT.Servicio>();
     ordenRepuestos   = new List <ENT.OrdenRepuesto>();
     ordenServicios   = new List <ENT.OrdenServicio>();
     vehiculos        = new List <ENT.Vehiculo>();
     empleados        = new List <ENT.Empleado>();
     ordenes          = new List <ENT.Orden>();
     this.EntOrden    = orden;
     llenarComboEncargado();
     llenarComboVehiculo();
     cargarComponentesOrden(orden);
     cargarRepuestosOrden();
     cargarServicioOrden();
 }
Ejemplo n.º 2
0
 public FrmOrdenReparaciones()
 {
     InitializeComponent();
     EntVehiculo            = new ENT.Vehiculo();
     EntOrdenServicio       = new ENT.OrdenServicio();
     EntOrden               = new ENT.Orden();
     EntRepuesto            = new ENT.RepuestoVehiculo();
     EntOrdenRepuesto       = new ENT.OrdenRepuesto();
     EntEmpleado            = new ENT.Empleado();
     EntServicio            = new ENT.Servicio();
     BllVehiculo            = new BLL.Vehiculo();
     BllEmpleado            = new BLL.Empleado();
     BllOrden               = new BLL.Orden();
     BllRepesto             = new BLL.Repuesto();
     BllServicio            = new BLL.Servicio();
     BllOrdenRepuesto       = new BLL.OrdenRepuesto();
     BllOrdenServicio       = new BLL.OrdenServicio();
     repuestos              = new List <ENT.RepuestoVehiculo>();
     servicios              = new List <ENT.Servicio>();
     ordenRepuestos         = new List <ENT.OrdenRepuesto>();
     ordenServicios         = new List <ENT.OrdenServicio>();
     vehiculos              = new List <ENT.Vehiculo>();
     empleados              = new List <ENT.Empleado>();
     vehiculos              = new List <ENT.Vehiculo>();
     ordenes                = new List <ENT.Orden>();
     cbEstado.Enabled       = false;
     tabComponentes.Enabled = false;
     llenarComboEncargado();
     llenarComboVehiculo();
 }
Ejemplo n.º 3
0
 private void limpiarDatosRepuesto()
 {
     cargarRepuestosOrden();
     npQuitarRepuesto.Value  = 1;
     npRepuestoAgregar.Value = 1;
     txtRepuestoUno.Text     = "";
     txtQuitar.Text          = "";
     EntRepuesto             = new ENT.RepuestoVehiculo();
     EntOrdenRepuesto        = new ENT.OrdenRepuesto();
 }
Ejemplo n.º 4
0
 //Metodo limpia los componentes de las identidades
 private void limpiarDatos()
 {
     cbEncargado.SelectedIndex = -1;
     cbEstado.SelectedIndex    = -1;
     cbVehiculo.SelectedIndex  = -1;
     EntOrdenRepuesto          = new ENT.OrdenRepuesto();
     EntRepuesto              = new ENT.RepuestoVehiculo();
     EntEmpleado              = new ENT.Empleado();
     dtIngreso.Value          = DateTime.Today;
     dtFechaSalida.Value      = DateTime.Today;
     txtFechaFacturacion.Text = "";
 }
Ejemplo n.º 5
0
        //Metodo elimina el repuesto que recibe por parametro
        public void borraOrdenRepuesto(ENT.OrdenRepuesto ordenRepusto)
        {
            limpiarError();
            string    sql = "DELETE FROM " + this.conexion.Schema + "orden_repuesto WHERE id_orden_repuesto = @id_orden_repuesto";
            Parametro prm = new Parametro();

            prm.agregarParametro("@id_orden_repuesto", NpgsqlDbType.Integer, ordenRepusto.Id);
            this.conexion.ejecutarSQL(sql, prm.obtenerParametros());
            if (this.conexion.IsError)
            {
                this.error    = true;
                this.errorMsg = this.conexion.ErrorDescripcion;
            }
        }
Ejemplo n.º 6
0
        //Metodo actualiza los repuesto de la orden, por los nuevos
        //valores que recibe por parametro
        public void editarOrdenRepuesto(ENT.OrdenRepuesto ordenRepuesto)
        {
            limpiarError();
            string    sql = "UPDATE " + this.conexion.Schema + "orden_repuesto SET costo = @costo, cantidad = @cantidad  WHERE id_orden_repuesto = @id_orden_repuesto;";
            Parametro prm = new Parametro();

            prm.agregarParametro("@costo", NpgsqlDbType.Double, ordenRepuesto.TotalRepuestos);
            prm.agregarParametro("@cantidad", NpgsqlDbType.Integer, ordenRepuesto.Cantidad);
            prm.agregarParametro("@id_orden_repuesto", NpgsqlDbType.Integer, ordenRepuesto.Id);
            this.conexion.ejecutarSQL(sql, prm.obtenerParametros());
            if (this.conexion.IsError)
            {
                this.error    = false;
                this.errorMsg = this.conexion.ErrorDescripcion;
            }
        }
Ejemplo n.º 7
0
        //Metodo inserta en la base de datos los valores que
        //recibe por parametro
        public void agregarOrdenRepuesto(ENT.OrdenRepuesto ordenRepuesto)
        {
            limpiarError();
            string sql = "INSERT INTO " + this.conexion.Schema + "orden_repuesto(fk_orden, fk_repuesto, costo, cantidad, pk_empleado) "
                         + "VALUES(@fk_orden, @fk_repuesto, @costo, @cantidad, @pk_empleado)";
            Parametro prm = new Parametro();

            prm.agregarParametro("@fk_orden", NpgsqlDbType.Integer, ordenRepuesto.Orden.Id);
            prm.agregarParametro("@fk_repuesto", NpgsqlDbType.Integer, ordenRepuesto.Repuesto1.Id);
            prm.agregarParametro("@costo", NpgsqlDbType.Double, ordenRepuesto.TotalRepuestos);
            prm.agregarParametro("@cantidad", NpgsqlDbType.Integer, ordenRepuesto.Cantidad);
            prm.agregarParametro("@pk_empleado", NpgsqlDbType.Integer, ordenRepuesto.Empleado.Id);
            this.conexion.ejecutarSQL(sql, prm.obtenerParametros());
            if (this.conexion.IsError)
            {
                this.Error    = true;
                this.ErrorMsg = this.conexion.ErrorDescripcion;
            }
        }
Ejemplo n.º 8
0
        public List <ENT.OrdenRepuesto> buscarOrdenRepuestoPorID(int valor)
        {
            this.limpiarError();
            List <ENT.OrdenRepuesto> ordenRepuestos = new List <ENT.OrdenRepuesto>();
            Parametro prm = new Parametro();

            prm.agregarParametro("@fk_orden", NpgsqlDbType.Integer, valor);
            string sql = "SELECT orp.id_orden_repuesto AS id_orden_repuesto, orp.cantidad AS cantidad, orp.costo AS costo," +
                         "e.id_empleado AS id_empleado, e.nombre AS nombre_empleado, e.apellido AS apellido_empleado, e.direccion AS direccion_empleado, e.telefono1 AS telefono1_empleado, e.telefono2 AS telefono2_empleado, e.trabajo AS trabajo_empleado, e.permiso AS permiso_empleado, " +
                         "e.contrasenna AS contrasenna_empleado, e.usuario AS usuario_empleado, o.id_orden AS id_orden, o.fecha_ingreso AS fecha_ingreso, o.fecha_salida AS fecha_salida, o.fecha_facturacion AS fecha_facturacion, " +
                         "o.estado AS estado, o.costo_total AS costo_total, o.fk_vehiculo AS fk_vehiculo, o.pk_empleado AS pk_empleado, r.id_repuesto AS id_repuestoR, r.repuesto AS repuestoR, " +
                         "r.precio AS precioR, r.impuesto AS impuestoR, r.anno as anno " +
                         "FROM " + this.conexion.Schema + "orden_repuesto orp, " + this.conexion.Schema + "empleado e, " + this.conexion.Schema + "orden o, " + this.conexion.Schema + "repuesto r " +
                         "WHERE  orp.pk_empleado = e.id_empleado AND orp.fk_orden = o.id_orden AND orp.fk_repuesto = r.id_repuesto AND orp.fk_orden = @fk_orden";
            DataSet dset = this.conexion.ejecutarConsultaSQL(sql, "orden_repuesto", prm.obtenerParametros());

            if (!this.conexion.IsError)
            {
                if (dset.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow tupla in dset.Tables[0].Rows)
                    {
                        RepuestoVehiculo  Orepuesto     = new RepuestoVehiculo(Int32.Parse(tupla["id_repuestor"].ToString()), tupla["repuestor"].ToString(), Double.Parse(tupla["precior"].ToString()), Double.Parse(tupla["impuestor"].ToString()), Int32.Parse(tupla["anno"].ToString()));
                        ENT.Orden         oOrden        = new ENT.Orden(int.Parse(tupla["id_orden"].ToString()), DateTime.Parse(tupla["fecha_ingreso"].ToString()), DateTime.Parse(tupla["fecha_salida"].ToString()), DateTime.Parse(tupla["fecha_facturacion"].ToString()), tupla["estado"].ToString(), double.Parse(tupla["costo_total"].ToString()), new ENT.Vehiculo(), new ENT.Empleado());
                        ENT.Empleado      OEmpleado     = new ENT.Empleado(int.Parse(tupla["id_empleado"].ToString()), tupla["nombre_empleado"].ToString(), tupla["apellido_empleado"].ToString(), tupla["direccion_empleado"].ToString(), tupla["telefono1_empleado"].ToString(), tupla["telefono2_empleado"].ToString(), tupla["trabajo_empleado"].ToString(), tupla["permiso_empleado"].ToString(), tupla["usuario_empleado"].ToString(), tupla["contrasenna_empleado"].ToString());
                        ENT.OrdenRepuesto ordenRepuesto = new ENT.OrdenRepuesto(Int32.Parse(tupla["id_orden_repuesto"].ToString()), Int32.Parse(tupla["cantidad"].ToString()), Double.Parse(tupla["costo"].ToString()), oOrden, OEmpleado, Orepuesto);
                        ordenRepuestos.Add(ordenRepuesto);
                    }
                }
            }
            else
            {
                this.error    = true;
                this.errorMsg = this.conexion.ErrorDescripcion;
            }
            return(ordenRepuestos);
        }
Ejemplo n.º 9
0
        public double quitarRepuestos(OrdenRepuesto ordenRepuesto, int cantidad)
        {
            double total = (((ordenRepuesto.Repuesto1.Precio * ordenRepuesto.Repuesto1.Impuesto / 100) + (ordenRepuesto.Repuesto1.Precio)) * cantidad);

            return(ordenRepuesto.TotalRepuestos - total);
        }
Ejemplo n.º 10
0
 public double totalRepuesto(OrdenRepuesto ordenRepuesto, int cantidad)
 {
     return(((ordenRepuesto.Repuesto1.Precio * ordenRepuesto.Repuesto1.Impuesto / 100) + ordenRepuesto.Repuesto1.Precio) * cantidad);
 }