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 bool validarGrabar() { bool bRegresa = false; CAddArticulo listaVenta = new CAddArticulo(); string sObtenerClientes = ""; decimal iTotalVenta; // int iArticulosComprados = 0; dtFechaHoy = DateTime.Now.ToString("MM/dd/yyyy H:mm"); // iArticulosComprados = Convert.ToInt32(listaVenta.iCantidad.ToString()); // string sFechaModificacion = ""; sObtenerClientes = cmb_VentaCliente.SelectedItem.ToString().Substring(0, cmb_VentaCliente.SelectedItem.ToString().IndexOf('-')).Trim(); iTotalVenta = Convert.ToDecimal(txt_VentaTotal.Text); bRegresa = CAccesoDatos.GrabarVenta(Convert.ToInt32(sObtenerClientes), iTotalVenta, iTotalArticulos, dtFechaHoy); return(bRegresa); }