private void comboBoxProductos_SelectedIndexChanged(object sender, EventArgs e) { this.textBoxCodigo.Text = string.Empty; this.textBoxCantEtiquetas.Text = string.Empty; this.textBoxUniXBulto.Text = string.Empty; this.labelDescripcionArt.Text = string.Empty; if (this.comboBoxProductos.SelectedIndex > 0) { this.textBoxCodigo.Text = this.comboBoxProductos.SelectedValue.ToString(); this.textBoxCantEtiquetas.Focus(); this.labelDescripcionArt.Text = this.comboBoxProductos.Text.ToString(); labelVto.Visible = false; dateTimeVto.Visible = false; //VERIFICO SI ESTE ARTICULO LLEVA VTO. BLL.Tables.STKARTICULOS _vto = new BLL.Tables.STKARTICULOS(); _vto.WhereParameter.Add(DAL.Tables.STKARTICULOS.ColumnEnum.articulo_id, DAL.SqlEnums.OperandEnum.Equal, textBoxCodigo.Text.ToString().Trim()); _vto.ItemList(); if (_vto.Resultset.Count > 0) { bool _llevaVto = _vto.Resultset[0].LLEVAVENCIMIENTO; if (_llevaVto) { labelVto.Visible = true; dateTimeVto.Visible = true; } else { labelVto.Visible = false; dateTimeVto.Visible = false; } } //TRAIGO LA UNIDAD DE MEDIDA DE BEJERMAN textBoxUniMedBejerman.Text = _ItemsArticulos.Find(x => x.art_codgen.Contains(this.comboBoxProductos.SelectedValue.ToString())).unimed; labelDescripUniMed.Text = _ItemsArticulos.Find(x => x.art_codgen.Contains(this.comboBoxProductos.SelectedValue.ToString())).cla_desc; } }
private void comboBoxProductos_SelectedIndexChanged(object sender, EventArgs e) { try { if (comboBoxProductos.SelectedIndex != 0) { BLL.Tables.STKARTICULOS _DescArt = new BLL.Tables.STKARTICULOS(); _DescArt.ItemList("EGES", this.comboBoxProductos.SelectedValue.ToString()); if (_DescArt.Result.Count > 0) //Verifico si tiene Algo cargado el producto { _updateProducto = 1; this.textBoxTolerancia.Text = _DescArt.Resultset[0].TOLERANCIAINGSTOCK.ToString().Replace(",", "."); this.textBoxStockMinimo.Text = _DescArt.Resultset[0].STOCKMINIMO.ToString().Replace(",", "."); this.textBoxStockMaximo.Text = _DescArt.Resultset[0].STOCKMAXIMO.ToString().Replace(",", "."); comboBoxSubCuenta.SelectedValue = _DescArt.Resultset[0].CODIGOSUBCUENTA; this.comboBoxUniMedPrimaria.SelectedValue = _DescArt.Resultset[0].UNIMEDPPAL; this.checkBoxNoRequerimiento.Checked = (_DescArt.Resultset[0].MOSTRARENREQUERIMIENTO) ? false : true; if (_DescArt.Resultset[0].UNIMEDSEC != null) { this.comboBoxUniMedSecundaria.SelectedValue = _DescArt.Resultset[0].UNIMEDSEC; this.textBoxFactorConversion.Text = _DescArt.Resultset[0].FACTORCONVERSION.ToString(); } if (_DescArt.Resultset[0].VAASTOCK == 1) { this.checkBoxVa_a_Stock.Checked = true; } else { this.checkBoxVa_a_Stock.Checked = false; } if (_DescArt.Resultset[0].TRAZABLE) { this.checkBoxTrazable.Checked = true; } else { this.checkBoxTrazable.Checked = false; } checkBoxReceta.Checked = (_DescArt.Resultset[0].LLEVARECETA) ? true : false; checkBoxVencimiento.Checked = (_DescArt.Resultset[0].LLEVAVENCIMIENTO) ? true : false; } else // Vacio los campos en caso de no tener Valores { _updateProducto = 0; this.textBoxTolerancia.Text = string.Empty; this.textBoxStockMinimo.Text = string.Empty; this.textBoxStockMaximo.Text = string.Empty; this.textBoxFactorConversion.Text = string.Empty; checkBoxReceta.Checked = false; this.checkBoxVa_a_Stock.Checked = false; this.comboBoxUniMedPrimaria.SelectedIndex = 0; this.comboBoxUniMedSecundaria.SelectedIndex = 0; comboBoxSubCuenta.SelectedIndex = 0; this.checkBoxNoRequerimiento.Checked = false; this.checkBoxTrazable.Checked = false; textBoxTolerancia.Focus(); checkBoxVencimiento.Checked = false; checkBoxReceta.Checked = false; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }