Пример #1
0
        private void Navegar(int p)
        {
            try
            {
                Nuevo = false;
                using (Profit_RGEntities context = new Profit_RGEntities())
                {
                    pSeleccionarUsuario_Result Usuario = new pSeleccionarUsuario_Result();
                    var pusu = context.pObtenerTablaStr(txtCo_usuario.Text.Trim(), "co_usuario", p, "Usuarios").ToList();
                    if (pusu.Count > 0)
                    {
                        Usuario                = context.pSeleccionarUsuario(pusu[0].Trim()).First();
                        txtCo_usuario.Text     = Usuario.co_usuario.Trim();
                        txtNombre.Text         = Usuario.nombre.Trim();
                        txtClave.Text          = MC.GetString(Usuario.clave).ToString();
                        txtClaveR.Text         = MC.GetString(Usuario.clave).ToString();
                        cboNivel.SelectedIndex = Usuario.tipo;
                        txtRdv.Text            = Usuario.co_rdv.Trim();
                        chkP_emp.CheckState    = Usuario.p_emp == -1 ? CheckState.Unchecked : Usuario.p_emp == 0 ? CheckState.Indeterminate : CheckState.Checked;
                        chkP_nav.CheckState    = Usuario.p_nav == -1 ? CheckState.Unchecked : Usuario.p_nav == 0 ? CheckState.Indeterminate : CheckState.Checked;
                        chkP_usu.CheckState    = Usuario.p_usu == -1 ? CheckState.Unchecked : Usuario.p_usu == 0 ? CheckState.Indeterminate : CheckState.Checked;
                        chkP_con.CheckState    = Usuario.p_con == -1 ? CheckState.Unchecked : Usuario.p_con == 0 ? CheckState.Indeterminate : CheckState.Checked;
                        chkP_emp.CheckState    = Usuario.p_emp == -1 ? CheckState.Unchecked : Usuario.p_emp == 0 ? CheckState.Indeterminate : CheckState.Checked;
                        chkP_mco.CheckState    = Usuario.p_mco == -1 ? CheckState.Unchecked : Usuario.p_mco == 0 ? CheckState.Indeterminate : CheckState.Checked;
                        chkP_pst.CheckState    = Usuario.p_pst == -1 ? CheckState.Unchecked : Usuario.p_pst == 0 ? CheckState.Indeterminate : CheckState.Checked;
                        chkP_art.CheckState    = Usuario.p_art == -1 ? CheckState.Unchecked : Usuario.p_art == 0 ? CheckState.Indeterminate : CheckState.Checked;
                        ChkP_clave.CheckState  = Usuario.p_clave == -1 ? CheckState.Unchecked : Usuario.p_clave == 0 ? CheckState.Indeterminate : CheckState.Checked;
                        chkP_malm.CheckState   = Usuario.p_malm == -1 ? CheckState.Unchecked : Usuario.p_malm == 0 ? CheckState.Indeterminate : CheckState.Checked;

                        //var Imagen = ImagenBD.BytesToImage(Usuario.ilustracion);
                        Validador = Usuario.validador;
                        CargarDetalle();
                    }
                    else
                    {
                        if (Usuario.validador != null)
                        {
                            LimpiarControles();
                        }
                        else
                        {
                            Validador = null;
                        }
                    }
                }
            }
            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
            {
                using (Profit_RGEntities context = new Profit_RGEntities())
                {
                    //pSeleccionarUsuariosN_Result Usuario1 = new pSeleccionarUsuariosN_Result();
                    pSeleccionarUsuario_Result Usuario = new pSeleccionarUsuario_Result();

                    var user1 = context.Usuarios.Where(xD => xD.nombre.Trim() == txtBuscar.Text.Trim()).ToList();

                    if (user1.Count > 0)
                    {
                        CargarUsuario(user1[0].co_usuario.Trim(), context);
                        Validador = Usuario.validador;
                        CargarDetalle();
                        txtBuscar.Text = "";
                        txtCo_usuario.Focus();
                    }
                    else
                    {
                        MessageBox.Show("El registro no existe", "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        if (Usuario.validador != null)
                        {
                            LimpiarControles();
                        }
                        else
                        {
                            Validador = null;
                        }
                        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);
            }
        }
Пример #3
0
 private void Navegar(int p)
 {
     try
     {
         Nuevo = false;
         txtCo_usuario.Enabled = false;
         using (Profit_RGEntities context = new Profit_RGEntities())
         {
             pSeleccionarUsuario_Result Usuario = new pSeleccionarUsuario_Result();
             var pusu = context.pObtenerTablaStr(txtCo_usuario.Text.Trim(), "co_usuario", p, "Usuarios").ToList();
             if (pusu.Count > 0)
             {
                 CargarUsuario(pusu[0].Trim(), context);
                 CargarDetalle();
             }
             else
             {
                 if (Usuario.validador != null)
                 {
                     LimpiarControles();
                 }
                 else
                 {
                     Validador = null;
                 }
             }
         }
     }
     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);
     }
 }