예제 #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();
 }
예제 #2
0
 public RegistroServicio()
 {
     InitializeComponent();
     BllServicio = new BLL.Servicio();
     EntServicio = new ENT.Servicio();
     servicios   = new List <ENT.Servicio>();
 }
예제 #3
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();
 }
예제 #4
0
        //Metodo busca un valor int que rebibe por parametro, tambien busca la columna
        //que recibe por parametro
        public List <ENT.Servicio> buscarIntServicio(int cadena, string columna)
        {
            this.limpiarError();
            List <ENT.Servicio> servicios  = new List <ENT.Servicio>();
            Parametro           oParametro = new Parametro();

            oParametro.agregarParametro("@" + columna, NpgsqlDbType.Integer, cadena);
            string  sql  = "SELECT * FROM " + this.conexion.Schema + "servicio WHERE " + columna + " = @" + columna;
            DataSet dset = this.conexion.ejecutarConsultaSQL(sql, "servicio", oParametro.obtenerParametros());

            if (!this.conexion.IsError)
            {
                if (dset.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow tupla in dset.Tables[0].Rows)
                    {
                        ENT.Servicio sr = new ENT.Servicio(Convert.ToInt32(tupla["id_servicio"].ToString()), tupla["servcio"].ToString(),
                                                           int.Parse(tupla["precio"].ToString()));
                        servicios.Add(sr);
                    }
                }
            }
            else
            {
                this.error    = true;
                this.errorMsg = this.conexion.ErrorDescripcion;
            }
            return(servicios);
        }
예제 #5
0
 //Metodo limpa los componentes utilizados en el frame
 private void limpiarDatos()
 {
     txtPrecio.Text   = "";
     txtServicio.Text = "";
     txtImpuesto.Text = "";
     txtMensaje.Text  = "";
     EntServicio      = new ENT.Servicio();
 }
예제 #6
0
 //Metodo limpia las variables utilizadas
 //en todo el frame
 private void limpiarDatosServicios()
 {
     cargarServicioOrden();
     npQuitarServicio.Value  = 1;
     npAgregarServicio.Value = 1;
     txtAgregarServicio.Text = "";
     txtQuitarServicio.Text  = "";
     EntServicio             = new ENT.Servicio();
     EntOrdenServicio        = new ENT.OrdenServicio();
 }
예제 #7
0
        //Metodo elimina al servicio que recibe por parametro
        public void borrarservicio(ENT.Servicio servicio)
        {
            limpiarError();
            string    sql = "DELETE FROM " + this.conexion.Schema + "servicio where id_servicio = @id_servicio";
            Parametro prm = new Parametro();

            prm.agregarParametro("@id_servicio", NpgsqlDbType.Integer, servicio.Id);
            this.conexion.ejecutarSQL(sql, prm.obtenerParametros());
            if (this.conexion.IsError)
            {
                this.Error    = true;
                this.ErrorMsg = this.conexion.ErrorDescripcion;
            }
        }
예제 #8
0
        //Metodo inserta los valores que recibe por parametros a la base de datos
        public void agregarservicio(ENT.Servicio servicio)
        {
            limpiarError();
            string    sql = "INSERT INTO " + this.conexion.Schema + "servicio (servcio, precio, impuesto, descripcion, horas_promedio) values(@servicio, @precio, @impuesto, @descripcion, @horas_promedio)";
            Parametro prm = new Parametro();

            prm.agregarParametro("@servicio", NpgsqlDbType.Varchar, servicio.pServicio);
            prm.agregarParametro("@precio", NpgsqlDbType.Double, servicio.Precio);
            prm.agregarParametro("@impuesto", NpgsqlDbType.Double, servicio.Impuesto);
            prm.agregarParametro("@descripcion", NpgsqlDbType.Varchar, servicio.Descripcion);
            prm.agregarParametro("@horas_promedio", NpgsqlDbType.Integer, servicio.DiasPromedio);
            this.conexion.ejecutarSQL(sql, prm.obtenerParametros());
            if (this.conexion.IsError)
            {
                this.Error    = true;
                this.ErrorMsg = this.conexion.ErrorDescripcion;
            }
        }
예제 #9
0
        //Metodo actualiza el servicio por los datos que recibe por parametro
        public void actualizarServicio(ENT.Servicio servicio)
        {
            limpiarError();
            string    sql = "UPDATE " + this.conexion.Schema + "servicio set servcio = @servicio ,precio = @precio, impuesto = @impuesto, descripcion = @descripcion, horas_promedio = @horas_promedio where id_servicio = @id_servicio";
            Parametro prm = new Parametro();

            prm.agregarParametro("@servicio", NpgsqlDbType.Varchar, servicio.pServicio);
            prm.agregarParametro("@precio", NpgsqlDbType.Double, servicio.Precio);
            prm.agregarParametro("@impuesto", NpgsqlDbType.Double, servicio.Impuesto);
            prm.agregarParametro("@id_servicio", NpgsqlDbType.Integer, servicio.Id);
            prm.agregarParametro("@descripcion", NpgsqlDbType.Varchar, servicio.Descripcion);
            prm.agregarParametro("@horas_promedio", NpgsqlDbType.Integer, servicio.DiasPromedio);
            this.conexion.ejecutarSQL(sql, prm.obtenerParametros());
            if (this.conexion.IsError)
            {
                this.Error    = true;
                this.ErrorMsg = this.conexion.ErrorDescripcion;
            }
        }
예제 #10
0
        //Metodo carga todos los servicios a la lista
        //para retornarlos
        public List <ENT.Servicio> cargarServicios()
        {
            limpiarError();
            List <ENT.Servicio> servicios = new List <ENT.Servicio>();
            DataSet             dsetEmpleados;
            string sql = "SELECT * FROM " + this.conexion.Schema + "servicio";

            dsetEmpleados = conexion.ejecutarConsultaSQL(sql);
            foreach (DataRow tupla in dsetEmpleados.Tables[0].Rows)
            {
                ENT.Servicio pEmpleados = new ENT.Servicio(Convert.ToInt32(tupla["id_servicio"].ToString()), tupla["servcio"].ToString(),
                                                           double.Parse(tupla["precio"].ToString()), double.Parse(tupla["impuesto"].ToString()), tupla["descripcion"].ToString(), Int32.Parse(tupla["horas_promedio"].ToString()));
                servicios.Add(pEmpleados);
            }
            if (this.conexion.IsError)
            {
                this.Error    = true;
                this.ErrorMsg = this.conexion.ErrorDescripcion;
            }
            return(servicios);
        }
예제 #11
0
        public List <ENT.OrdenServicio> buscarOrdenServicioPorID(int valor)
        {
            this.limpiarError();
            List <ENT.OrdenServicio> ordenServicios = new List <ENT.OrdenServicio>();

            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_servicio AS id_orden_servicio, 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, s.id_servicio AS id_servicioS, s.servcio AS servicioS, " +
                         "s.precio AS precioS, s.impuesto AS impuestoS, s.descripcion as descripcion, s.horas_promedio as horas_promedio " +
                         " FROM   " + this.conexion.Schema + "orden_servicio orp, " + this.conexion.Schema + "empleado e, " + this.conexion.Schema + "orden o, " + this.conexion.Schema + "servicio s " +
                         "WHERE orp.fk_empleado = e.id_empleado AND orp.fk_orden = o.id_orden AND orp.fk_Servicio = s.id_servicio AND orp.fk_orden = @fk_orden";
            DataSet dset = this.conexion.ejecutarConsultaSQL(sql, "orden_servicio", prm.obtenerParametros());

            if (!this.conexion.IsError)
            {
                if (dset.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow tupla in dset.Tables[0].Rows)
                    {
                        ENT.Servicio      Oservicio     = new ENT.Servicio(int.Parse(tupla["id_servicioS"].ToString()), tupla["servicioS"].ToString(), double.Parse(tupla["precioS"].ToString()), double.Parse(tupla["impuestoS"].ToString()), tupla["descripcion"].ToString(), Int32.Parse(tupla["horas_promedio"].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.OrdenServicio ordenServicio = new ENT.OrdenServicio(int.Parse(tupla["id_orden_servicio"].ToString()), int.Parse(tupla["cantidad"].ToString()), double.Parse(tupla["costo"].ToString()), OEmpleado, Oservicio, oOrden);
                        ordenServicios.Add(ordenServicio);
                    }
                }
            }
            else
            {
                this.error    = true;
                this.errorMsg = this.conexion.ErrorDescripcion;
            }
            return(ordenServicios);
        }