private void fillForm() { conexionSql.Conectar(); SqlCommand cmd = new SqlCommand("select * from PROVEEDOR where IDPROVEEDOR = '" + txtID.Text + "'", conexionSql.getConnection()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { txtNombre.Text = reader.GetString(2); txtDireccion.Text = reader.GetString(6); comboIDType.SelectedItem = reader.GetString(1); comboStatus.SelectedIndex = Convert.ToInt32(reader.GetBoolean(7)); if (!reader.IsDBNull(3)) { txtContacto.Text = reader.GetString(3); } if (!reader.IsDBNull(4)) { txtTelf.Text = reader.GetString(4); } if (!reader.IsDBNull(5)) { txtEmail.Text = reader.GetString(5); } } conexionSql.Desconectar(); }
private void fillForm() { conexionSql.Conectar(); SqlCommand cmd = new SqlCommand("select * from FACTURA where IDFACTURA = '" + factura + "'", conexionSql.getConnection()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { txtCliente.Text = reader.GetString(2); txtVendedor.Text = reader.GetString(1); lblTotal.Text = decimal.Round(reader.GetDecimal(8), 2, MidpointRounding.AwayFromZero).ToString(); lblIVA.Text = decimal.Round(reader.GetDecimal(10), 2, MidpointRounding.AwayFromZero).ToString(); lblSubT.Text = decimal.Round(reader.GetDecimal(9), 2, MidpointRounding.AwayFromZero).ToString(); dateTimeHoy.Value = reader.GetDateTime(3); if (!reader.IsDBNull(6)) { txtNumero.Text = reader.GetString(6); } if (!reader.IsDBNull(7)) { txtObservacion.Text = reader.GetString(7); } } conexionSql.Desconectar(); txtCliente.Text = getNomCliente(txtCliente.Text); txtVendedor.Text = getNomVendedor(txtVendedor.Text); }
private void fillForm() { conexionSql.Conectar(); SqlCommand cmd = new SqlCommand("select * from USUARIO where USUARIO = '" + txtUsuario.Text + "'", conexionSql.getConnection()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { txtNombre.Text = reader.GetString(2); txtContrasenia.Text = "Ingrese nueva contraseña"; comboEstado.SelectedIndex = Convert.ToInt32(reader.GetBoolean(16)); chkClienteL.Checked = reader.GetBoolean(3); chkClienteE.Checked = reader.GetBoolean(4); chkProveedorL.Checked = reader.GetBoolean(5); chkProveedorE.Checked = reader.GetBoolean(6); chkInventarioL.Checked = reader.GetBoolean(7); chkInventarioE.Checked = reader.GetBoolean(8); chkFacturaL.Checked = reader.GetBoolean(9); chkFacturaE.Checked = reader.GetBoolean(10); chkVendedorL.Checked = reader.GetBoolean(11); chkVendedorE.Checked = reader.GetBoolean(12); chkAdministracionL.Checked = reader.GetBoolean(13); chkAdministracionE.Checked = reader.GetBoolean(14); } conexionSql.Desconectar(); }
private void fillForm() { conexionSql.Conectar(); SqlCommand cmd = new SqlCommand("select * from CARRERA_GIRON where ID_CARRERA = '" + txtID.Text + "'", conexionSql.getConnection()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { txtNombre.Text = reader.GetString(1); numericSemestres.Value = reader.GetInt32(2); } conexionSql.Desconectar(); }
private void fillForm() { conexionSql.Conectar(); SqlCommand cmd = new SqlCommand("select * from GRUPOTALLACOLOR where NOMBREGTC = '" + txtNombre.Text + "'", conexionSql.getConnection()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { txtTallas.Text = reader.GetString(1); txtColores.Text = reader.GetString(2); } conexionSql.Desconectar(); }
private void fillForm() { conexionSql.Conectar(); SqlCommand cmd = new SqlCommand("select * from USUARIO where USUARIO = '" + txtUsuario.Text + "'", conexionSql.getConnection()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { txtNombre.Text = reader.GetString(2); txtContrasenia.Text = "Ingrese nueva contraseña"; } conexionSql.Desconectar(); }
private void fillForm() { conexionSql.Conectar(); SqlCommand cmd = new SqlCommand("select * from PARAMETROS", conexionSql.getConnection()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { txtClienteDefecto.Text = reader.GetString(2); numericIVA.Value = reader.GetDecimal(1) * 100; } conexionSql.Desconectar(); }
private void fillComboArticulo(string nomProv) { conexionSql.Conectar(); string query = "select NOMBREART from articuloProv where NOMBRE = '" + nomProv + "'"; SqlCommand sqlCmd = new SqlCommand(query, conexionSql.getConnection()); SqlDataReader sqlReader = sqlCmd.ExecuteReader(); while (sqlReader.Read()) { comboArticulo.Items.Add(sqlReader["NOMBREART"].ToString()); } sqlReader.Close(); conexionSql.Desconectar(); }
private void fillComboProveedor() { conexionSql.Conectar(); string query = "select NOMBRE from PROVEEDOR"; SqlCommand sqlCmd = new SqlCommand(query, conexionSql.getConnection()); SqlDataReader sqlReader = sqlCmd.ExecuteReader(); while (sqlReader.Read()) { comboProveedor.Items.Add(sqlReader["NOMBRE"].ToString()); } sqlReader.Close(); conexionSql.Desconectar(); }
public void initGridView() { conexionSql.Conectar(); string query = "select * from vistaArticulo"; var dataAdapter = new SqlDataAdapter(query, conexionSql.getConnection()); var ds = new DataTable(); dataAdapter.Fill(ds); BindingSource bsSource = new BindingSource(); bsSource.DataSource = ds; gridViewArticulo.ReadOnly = true; gridViewArticulo.DataSource = bsSource; conexionSql.Desconectar(); gridViewArticulo.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; gridViewArticulo.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; if (tipo.Equals("Desincorporar") || tipo.Equals("Reincorporar")) { comboBusqueda.Items.RemoveAt(2); var bd = (BindingSource)gridViewArticulo.DataSource; var dt = (DataTable)bd.DataSource; if (tipo.Equals("Desincorporar")) { dt.DefaultView.RowFilter = string.Format(gridViewArticulo.Columns[2].DataPropertyName + " like '%{0}%'", "Activo"); } else { dt.DefaultView.RowFilter = string.Format(gridViewArticulo.Columns[2].DataPropertyName + " like '%{0}%'", "Ina"); } gridViewArticulo.Refresh(); } }
public void initGridView() { conexionSql.Conectar(); string query = "select * from vistaFactura"; var dataAdapter = new SqlDataAdapter(query, conexionSql.getConnection()); var ds = new DataTable(); dataAdapter.Fill(ds); BindingSource bsSource = new BindingSource(); bsSource.DataSource = ds; gridViewFactura.ReadOnly = true; gridViewFactura.DataSource = bsSource; conexionSql.Desconectar(); gridViewFactura.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; gridViewFactura.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; if (tipo.Equals("Emitir")) { comboBusqueda.Items.RemoveAt(3); var bd = (BindingSource)gridViewFactura.DataSource; var dt = (DataTable)bd.DataSource; dt.DefaultView.RowFilter = string.Format(gridViewFactura.Columns[3].DataPropertyName + " like '%{0}%'", "No"); gridViewFactura.Refresh(); } }
private void fillForm() { conexionSql.Conectar(); SqlCommand cmd = new SqlCommand("select * from VENDEDOR where IDVENDEDOR = '" + txtID.Text + "'", conexionSql.getConnection()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { txtNombre.Text = reader.GetString(1); comboStatus.SelectedIndex = Convert.ToInt32(reader.GetBoolean(4)); numericDesdeN1.Value = reader.GetDecimal(5); numericDesdeN2.Value = reader.GetDecimal(8); numericDesdeN3.Value = reader.GetDecimal(11); numericDesdeN4.Value = reader.GetDecimal(14); numericDesdeN5.Value = reader.GetDecimal(17); numericHastaN1.Value = reader.GetDecimal(6); numericHastaN2.Value = reader.GetDecimal(9); numericHastaN3.Value = reader.GetDecimal(12); numericHastaN4.Value = reader.GetDecimal(15); numericHastaN5.Value = reader.GetDecimal(18); numericPorcentajeN1.Value = reader.GetDecimal(7); numericPorcentajeN2.Value = reader.GetDecimal(10); numericPorcentajeN3.Value = reader.GetDecimal(13); numericPorcentajeN4.Value = reader.GetDecimal(16); numericPorcentajeN5.Value = reader.GetDecimal(19); if (!reader.IsDBNull(2)) { txtTelefono.Text = reader.GetString(2); } if (!reader.IsDBNull(3)) { txtDireccion.Text = reader.GetString(3); } } conexionSql.Desconectar(); }
private string getNombreCarrera() { string id = ""; conexionSql.Conectar(); SqlCommand cmd = new SqlCommand("select [Nombre Carrera] from materiaCarreraGiron where [Nombre Materia] = '" + this.id + "'", conexionSql.getConnection()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { id = reader.GetString(0); } conexionSql.Desconectar(); return(id); }
private void initGridView() { conexionSql.Conectar(); string query = "select * from vistaProveedor"; var dataAdapter = new SqlDataAdapter(query, conexionSql.getConnection()); var ds = new DataTable(); dataAdapter.Fill(ds); BindingSource bsSource = new BindingSource(); bsSource.DataSource = ds; gridViewProveedor.ReadOnly = true; gridViewProveedor.DataSource = bsSource; conexionSql.Desconectar(); gridViewProveedor.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; gridViewProveedor.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; }
private void fillComboProfesor() { comboProfesor.Items.Clear(); conexionSql.Conectar(); string query = "select [Nombre Profesor] from profesorNombreGiron where not [Nombre Profesor] in (Select [Nombre Profesor] from profesorMateriaGiron where NOMBRE = '" + id + "') order by [Nombre Profesor]"; SqlCommand sqlCmd = new SqlCommand(query, conexionSql.getConnection()); SqlDataReader sqlReader = sqlCmd.ExecuteReader(); while (sqlReader.Read()) { comboProfesor.Items.Add(sqlReader["Nombre Profesor"].ToString()); } sqlReader.Close(); conexionSql.Desconectar(); }
private int getIDCarrera(string carrera) { int id = 0; conexionSql.Conectar(); SqlCommand cmd = new SqlCommand("select ID_CARRERA from CARRERA_GIRON where NOMBRE = '" + carrera + "'", conexionSql.getConnection()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { id = reader.GetInt32(0); } conexionSql.Desconectar(); return(id); }
private void fillComboCarrera() { comboCarrera.Items.Clear(); conexionSql.Conectar(); string query = "select NOMBRE from CARRERA_GIRON"; SqlCommand sqlCmd = new SqlCommand(query, conexionSql.getConnection()); SqlDataReader sqlReader = sqlCmd.ExecuteReader(); while (sqlReader.Read()) { comboCarrera.Items.Add(sqlReader["NOMBRE"].ToString()); } sqlReader.Close(); conexionSql.Desconectar(); }
private void fillComboCategoria() { comboCategoria.Items.Clear(); conexionSql.Conectar(); string query = "select NOM_CAT from CATEGORIA"; SqlCommand sqlCmd = new SqlCommand(query, conexionSql.getConnection()); SqlDataReader sqlReader = sqlCmd.ExecuteReader(); while (sqlReader.Read()) { comboCategoria.Items.Add(sqlReader["NOM_CAT"].ToString()); } sqlReader.Close(); conexionSql.Desconectar(); }
private void initGridView() { conexionSql.Conectar(); string query = "select * from vistaVendedor"; var dataAdapter = new SqlDataAdapter(query, conexionSql.getConnection()); var ds = new DataTable(); dataAdapter.Fill(ds); BindingSource bsSource = new BindingSource(); bsSource.DataSource = ds; gridViewVendedor.ReadOnly = true; gridViewVendedor.DataSource = bsSource; conexionSql.Desconectar(); gridViewVendedor.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; gridViewVendedor.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; var bd = (BindingSource)gridViewVendedor.DataSource; var dt = (DataTable)bd.DataSource; dt.DefaultView.RowFilter = string.Format(gridViewVendedor.Columns[2].DataPropertyName + " not like '%{0}%'", "Ina"); gridViewVendedor.Refresh(); }