private void textBox1_Leave(object sender, EventArgs e) { if (textBox1.Text != "") { RegProducto lreg = new RegProducto(); lreg = lrn.mBuscarClasificacion(textBox1.Text, noClasificacion, tipocatalogo); if (lreg.Id != 0) { textBox2.Text = lreg.Nombre; } else { MessageBox.Show("Clasificacion no existe"); } } else { textBox2.Text = ""; } }
private void button1_Click(object sender, EventArgs e) { int lPtrComponente = 0; string lNombreComponente = "TDlgSeleccion" + Convert.ToChar(0); string lTituloForma = ""; string lNombreTabla = lrutaempresa; string lColumna1 = ""; string lColumna2 = ""; string lCampo = ""; string sLimite = ""; if (noClasificacion == 0) { switch (tipocatalogo) { case 4: lTituloForma = "Catálogo de Productos" + Convert.ToChar(0); lNombreTabla = lNombreTabla + @"\MGW10005"; lCampo = "cIdProducto" + Convert.ToChar(0); lColumna1 = "1,150,Código,cCodigoProducto,,iCodigoTipo" + Convert.ToChar(0); lColumna2 = "2,500,Nombre,cNombreProducto,,iNombreTipo" + Convert.ToChar(0); break; } } else { lNombreTabla = lNombreTabla + @"\MGW10020"; lCampo = "cIdValorClasificacion" + Convert.ToChar(0); lColumna1 = "1,150,Clasificación,cCodigoValorClasificacion,,icCodigoClasificacion" + Convert.ToChar(0); lColumna2 = "2,500,Descripción,cValorClasificacion,," + Convert.ToChar(0); /*switch (tipocatalogo) * { * /* * case 4: * switch (noClasificacion) * { * case 1: * lTituloForma = "Clasificacion 1 de Productos" + Convert.ToChar(0); * sLimite = "25"; * break; * case 2: * lTituloForma = "Clasificacion 2 de Productos" + Convert.ToChar(0); * sLimite = "26"; * break; * case 3: * lTituloForma = "Clasificacion 3 de Productos" + Convert.ToChar(0); * sLimite = "27"; * break; * case 4: * lTituloForma = "Clasificacion 4 de Productos" + Convert.ToChar(0); * sLimite = "28"; * break; * case 5: * lTituloForma = "Clasificacion 5 de Productos" + Convert.ToChar(0); * sLimite = "29"; * break; * case 6: * lTituloForma = "Clasificacion 6 de Productos" + Convert.ToChar(0); * sLimite = "30"; * break; * * } * break; * } */ sLimite = noClasificacion.ToString(); // necesitoo cambiarme al directorio del sdk cambiardlladmin(); lPtrComponente = MCC_CreaComponente(lNombreComponente, null); if (lPtrComponente != 0) { MCC_PonPropiedad(lPtrComponente, "TituloForma", lTituloForma, null); MCC_PonPropiedad(lPtrComponente, "Tabla", lNombreTabla, null); MCC_PonPropiedad(lPtrComponente, "Campo", lCampo, null); MCC_PonPropiedad(lPtrComponente, "CampoRegreso", "1", null); MCC_PonPropiedad(lPtrComponente, "NumeroColumnas", "2", null); MCC_PonPropiedad(lPtrComponente, "Columna", lColumna1, null); MCC_PonPropiedad(lPtrComponente, "Columna", lColumna2, null); MCC_PonPropiedad(lPtrComponente, "Alias", "", null); if (noClasificacion != 0) { MCC_PonPropiedad(lPtrComponente, "CampoRango", "cIdClasificacion", null); MCC_PonPropiedad(lPtrComponente, "LimiteInferior", sLimite, null); MCC_PonPropiedad(lPtrComponente, "LimiteSuperior", sLimite, null); } MCC_EjecutaMetodo(lPtrComponente, "Ejecuta", 0, null, null); StringBuilder lBuffer = new StringBuilder(256); MCC_PidePropiedad(lPtrComponente, "ValorColumna", lBuffer); MCC_DestruyeComponente(lPtrComponente); textBox1.Text = lBuffer.ToString(); if (textBox1.Text != "") { //RegProducto lreg = lrn.mBuscarProducto(textBox1.Text); RegProducto lreg1 = lrn.mBuscarClasificacion(textBox1.Text, int.Parse(sLimite), tipocatalogo); textBox2.Text = lreg1.Nombre; } else { textBox2.Text = ""; } // MessageBox.Show(lBuffer.ToString()); } } }