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; } }
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; } }
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; } }
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; } }
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; } }
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; } }
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; } }
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; } }