public static object BuscarObjeto(TipoConsulta funcionBuscar, bool inicializado = false, bool criterioVisible = true, params object[] parametros) { object unObjeto = null; if (funcionBuscar != TipoConsulta._NoSet) { frmBuscarL frm = new frmBuscarL(); frm.FuncionBuscar = funcionBuscar.ToString(); frm.gpbCabecera.Visible = criterioVisible; //if (frm.gpbCabecera.Visible) // frm.gpbBotones.Dock = DockStyle.None; //else // frm.gpbBotones.Dock = DockStyle.Top; frm.ParamsParametros = parametros; frm.Inicializado = inicializado; frm.Text = "Buscar - " + funcionBuscar.ToString(); frm.ShowDialog(); frm.Cursor = Cursors.WaitCursor; unObjeto = frm.ObjetoSeleccionado; frm.Cursor = Cursors.Default; frm.Dispose(); } return(unObjeto); }
public static DataGridViewRow Buscar(string titulo, string cadenaSql, bool inicializado = false) { DataGridViewRow unObjeto = null; frmBuscarL frm = new frmBuscarL(); frm.cadenaSql = cadenaSql; frm.Inicializado = inicializado; frm.Text = "Buscar - " + titulo; frm.ShowDialog(); frm.Cursor = Cursors.WaitCursor; unObjeto = frm.FilaSeleccionada; frm.Cursor = Cursors.Default; frm.Dispose(); return(unObjeto); }
public static object Buscar(string modulo, string tabla, string valorWhere, string campos, string ordenar = null, bool inicializado = false) { object unObjeto = null; frmBuscarL frm = new frmBuscarL(); frm.Tabla = tabla; frm.ValorWhere = valorWhere; frm.Campos = campos; frm.Ordenar = ordenar; frm.Inicializado = inicializado; frm.Text = "Buscar - " + modulo; frm.ShowDialog(); if (frm.FilaSeleccionada == null) { return(null); } frm.Cursor = Cursors.WaitCursor; switch (modulo) { case "Barrios": { //Proveedores.BarrioPr proveedor = new Proveedores.BarrioPr(); //unObjeto = proveedor.Registro((int)frm.FilaSeleccionada.Cells[0].Value); //proveedor = null; unObjeto = (int)frm.FilaSeleccionada.Cells[0].Value; } break; case "Clientes": { //ClientePr proveedor = new ClientePr(); //unObjeto = proveedor.RegistroPorId((int)(frm.FilaSeleccionada.Cells[0].Value)); //proveedor = null; unObjeto = (int)frm.FilaSeleccionada.Cells[0].Value; } break; case "Personas": { unObjeto = PersonaPr.Instancia.Registro((int)(frm.FilaSeleccionada.Cells[0].Value)); } break; case "Beneficiarios": { unObjeto = PersonaPr.Instancia.Registro((int)frm.FilaSeleccionada.Cells[0].Value); } break; case "CuentasGrupo": { unObjeto = CuentaContablePr.Instancia.RegistroPorId((int)frm.FilaSeleccionada.Cells[0].Value); } break; case "CuentasMovimiento": { unObjeto = CuentaContablePr.Instancia.RegistroPorId((int)frm.FilaSeleccionada.Cells[0].Value); } break; case "Parroquias": { //ParroquiaPr proveedor = new ParroquiaPr(); //unObjeto = proveedor.Registro((short)frm.FilaSeleccionada.Cells[0].Value); //proveedor = null; unObjeto = (int)frm.FilaSeleccionada.Cells[0].Value; } break; case "Profesiones": { //ProfesionPr proveedor = new ProfesionPr(); //unObjeto = proveedor.Registro((short)frm.FilaSeleccionada.Cells[0].Value); //proveedor = null; unObjeto = (short)frm.FilaSeleccionada.Cells[0].Value; } break; case "Contratos": { //ContratoPr proveedor = new ContratoPr(); //unObjeto = proveedor.RegistroPorNumero((int)frm.FilaSeleccionada.Cells[0].Value); //proveedor = null; unObjeto = (int)frm.FilaSeleccionada.Cells[0].Value; } break; case "OrdenesServicio": { //ContratoPr proveedor = new ContratoPr(); //unObjeto = proveedor.RegistroPorNumero((int)frm.FilaSeleccionada.Cells[0].Value); //proveedor = null; unObjeto = (int)frm.FilaSeleccionada.Cells[0].Value; } break; case "ItemsInventario": { unObjeto = ItemInventarioPr.Instancia.Registro((int)frm.FilaSeleccionada.Cells[0].Value); //unObjeto = (int)frm.FilaSeleccionada.Cells[0].Value; } break; case "Productos": { //unObjeto = ProductoPr.Instancia.Registro((int)frm.FilaSeleccionada.Cells[0].Value); unObjeto = ProductoPr.Instancia.RegistroPorCodigo(frm.FilaSeleccionada.Cells[0].Value.ToString()); //ProductoPr proveedor = new ProductoPr(); //unObjeto = /*proveedor.RegistroPorId(*/(int)frm.FilaSeleccionada.Cells[0].Value/*)*/; } break; case "Marcas": { //unObjeto = ProductoPr.Instancia.Registro((int)frm.FilaSeleccionada.Cells[0].Value); unObjeto = MarcaPr.Instancia.RegistroPorId((int)frm.FilaSeleccionada.Cells[0].Value); //ProductoPr proveedor = new ProductoPr(); //unObjeto = /*proveedor.RegistroPorId(*/(int)frm.FilaSeleccionada.Cells[0].Value/*)*/; } break; case "FormasPago": { unObjeto = FormaPagoPr.Instancia.RegistroPorId((string)frm.FilaSeleccionada.Cells[0].Value); } break; default: break; } frm.Cursor = Cursors.Default; frm.Dispose(); return(unObjeto); }