private void LLenarComboLocacion() { try { LocacionEN oRegistroEN = new LocacionEN(); if (cmbBodega.SelectedIndex > -1) { oRegistroEN.Where = string.Format(" and idBodega = {0} ", cmbBodega.SelectedValue); } else { oRegistroEN.Where = ""; } oRegistroEN.OrderBy = " Order by Nombre asc "; LocacionLN oRegistroLN = new LocacionLN(); if (oRegistroLN.ListadoParaCombos(oRegistroEN, Program.oDatosDeConexion)) { cmbLocacion.DataSource = oRegistroLN.TraerDatos(); cmbLocacion.DisplayMember = "Locacion"; cmbLocacion.ValueMember = "idLocacion"; cmbLocacion.DropDownWidth = 268; if (oRegistroLN.TraerDatos().Rows.Count == 1) { cmbLocacion.SelectedIndex = 0; } else { cmbLocacion.SelectedIndex = -1; } } else { throw new ArgumentException(oRegistroLN.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Informacion del estante/vitrina/caja", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void LLenarListado() { try { this.Cursor = Cursors.WaitCursor; LocacionEN oRegistrosEN = new LocacionEN(); LocacionLN oRegistrosLN = new LocacionLN(); oRegistrosEN.Where = WhereDinamico(); if (oRegistrosLN.Listado(oRegistrosEN, Program.oDatosDeConexion)) { dgvLista.Columns.Clear(); System.Diagnostics.Debug.Print(oRegistrosLN.TraerDatos().Rows.Count.ToString()); if (ActivarFiltros == true) { dgvLista.DataSource = AgregarColumnaSeleccionar(oRegistrosLN.TraerDatos()); } else { dgvLista.DataSource = oRegistrosLN.TraerDatos(); } FormatearDGV(); this.dgvLista.ClearSelection(); tsbNoRegistros.Text = "No. Registros: " + oRegistrosLN.TotalRegistros().ToString(); } else { throw new ArgumentException(oRegistrosLN.Error); } }catch (Exception ex) { MessageBox.Show(ex.Message, "Llenar listado de registro en la lista", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }