private void btnBuscarCliente_Click(object sender, EventArgs e) { FormPlantillaIndex frm = null; try { frm = (FormPlantillaIndex)Activator.CreateInstance("ELRMaestros", "ELRMaestros.FormEntidadesIndex").Unwrap(); frm.empresaID = 1; frm.oficinaID = 100; frm.EsAgregar = false; frm.EsModificar = false; frm.esBusqueda = true; frm.EnEjecusion = true; frm.FiltroEstatico = ""; frm.ShowDialog(); if (frm.filaSelecionada != null) { fila0 = frm.filaSelecionada; mostrarDatoEntidad(); txtNombres.Focus(); } } catch (Exception ex) { utils.MostrarMensajeError(ex.Message); } finally { Cursor = Cursors.Default; } }
void ejecutaForm(string valor, string nombreMenu) { string MyAsembly = ""; string formulario; int menuId = 0; int modal = 0; string tipoFormulario = ""; string[] MyArray; FormPlantillaIndex frmCons = null; ELRFormRegistro frmRegistro = null; try { this.Cursor = Cursors.WaitCursor; MyArray = valor.Split(';'); formulario = MyArray[0]; MyAsembly = formulario.Split('.')[0]; menuId = int.Parse(MyArray[1]); modal = int.Parse(MyArray[2]); tipoFormulario = MyArray[3].Trim().ToUpper(); if (tipoFormulario == "C") { frmCons = (FormPlantillaIndex)Activator.CreateInstance(MyAsembly, formulario).Unwrap(); frmCons.menuId = menuId; frmCons.empresaID = empresaId; frmCons.oficinaID = oficinaId; frmCons.NOMBRE_EMPRESA = nombreEmpresa; frmCons.NOMBRE_OFICINA = nombreOficina; frmCons.nombreUsuario = nombreUsuario; frmCons.FECHA_TRABAJO = fechaTrabajo; frmCons.DTVariablesSYS = DTVariablesSYS; frmCons.DTEmpresaOficinas = DTOficinas; frmCons.DSGlobal = DSDataGlobal; frmCons.EnEjecusion = true; if (modal > 0) { frmCons.ShowDialog(); } else { frmCons.Show(); } } else { frmRegistro = (ELRFormRegistro)Activator.CreateInstance(MyAsembly, formulario).Unwrap(); frmRegistro.EMPRESA_ID = empresaId; frmRegistro.OFICINA_ID = oficinaId; frmRegistro.NOMBRE_EMPRESA_OFICINA = nombreEmpresa; frmRegistro.NOMBRE_OFICINA = nombreOficina; frmRegistro.nombreUsuario = nombreUsuario; frmRegistro.FECHA_TRABAJO = fechaTrabajo; frmRegistro.DTVariablesSYS = DTVariablesSYS; frmRegistro.DSGlobal = DSDataGlobal; frmRegistro.DTLicense = DTLicencias; frmRegistro.EnEjecusion = true; if (modal > 0) { frmRegistro.ShowDialog(); } else { frmRegistro.Show(); } } } catch (Exception) { throw; } finally { this.Cursor = Cursors.Default; if ((frmCons != null) && (modal > 0)) { frmCons.Dispose(); } if ((frmRegistro != null) && (modal > 0)) { frmRegistro.Dispose(); } } }