示例#1
0
 private void Navegar(int p)
 {
     try
     {
         Nuevo = false;
         txtCo_catalogo.Enabled = false;
         using (Profit_RGEntities context = new Profit_RGEntities())
         {
             var pubi = context.pObtenerTablaStr(txtCo_catalogo.Text.Trim(), "id_cat_activo", p, "GIT_Catalogo_Activo").ToList();
             if (pubi.Count > 0)
             {
                 catalogo1            = context.pSeleccionarGIT_Catalalogo_Activo(pubi[0].Trim()).FirstOrDefault();
                 txtCo_catalogo.Text  = catalogo1.id_cat_activo;
                 txtDescripcionC.Text = catalogo1.descripcion;
                 //var Imagen = ImagenBD.BytesToImage(Usuario.ilustracion)
             }
         }
     }
     catch (EntityException ex)
     {
         MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception ex1)
     {
         MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#2
0
        private void Buscar()
        {
            try
            {
                Nuevo = false;
                using (Profit_RGEntities context = new Profit_RGEntities())
                {
                    pSeleccionarGIT_Catalalogo_Activo_Result catalogo1 = new pSeleccionarGIT_Catalalogo_Activo_Result();
                    var pubi1 = context.GIT_Catalogo_Activo.Where(o => o.id_cat_activo == txtBuscar.Text.Trim()).ToList();

                    if (pubi1.Count > 0)
                    {
                        catalogo1            = context.pSeleccionarGIT_Catalalogo_Activo(pubi1[0].id_cat_activo.Trim().ToUpper()).FirstOrDefault();
                        txtCo_catalogo.Text  = catalogo1.id_cat_activo.Trim();
                        txtDescripcionC.Text = catalogo1.descripcion.Trim();
                        txtBuscar.Text       = "";
                        txtCo_catalogo.Focus();
                    }
                    else
                    {
                        MessageBox.Show("El registro no existe", "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtBuscar.Focus();
                    }
                }
            }
            catch (EntityException ex)
            {
                MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex1)
            {
                MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }