public void fLlegarGridLocacion() { OdbcConnection odbcSql = new OdbcConnection(); OdbcDataReader reader; string sComandoSQL = "", sValor = ""; int iRenglon = 0; try{ if (CAccesoDatos.abreconexionSql(odbcSql)) { sComandoSQL = string.Format("EXECUTE ComprasMuebles.dbo.proc_abclocaciones 0,'', '',5"); reader = CAccesoDatos.ejecutarconsulta(sComandoSQL, odbcSql); while (reader.Read()) { dgvLocacion.Rows.Add(); sValor = reader[0].ToString(); dgvLocacion.Rows[iRenglon].Cells["Num Locacion"].Value = sValor.Trim(); sValor = reader[1].ToString(); dgvLocacion.Rows[iRenglon].Cells["Municipio"].Value = sValor.Trim(); sValor = reader[2].ToString(); dgvLocacion.Rows[iRenglon].Cells["Locacion"].Value = sValor.Trim(); iRenglon++; } reader.Close(); } CAccesoDatos.cierraconexionSql(odbcSql); }catch (Exception ex) { MessageBox.Show(ex.Message, "Listado Promoción", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void fObtenerConfiguracion() { OdbcConnection odbcSql = new OdbcConnection(); OdbcDataReader reader; string sComandoSQL = ""; try{ if (CAccesoDatos.abreconexionSql(odbcSql)) { sComandoSQL = string.Format("EXECUTE ComprasMuebles.dbo.proc_abconfiguracion 1, 0, 0, 0, 2"); reader = CAccesoDatos.ejecutarconsulta(sComandoSQL, odbcSql); while (reader.Read()) { txt_Enganche.Text = reader["num_enganche"].ToString(); txt_tasaFinanciamiento.Text = reader["num_tasafinanciamiento"].ToString(); lbl_ConfPlazoActual.Text = reader["num_plazomaximo"].ToString(); } reader.Close(); } CAccesoDatos.cierraconexionSql(odbcSql); }catch (Exception ex) { MessageBox.Show(ex.Message, "Listado Promoción", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void fLlenarLocaciones() { OdbcConnection odbcSql = new OdbcConnection(); OdbcDataReader reader; string sComandoSQL = ""; string sTexto = ""; try{ if (CAccesoDatos.abreconexionSql(odbcSql)) { sComandoSQL = string.Format("EXECUTE ComprasMuebles.dbo.proc_abclientes 0, 0,'',6"); reader = CAccesoDatos.ejecutarconsulta(sComandoSQL, odbcSql); // if(reader.FieldCount > 0){ // cmb_LocacionNom.Items.Add(" "); // } while (reader.Read()) { sTexto = reader[0].ToString() + " - " + reader[1].ToString(); cmb_LocacionNom.Items.Add(sTexto); } reader.Close(); } CAccesoDatos.cierraconexionSql(odbcSql); }catch (Exception ex) { MessageBox.Show(ex.Message, "ABCExhibicion", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void fObtenerConfiguracion() { OdbcConnection odbcSql = new OdbcConnection(); OdbcDataReader reader; string sComandoSQL = ""; try{ if (CAccesoDatos.abreconexionSql(odbcSql)) { sComandoSQL = string.Format("EXECUTE ComprasMuebles.dbo.proc_ventas 0, 0, 0, 0, 0, 0, 0, 10"); reader = CAccesoDatos.ejecutarconsulta(sComandoSQL, odbcSql); // if(reader.FieldCount > 0){ // cmb_LocacionNom.Items.Add(" "); // } while (reader.Read()) { dTasaFinanciamiento = Convert.ToDecimal(reader["num_tasafinanciamiento"].ToString()); iPlazoMaximo = Convert.ToInt32(reader["num_plazomaximo"].ToString()); iEnganchePorcentaje = Convert.ToInt32(reader["num_enganche"].ToString()); } reader.Close(); } CAccesoDatos.cierraconexionSql(odbcSql); }catch (Exception ex) { MessageBox.Show(ex.Message, "ABCExhibicion", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void fObtenerNombreLocacion() { OdbcConnection odbcSql = new OdbcConnection(); OdbcDataReader reader; string sComandoSQL = ""; string sTexto = ""; sTexto = cmb_VentaCliente.SelectedItem.ToString().Substring(0, cmb_VentaCliente.SelectedItem.ToString().IndexOf('-')).Trim();; try{ if (CAccesoDatos.abreconexionSql(odbcSql)) { sComandoSQL = string.Format("EXECUTE ComprasMuebles.dbo.proc_ventas 0, {0}, 0, 0, 0, 0, 0, 8", Convert.ToInt32(sTexto)); reader = CAccesoDatos.ejecutarconsulta(sComandoSQL, odbcSql); // if(reader.FieldCount > 0){ // cmb_LocacionNom.Items.Add(" "); // } while (reader.Read()) { lbl_VentasGetLocacion.Text = reader["des_locacion"].ToString(); } reader.Close(); } CAccesoDatos.cierraconexionSql(odbcSql); }catch (Exception ex) { MessageBox.Show(ex.Message, "ABCExhibicion", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public static bool BuscarArticulo(string sArticuloid, ref List <CAddArticulo> listadoArticulos) { bool bRegresa = false; string sComandoSQL = ""; int iArticuloid = 0; OdbcConnection odbcSQL = new OdbcConnection(); OdbcDataReader reader; CAddArticulo datosArticulo = new CAddArticulo(); System.Windows.Forms.Control control; if (!string.IsNullOrEmpty(sArticuloid)) { iArticuloid = Convert.ToInt32(sArticuloid); } if (CAccesoDatos.abreconexionSql(odbcSQL)) { try { sComandoSQL = string.Format("EXECUTE ComprasMuebles.dbo.proc_ventas 0, 0, 0, 0, ' ', {0}, 0, 9", iArticuloid); reader = CAccesoDatos.ejecutarconsulta(sComandoSQL, odbcSQL); while (reader.Read()) { datosArticulo = new CAddArticulo(); datosArticulo.sDescripcion = reader[0].ToString(); datosArticulo.sModelo = reader[1].ToString(); datosArticulo.iCantidad = 2; datosArticulo.dPrecio = Convert.ToDecimal(reader[2].ToString()); datosArticulo.dImporte = 0; listadoArticulos.Add(datosArticulo); bRegresa = true; } if (!bRegresa) { MessageBox.Show("El numero no es valido", "ABCExhibicion", MessageBoxButtons.OK, MessageBoxIcon.Information); bRegresa = false; } reader.Close(); } catch (Exception ex) { bRegresa = false; MessageBox.Show(ex.Message, "ABCExhibicion", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } CAccesoDatos.cierraconexionSql(odbcSQL); return(bRegresa); }
public void fLlenarGridCliente() { OdbcConnection odbcSql = new OdbcConnection(); OdbcDataReader reader; string sComandoSQL = "", sValor = ""; int iRenglon = 0; try{ if (CAccesoDatos.abreconexionSql(odbcSql)) { sComandoSQL = string.Format("EXECUTE ComprasMuebles.dbo.proc_abclientes 0, 0,'',5"); reader = CAccesoDatos.ejecutarconsulta(sComandoSQL, odbcSql); while (reader.Read()) { dgvCliente.Rows.Add(); sValor = reader[0].ToString(); dgvCliente.Rows[iRenglon].Cells["Num Cliente"].Value = sValor.Trim(); sValor = reader[1].ToString(); dgvCliente.Rows[iRenglon].Cells["Locacion"].Value = sValor.Trim(); sValor = reader[2].ToString(); dgvCliente.Rows[iRenglon].Cells["Nombre"].Value = sValor.Trim(); sValor = reader[3].ToString(); dgvCliente.Rows[iRenglon].Cells["Tipo Cliente"].Value = sValor.Trim(); sValor = reader[4].ToString(); dgvCliente.Rows[iRenglon].Cells["Articulos Comprados"].Value = sValor.Trim(); sValor = reader[5].ToString(); dgvCliente.Rows[iRenglon].Cells["Total Veces Compra"].Value = sValor.Trim(); sValor = reader[6].ToString(); dgvCliente.Rows[iRenglon].Cells["Total Compra Gneral"].Value = sValor.Trim(); sValor = reader[7].ToString(); dgvCliente.Rows[iRenglon].Cells["Regalo"].Value = sValor.Trim(); iRenglon++; } reader.Close(); } CAccesoDatos.cierraconexionSql(odbcSql); }catch (Exception ex) { MessageBox.Show(ex.Message, "Listado Promoción", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }