// public SqlServerDBConnection instance { get; set; } public ComprarOfertarListadoForm() { InitializeComponent(); superGrid1.PageSize = 5; comprarOfertarNegocio = new ComprarOfertarNegocio(SqlServerDBConnection.Instance()); var rubrosDt = comprarOfertarNegocio.getRubros(); rubrosListBox.DisplayMember = rubrosDt.Columns[1].ColumnName; rubrosListBox.ValueMember = rubrosDt.Columns[0].ColumnName; rubrosListBox.DataSource = rubrosDt; }
private void button1_Click(object sender, EventArgs e) { int parsedValue; if (!int.TryParse(textBox1.Text, out parsedValue)) { MessageBox.Show("Debes ingresar numeros"); return; } else if (parsedValue <= Int32.Parse(selRow.Cells["Precio"].Value.ToString())) { MessageBox.Show("La oferta debe superar el precio actual"); return; } else { var comprarOfertarNegocio = new ComprarOfertarNegocio(SqlServerDBConnection.Instance()); comprarOfertarNegocio.Ofertar(UsuarioLogueado.Instance().userId, selRow.Cells["Codigo"].Value.ToString(), parsedValue); this.Close(); } }
private void button2_Click(object sender, EventArgs e) { int parsedValue; if (!int.TryParse(textBox2.Text, out parsedValue)) { MessageBox.Show("Debes ingresar numeros"); return; } else if (parsedValue > Int32.Parse(selRow.Cells["Stock"].Value.ToString())) { MessageBox.Show("No puedes comprar esta cantidad de productos"); return; } else { var comprarOfertarNegocio = new ComprarOfertarNegocio(SqlServerDBConnection.Instance()); comprarOfertarNegocio.Comprar(UsuarioLogueado.Instance().userId, selRow.Cells["Codigo"].Value.ToString(), parsedValue); this.Close(); } }