Exemple #1
0
        public frmMain()
        {
            clsSQL clsSQL = new clsSQL();

            InitializeComponent();
            //MessageBox.Show("Revise los mensajes importantes que tiene pendientes de visualizar.");
        }
        public void recogerDatos(int _id_key_proveedor)
        {
            clsFunciones clsFunc = new clsFunciones();
            clsSQL       clsSQL  = new clsSQL();
            DataTable    dt      = new DataTable();

            if (_id_key_proveedor != 0)
            {
                dt = clsSQL.devolverDataTable("select * from proveedores where id_key_proveedor = " + _id_key_proveedor.ToString());
                this.id_key_proveedor = _id_key_proveedor;
                foreach (DataRow dr in dt.Rows)
                {
                    //Carga datos proveedor
                    //this.txtNombre.Text = dr["Nombre"].ToString();
                    //this.txtCIF.SelectedValue = dr["CIF"].ToString();
                }
                //this.btnNuevoTool.Enabled = true;
                this.btnAddTool.Enabled       = false;
                this.btnModificarTool.Enabled = true;
            }
            else
            {
                //nuevoItem();
                //this.btnNuevoTool.Enabled = true;
            }
        }
Exemple #3
0
        //****************************************************
        // INICIO METODOS PPALES ALTA, BAJA, MODIFICACION ****
        //****************************************************
        private void addItem()
        {
            clsFunciones clsFunc   = new clsFunciones();
            String       respuesta = String.Empty;
            clsSQL       clsSQL    = new clsSQL();
            int          activo    = 0;

            if (this.chkActivo.Checked == true)
            {
                activo = 1;
            }

            respuesta = clsSQL.ejecutarSP("SP_Man_Empleados", "@opcion=1=System.Int32",
                                          "@id_key_empleado=0=System.Int32",
                                          "@NIF=" + this.txtNIF.Text.Trim() + "=System.String",
                                          "@nombre=" + this.txtNombre.Text.Trim() + "=System.String",
                                          "@apellido1=" + this.txtApellido1.Text.Trim() + "=System.String",
                                          "@apellido2=" + this.txtApellido2.Text.Trim() + "=System.String",
                                          "@num_SS=" + this.txtNumSS.Text.Trim() + "=System.String",
                                          "@fecha_alta=" + this.fechaAlta.Value + "=System.Datetime",
                                          "@fecha_baja=" + fechaBaja.Value + "=System.Datetime",
                                          "@id_key_departamento=" + this.cmbDepartamento.SelectedValue + "=System.Int32",
                                          "@id_key_puesto=" + this.cmbPuesto.SelectedValue + "=System.Int32",
                                          "@activo=" + activo.ToString() + "=System.Int32");
            if (respuesta != "OK")
            {
                MessageBox.Show("Error al crear el registro.", mdPrincipal.Error_SQL, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                MessageBox.Show("Registro añadido correctamente.");
            }

            this.Close();
        }
Exemple #4
0
        private void addItem()
        {
            clsFunciones clsFunc   = new clsFunciones();
            String       respuesta = String.Empty;
            clsSQL       clsSQL    = new clsSQL();

            respuesta = clsSQL.ejecutarSP("SP_Man_Servicios", "@opcion=1=System.Int32",
                                          "@id_key_servicio=0=System.Int32",
                                          "@fecha=" + this.Fecha.Value + "=System.Datetime",
                                          "@hora=" + this.Hora.Value + "=System.Datetime",
                                          "@id_Key_cliente=" + this.cmbClientes.SelectedValue + "=System.Int32",
                                          "@id_key_origen=" + this.cmbDesde.SelectedValue + "=System.Int32",
                                          "@id_key_destino=" + this.cmbHasta.SelectedValue + "=System.Int32",
                                          "@id_key_empleado=" + this.cmbConductor.SelectedValue + "=System.Int32",
                                          "@id_key_vehiculo=" + this.cmbVehiculos.SelectedValue + "=System.Int32",
                                          "@Menus=" + this.txtMenus.Text.Trim() + "=System.Decimal",
                                          "@Km=" + this.txtKm.Text.Trim() + "=System.Decimal",
                                          "@id_key_estado=" + this.cmbEstado.SelectedIndex + "=System.Int32",
                                          "@notas=" + this.txtNotas.Text.Trim() + "=System.String");
            if (respuesta != "OK")
            {
                MessageBox.Show("Error al crear el registro.", mdPrincipal.Error_SQL, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                MessageBox.Show("Registro añadido correctamente.");
            }

            this.Close();
        }
        public void recogerDatos(int _id_key_articulo)
        {
            clsFunciones clsFunc = new clsFunciones();
            clsSQL       clsSQL  = new clsSQL();
            DataTable    dt      = new DataTable();

            if (_id_key_articulo != 0)
            {
                dt = clsSQL.devolverDataTable("select * from articulos where id_key_articulo = " + _id_key_articulo.ToString());
                this.id_key_articulo = _id_key_articulo;
                foreach (DataRow dr in dt.Rows)
                {
                    //this.txtDescripcion.Text = dr["descripcion"].ToString();
                    //this.cmbProveedor.SelectedValue = dr["id_key_proveedor"].ToString();
                }
                //this.btnNuevoTool.Enabled = true;
                this.btnAddTool.Enabled       = false;
                this.btnModificarTool.Enabled = true;
                this.btnEliminarTool.Enabled  = true;
            }
            else
            {
                //nuevoItem();
                //this.btnNuevoTool.Enabled = true;
            }
        }
Exemple #6
0
        private void modificarItem()
        {
            clsFunciones clsFunc   = new clsFunciones();
            String       respuesta = String.Empty;
            clsSQL       clsSQL    = new clsSQL();
            int          activo    = 0;


            if (this.chkActivo.Checked == true)
            {
                activo = 1;
            }


            respuesta = clsSQL.ejecutarSP("SP_Man_Rutas", "@opcion=3=System.Int32",
                                          "@id_key_ruta=" + this.id_key_ruta.ToString() + "=System.Int32",
                                          "@origen=" + this.txtOrigen.Text.Trim() + "=System.String",
                                          "@destino=" + this.txtDestino.Text.Trim() + "=System.String",
                                          "@km=" + this.txtKm.Text.Trim() + "=System.Int32",
                                          "@peajes=" + this.txtPeajes.Text.Trim() + "=System.String",
                                          "@precios=" + this.txtPrecio.Text.Trim() + "=System.String",
                                          "@vehiculo_activo=" + activo.ToString() + "=System.Int32");
            if (respuesta != "OK")
            {
                MessageBox.Show("Error al modificar el registro.", mdPrincipal.Error_SQL, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                MessageBox.Show("Registro modificado correctamente.");
            }

            this.Close();
        }
        private void addItem()
        {
            clsFunciones clsFunc   = new clsFunciones();
            String       respuesta = String.Empty;
            clsSQL       clsSQL    = new clsSQL();
            int          activo    = 0;


            if (this.chkActivo.Checked == true)
            {
                activo = 1;
            }


            respuesta = clsSQL.ejecutarSP("SP_Man_Vehiculos", "@opcion=1=System.Int32",
                                          "@id_key_vehiculo=0=System.Int32",
                                          "@matricula=" + this.txtMatricula.Text.Trim() + "=System.String",
                                          "@num_bastidor=" + this.txtNumBastidor.Text.Trim() + "=System.String",
                                          "@id_key_tipo_vehiculo=" + this.cmbTipoVehiculo.SelectedValue + "=System.Int32",
                                          "@marca=" + this.txtMarca.Text.Trim() + "=System.String",
                                          "@modelo=" + this.txtModelo.Text.Trim() + "=System.String",
                                          "@fecha_matriculacion=" + this.fechaMatriculacion.Value + "=System.Datetime",
                                          "@id_key_tipo_ruedas=" + this.cmbTipoRuedas.SelectedValue + "=System.Int32",
                                          "@vehiculo_activo=" + activo.ToString() + "=System.Int32");
            if (respuesta != "OK")
            {
                MessageBox.Show("Error al crear el registro.", mdPrincipal.Error_SQL, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                MessageBox.Show("Registro añadido correctamente.");
            }

            this.Close();
        }
Exemple #8
0
        public void recogerDatos(int _id_key_usuario)
        {
            clsFunciones clsFunc = new clsFunciones();
            clsSQL       clsSQL  = new clsSQL();
            DataTable    dt      = new DataTable();

            if (_id_key_usuario != 0)
            {
                dt = clsSQL.devolverDataTable("select * from usuarios where id_key_usuario = " + _id_key_usuario.ToString());
                this.id_key_usuario = _id_key_usuario;
                foreach (DataRow dr in dt.Rows)
                {
                    //this.txtNombre.Text = dr["nombre"].ToString();
                    //this.txtPassword.Text = dr["password"].ToString();
                    //cargaPermisos();
                }
                //this.btnNuevoTool.Enabled = true;
                this.btnAddTool.Enabled       = false;
                this.btnModificarTool.Enabled = true;
                this.btnEliminarTool.Enabled  = true;
            }
            else
            {
                //nuevoItem();
                //this.btnNuevoTool.Enabled = true;
            }
        }
        private void Busqueda()
        {
            try
            {
                clsSQL  Consulta = new clsSQL();
                DataSet ds;
                String  strSQL   = "select id_key_cliente,Nombre,id_key_Provincia_fiscal, Direccion_fiscal, CP_fiscal from Clientes where";
                String  txtWhere = String.Empty;



                this.grdClientes.DataSource = null;

                if (this.txtCIF.Text.Trim() != String.Empty)
                {
                    txtWhere = " CIF like '%" + txtCIF.Text + "%' and";
                }

                if (this.txtNombre.Text.Trim() != String.Empty)
                {
                    txtWhere = txtWhere + " Nombre like '%" + txtNombre.Text + "%' and";
                }

                if (this.txtProvincia.Text.Trim() != String.Empty)
                {
                    txtWhere = txtWhere + " Provincia like '%" + txtProvincia.Text + "%' and";
                }


                if (txtWhere.Trim() == String.Empty)
                {
                    strSQL = "select id_key_cliente,Nombre,id_key_Provincia_fiscal, Direccion_fiscal, CP_fiscal from Clientes";
                }

                if (txtWhere.Trim().EndsWith("and"))
                {
                    txtWhere = txtWhere.Substring(0, txtWhere.Length - 3);
                }

                strSQL = strSQL + txtWhere + " order by Nombre";

                ds = Consulta.devolverDataSetSelect(strSQL);

                this.grdClientes.DataSource         = ds.Tables[0];
                this.grdClientes.Columns[0].Visible = false;
                //this.grdVehiculos.Columns[0].Visible = false;
                ds.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), mdPrincipal.Nombre_App, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void Buscar()
        {
            try
            {
                clsSQL  Consulta = new clsSQL();
                DataSet ds;
                String  strSQL   = "select id_key_vehiculo,(marca + ' ' + modelo) as Marca,Matricula,num_bastidor as Numero_bastidor from Vehiculos where";
                String  txtWhere = String.Empty;

                this.grdVehiculos.DataSource = null;

                if (this.txtMatricula.Text.Trim() != String.Empty)
                {
                    txtWhere = " matricula like '%" + txtMatricula.Text + "%' and";
                }

                if (this.txtNumBastidor.Text.Trim() != String.Empty)
                {
                    txtWhere = txtWhere + " num_bastidor like '%" + txtNumBastidor.Text + "%' and";
                }

                if (this.txtMarca.Text.Trim() != String.Empty)
                {
                    txtWhere = txtWhere + " marca like '%" + txtMarca.Text + "%' and";
                }


                if (txtWhere.Trim() == String.Empty)
                {
                    strSQL = "select id_key_vehiculo,(marca + ' ' + modelo) as Marca,matricula,num_bastidor as Numero_bastidor from Vehiculos";
                }

                if (txtWhere.Trim().EndsWith("and"))
                {
                    txtWhere = txtWhere.Substring(0, txtWhere.Length - 3);
                }

                strSQL = strSQL + txtWhere + " order by matricula";

                ds = Consulta.devolverDataSetSelect(strSQL);

                this.grdVehiculos.DataSource         = ds.Tables[0];
                this.grdVehiculos.Columns[0].Visible = false;
                //this.grdVehiculos.Columns[0].Visible = false;
                ds.Dispose();
            }
            catch (Exception ex) {
                MessageBox.Show(ex.ToString(), mdPrincipal.Nombre_App, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void Buscar()

        {
            try
            {
                clsSQL  Consulta = new clsSQL();
                DataSet ds;
                String  strSQL   = "select id_key_ruta,Descripcion,origen,destino,km,precio,peajes from Rutas where";
                String  txtWhere = String.Empty;

                this.grdRutas.DataSource = null;

                if (this.txtDescripcion.Text.Trim() != String.Empty)
                {
                    txtWhere = " descripcion like '%" + txtDescripcion.Text + "%' and";
                }

                if (this.txtOrigen.Text.Trim() != String.Empty)
                {
                    txtWhere = txtWhere + " origen like '%" + txtOrigen.Text + "%' and";
                }
                if (this.txtDestino.Text.Trim() != String.Empty)
                {
                    txtWhere = txtWhere + " destino like '%" + txtDestino.Text + "%' and";
                }


                if (txtWhere.Trim() == String.Empty)
                {
                    strSQL = "select id_key_ruta,origen,destino,km,precio,peajes from Rutas";
                }

                if (txtWhere.Trim().EndsWith("and"))
                {
                    txtWhere = txtWhere.Substring(0, txtWhere.Length - 3);
                }

                strSQL = strSQL + txtWhere + " order by descripcion";

                ds = Consulta.devolverDataSetSelect(strSQL);

                this.grdRutas.DataSource         = ds.Tables[0];
                this.grdRutas.Columns[0].Visible = false;
                //this.grdVehiculos.Columns[0].Visible = false;
                ds.Dispose();
            }
            catch (Exception ex) {
                MessageBox.Show(ex.ToString(), mdPrincipal.Nombre_App, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void Buscar()
        {
            try
            {
                clsSQL  Consulta = new clsSQL();
                DataSet ds;
                String  strSQL   = "select * from v_facturas_compra where";
                String  txtWhere = String.Empty;

                this.grdFacturasCompra.DataSource = null;

                if (this.txtNumFactura.Text.Trim() != String.Empty)
                {
                    txtWhere = " num_factura like '%" + txtNumFactura.Text + "%' and";
                }

                if (this.txtProveedor.Text.Trim() != String.Empty)
                {
                    txtWhere = " nombre_proveedor like '%" + txtProveedor.Text + "%' and";
                }



                if (txtWhere.Trim() == String.Empty)
                {
                    strSQL = "select * from v_facturas_compra";
                }

                if (txtWhere.Trim().EndsWith("and"))
                {
                    txtWhere = txtWhere.Substring(0, txtWhere.Length - 3);
                }

                strSQL = strSQL + txtWhere;

                ds = Consulta.devolverDataSetSelect(strSQL);

                this.grdFacturasCompra.DataSource         = ds.Tables[0];
                this.grdFacturasCompra.Columns[0].Visible = false;
                //this.grdVehiculos.Columns[0].Visible = false;
                ds.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), mdPrincipal.Nombre_App, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #13
0
        public void recogerDatos(int _id_key_servicio, DateTime _fecha)
        {
            clsFunciones clsFunc = new clsFunciones();
            clsSQL       clsSQL  = new clsSQL();
            DataTable    dt      = new DataTable();

            Fecha.Value = _fecha;


            if (_id_key_servicio != 0)
            {
                dt = clsSQL.devolverDataTable("select * from v_servicios where id_key_servicio = " + _id_key_servicio.ToString());
                this.id_key_servicio = _id_key_servicio;
                foreach (DataRow dr in dt.Rows)
                {
                    this.Hora.Value = Convert.ToDateTime(dr["Hora"].ToString());
                    this.cmbClientes.SelectedValue = dr["id_key_cliente"].ToString();
                    //this.txtCIF.Text = dr["CIF"].ToString();
                    //this.txtNombre.Text = dr["Nombre"].ToString();
                    //this.txtDireccion.Text = dr["Direccion_fiscal"].ToString();
                    ////this.cmbProvincias.SelectedValue = dr["Provincia_fiscal"].ToString();
                    ////this.txtLocalidad.Text = dr["Localidad_fiscal"].ToString();
                    //this.txtTelefono.Text = dr["Telefono"].ToString();
                    //this.txtEmail.Text = dr["Email"].ToString();
                    //if (dr["vehiculo_activo"].ToString() == "1")
                    //{
                    //    this.chkActivo.Checked = true;
                    //}
                    //else
                    //{
                    //    this.chkActivo.Checked = false;
                    //}
                }
                //this.btnNuevoTool.Enabled = true;
                this.btnAddTool.Enabled       = false;
                this.btnModificarTool.Enabled = true;
                this.btnEliminarTool.Enabled  = true;
            }
            else
            {
                nuevoItem();
                //this.btnNuevoTool.Enabled = true;
            }
        }
Exemple #14
0
        private void addItem()
        {
            clsFunciones clsFunc   = new clsFunciones();
            String       respuesta = String.Empty;
            clsSQL       clsSQL    = new clsSQL();
            int          activo    = 0;


            if (this.chkActivo.Checked == true)
            {
                activo = 1;
            }



            respuesta = clsSQL.ejecutarSP("SP_Man_Clientes", "@opcion=1=System.Int32",
                                          "@id_key_cliente=0=System.Int32",
                                          "@CIF=" + this.txtCIF.Text.Trim() + "=System.String",
                                          "@Nombre=" + this.txtNombre.Text.Trim() + "=System.String",
                                          "@Direccion_fiscal=" + this.txtDireccion.Text.Trim() + "=System.String",
                                          "@id_key_provincia_fiscal=" + this.cmbProvincias.SelectedValue + "=System.Int32",
                                          "@pais_fiscal=spain=System.String",
                                          "@CP_fiscal=0=System.Int32",
                                          "@Direccion_postal=" + this.txtDireccion.Text.Trim() + "=System.String",
                                          "@id_key_provincia_postal=" + this.cmbProvincias.SelectedValue + "=System.Int32",
                                          "@pais_postal=spain=System.String",
                                          "@CP_postal=0=System.Int32",
                                          "@Telefono=" + this.txtTelefono.Text.Trim() + "=System.String",
                                          "@Fax=" + this.txtTelefono.Text.Trim() + "=System.String",
                                          "@Email=" + this.txtEmail.Text.Trim() + "=System.String",
                                          "@web=" + this.txtEmail.Text.Trim() + "=System.String",
                                          "@notas=" + this.txtEmail.Text.Trim() + "=System.String");
            if (respuesta != "OK")
            {
                MessageBox.Show("Error al crear el registro.", mdPrincipal.Error_SQL, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                MessageBox.Show("Registro añadido correctamente.");
            }

            this.Close();
        }
Exemple #15
0
        public void recogerDatos(int _id_key_cliente)
        {
            clsFunciones clsFunc = new clsFunciones();
            clsSQL       clsSQL  = new clsSQL();
            DataTable    dt      = new DataTable();

            if (_id_key_cliente != 0)
            {
                dt = clsSQL.devolverDataTable("select * from Clientes where id_key_cliente = " + _id_key_cliente.ToString());
                this.id_key_cliente = _id_key_cliente;



                foreach (DataRow dr in dt.Rows)
                {
                    id_key_cliente         = dr.Field <int>("id_key_cliente");
                    this.txtCIF.Text       = dr.Field <string>("CIF");
                    this.txtNombre.Text    = dr.Field <string>("Nombre");
                    this.txtDireccion.Text = dr["Direccion_fiscal"].ToString();
                    //this.cmbProvincias.SelectedValue = dr["Provincia_fiscal"].ToString();
                    //this.txtLocalidad.Text = dr["Localidad_fiscal"].ToString();
                    this.txtTelefono.Text = dr["Telefono"].ToString();
                    this.txtEmail.Text    = dr["Email"].ToString();
                    //if (dr["vehiculo_activo"].ToString() == "1")
                    //{
                    //    this.chkActivo.Checked = true;
                    //}
                    //else
                    //{
                    //    this.chkActivo.Checked = false;
                    //}
                }
                //this.btnNuevoTool.Enabled = true;
                this.btnAddTool.Enabled       = false;
                this.btnModificarTool.Enabled = true;
                this.btnEliminarTool.Enabled  = true;
            }
            else
            {
                nuevoItem();
                //this.btnNuevoTool.Enabled = true;
            }
        }
Exemple #16
0
        public void recogerDatos(int _id_key_empleado)
        {
            clsFunciones clsFunc = new clsFunciones();
            clsSQL       clsSQL  = new clsSQL();
            DataTable    dt      = new DataTable();

            if (_id_key_empleado != 0)
            {
                dt = clsSQL.devolverDataTable("select * from Empleados where id_key_empleado = " + _id_key_empleado.ToString());
                this.id_key_empleado = _id_key_empleado;
                foreach (DataRow dr in dt.Rows)
                {
                    this.txtNombre.Text                = dr["nombre"].ToString();
                    this.txtApellido1.Text             = dr["apellido1"].ToString();
                    this.txtApellido2.Text             = dr["apellido2"].ToString();
                    this.txtNIF.Text                   = dr["NIF"].ToString();
                    this.txtNumSS.Text                 = dr["num_SS"].ToString();
                    this.cmbPuesto.SelectedValue       = dr["id_key_puesto"].ToString();
                    this.cmbDepartamento.SelectedValue = dr["id_key_departamento"].ToString();
                    if (dr["activo"].ToString() == "1")
                    {
                        this.chkActivo.Checked = true;
                        this.fechaBaja.Enabled = false;
                    }
                    else
                    {
                        this.chkActivo.Checked = false;
                        this.fechaBaja.Value   = DateTime.Parse(dr["fecha_baja"].ToString());
                    }
                    this.fechaAlta.Value = DateTime.Parse(dr["fecha_alta"].ToString());
                }
                //this.btnNuevoTool.Enabled = true;
                this.btnAddTool.Enabled       = false;
                this.btnModificarTool.Enabled = true;
                this.btnEliminarTool.Enabled  = true;
            }
            else
            {
                nuevoItem();
                //this.btnNuevoTool.Enabled = true;
            }
        }
Exemple #17
0
        public void aceptar()
        {
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            if (txtUsuario.Text == string.Empty)
            {
                MessageBox.Show("Usuario incorrecto", "Usuario incorrecto", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtUsuario.Select();
                this.DialogResult = System.Windows.Forms.DialogResult.No;
                return;
            }
            else if (txtPassword.Text == string.Empty)
            {
                MessageBox.Show("Password incorrecto", "Password incorrecto", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtPassword.Select();
                this.DialogResult = System.Windows.Forms.DialogResult.No;
                return;
            }
            else
            {
                // Ir a formulario principal
                clsSQL clsSQL = new clsSQL();
                existe = clsSQL.existeConsulta("select usuario from usuarios where usuario = '" + txtUsuario.Text + "' and password = '******' AND ESTADO = 'A'");
                if (existe == false)
                {
                    MessageBox.Show("Fallo de acceso", "Fallo de identificación", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtUsuario.Select();
                    this.DialogResult = System.Windows.Forms.DialogResult.No;
                }
                else
                {
                    clsFunciones Fun = new clsFunciones();
                    mdPrincipal.Id_Usuario          = Convert.ToInt32(clsSQL.devolverUnParametro("usuarios where usuario = '" + txtUsuario.Text + "'", "id_key_usuario"));
                    mdPrincipal.Id_Key_Departamento = Convert.ToInt32(clsSQL.devolverUnParametro("usuarios where usuario = '" + txtUsuario.Text + "'", "id_key_departamento"));
                    mdPrincipal.Usuario             = this.txtUsuario.Text;

                    //Fun.grabarLogUsuario("Logon Aplicación", "Usuario : " + mdPrincipal.Usuario);
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    respuesta         = true;
                }
            }
        }
        public void recogerDatos(int _id_key_vehiculo)
        {
            clsFunciones clsFunc = new clsFunciones();
            clsSQL       clsSQL  = new clsSQL();
            DataTable    dt      = new DataTable();

            if (_id_key_vehiculo != 0)
            {
                dt = clsSQL.devolverDataTable("select * from Vehiculos where id_key_vehiculo = " + _id_key_vehiculo.ToString());
                this.id_key_vehiculo = _id_key_vehiculo;
                foreach (DataRow dr in dt.Rows)
                {
                    this.txtModelo.Text                = dr["modelo"].ToString();
                    this.txtMarca.Text                 = dr["marca"].ToString();
                    this.txtNumBastidor.Text           = dr["num_bastidor"].ToString();
                    this.txtMatricula.Text             = dr["matricula"].ToString();
                    this.cmbTipoVehiculo.SelectedValue = dr["id_key_tipo_vehiculo"].ToString();
                    this.cmbTipoRuedas.SelectedValue   = dr["id_key_tipo_ruedas"].ToString();
                    if (dr["vehiculo_activo"].ToString() == "1")
                    {
                        this.chkActivo.Checked = true;
                    }
                    else
                    {
                        this.chkActivo.Checked = false;
                    }
                    this.fechaMatriculacion.Value = DateTime.Parse(dr["fecha_matriculacion"].ToString());
                }
                //this.btnNuevoTool.Enabled = true;
                this.btnAddTool.Enabled       = false;
                this.btnModificarTool.Enabled = true;
                this.btnEliminarTool.Enabled  = true;
            }
            else
            {
                nuevoItem();
                //this.btnNuevoTool.Enabled = true;
            }
        }
Exemple #19
0
        public void recogerDatos(int _id_key_ruta)
        {
            clsFunciones clsFunc = new clsFunciones();
            clsSQL       clsSQL  = new clsSQL();
            DataTable    dt      = new DataTable();

            if (_id_key_ruta != 0)
            {
                dt = clsSQL.devolverDataTable("select * from Rutas where id_key_ruta = " + _id_key_ruta.ToString());
                this.id_key_ruta = _id_key_ruta;
                foreach (DataRow dr in dt.Rows)
                {
                    this.txtDescripcion.Text = dr["descripcion"].ToString();
                    this.txtOrigen.Text      = dr["origen"].ToString();
                    this.txtDestino.Text     = dr["destino"].ToString();
                    this.txtKm.Text          = dr["destino"].ToString();
                    this.txtPrecio.Text      = dr["precio"].ToString();
                    this.txtPeajes.Text      = dr["peajes"].ToString();
                    if (dr["ruta_activa"].ToString() == "1")
                    {
                        this.chkActivo.Checked = true;
                    }
                    else
                    {
                        this.chkActivo.Checked = false;
                    }
                }
                //this.btnNuevoTool.Enabled = true;
                this.btnAddTool.Enabled       = false;
                this.btnModificarTool.Enabled = true;
                this.btnEliminarTool.Enabled  = true;
            }
            else
            {
                nuevoItem();
                //this.btnNuevoTool.Enabled = true;
            }
        }
        private void Buscar()
        {
            try
            {
                clsSQL  Consulta = new clsSQL();
                DataSet ds;
                String  strSQL   = "select * from Ruedas";
                String  txtWhere = String.Empty;

                this.grdRuedas.DataSource = null;

                ds = Consulta.devolverDataSetSelect(strSQL);

                this.grdRuedas.DataSource         = ds.Tables[0];
                this.grdRuedas.Columns[0].Visible = false;
                //this.grdVehiculos.Columns[0].Visible = false;
                ds.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), mdPrincipal.Nombre_App, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void cargaServicios(DateTime _fecha_desde, DateTime _fecha_hasta)
        {
            try
            {
                clsSQL  Consulta = new clsSQL();
                DataSet ds;
                String  strSQL   = "select id_key_servicio,fecha,hora,cliente,desde,hasta,conductor,vehiculo,menus,km,estado from v_Servicios where convert(date,fecha) between (convert(date,'" + _fecha_desde.ToShortDateString() + "')) and (convert(date,'" + _fecha_hasta.ToShortDateString() + "'))";
                String  txtWhere = String.Empty;

                this.grdAgenda.DataSource = null;

                strSQL = strSQL + txtWhere + " order by hora";

                ds = Consulta.devolverDataSetSelect(strSQL);

                this.grdAgenda.DataSource         = ds.Tables[0];
                this.grdAgenda.Columns[0].Visible = false;
                ds.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), mdPrincipal.Nombre_App, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #22
0
        private void Buscar()
        {
            try
            {
                clsSQL  Consulta = new clsSQL();
                DataSet ds;
                String  strSQL   = "select id_key_empleado,NIF,Nombre,Apellido1,Apellido2,Departamento,Puesto from v_Empleados where";
                String  txtWhere = String.Empty;

                this.grdEmpleados.DataSource = null;

                if (this.txtNombre.Text.Trim() != String.Empty)
                {
                    txtWhere = " nombre like '%" + txtNombre.Text + "%' and";
                }

                if (this.txtApellido1.Text.Trim() != String.Empty)
                {
                    txtWhere = txtWhere + " apellido1 like '%" + txtApellido1.Text + "%' and";
                }
                if (this.txtApellido2.Text.Trim() != String.Empty)
                {
                    txtWhere = txtWhere + " apellido2 like '%" + txtApellido2.Text + "%' and";
                }
                if (this.txtNIF.Text.Trim() != String.Empty)
                {
                    txtWhere = txtWhere + " NIF like '%" + txtNIF.Text + "%' and";
                }
                if (this.cmbPuesto.Text.Trim() != String.Empty)
                {
                    txtWhere = txtWhere + " id_key_puesto like '%" + cmbPuesto.SelectedValue.ToString() + "%' and";
                }
                if (this.cmbDepartamento.Text.Trim() != String.Empty)
                {
                    txtWhere = txtWhere + " id_key_departamento like '%" + cmbDepartamento.SelectedValue.ToString() + "%' and";
                }



                if (txtWhere.Trim() == String.Empty)
                {
                    strSQL = "select id_key_empleado,NIF,Nombre,Apellido1,Apellido2,Departamento,Puesto from v_Empleados";
                }

                if (txtWhere.Trim().EndsWith("and"))
                {
                    txtWhere = txtWhere.Substring(0, txtWhere.Length - 3);
                }

                strSQL = strSQL + txtWhere + " order by NIF";

                ds = Consulta.devolverDataSetSelect(strSQL);

                this.grdEmpleados.DataSource         = ds.Tables[0];
                this.grdEmpleados.Columns[0].Visible = false;
                //this.grdVehiculos.Columns[0].Visible = false;
                ds.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), mdPrincipal.Nombre_App, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }