Пример #1
0
        public void cargaUsuario(string txt)
        {
            E_estudiante _est = new E_estudiante();

            _est = _menu.obtenerDatosEst(txt);
            string nom = _est._nombre;

            lbl_nombre.Text    = nom.ToUpper();
            lbl_nombre.Visible = true;
            #region carga objeto
            txt_nombreEst.Text      = _est._nombre;
            txt_apellidoUnoEst.Text = _est._ape1;
            txt_apellidoDosEst.Text = _est._ape2;
            txt_direccionEst.Text   = _est._direccion;
            txt_emailEst.Text       = _est._email;
            msk_fechaNacEst.Text    = _est._fechaNac;
            msk_ideEst.Text         = _est._identificacion;
            msk_telefonoEst.Text    = _est._telefono;
            txt_usuEst.Text         = _est._usuario;
            txt_contraEst.Text      = _est._contrasena;
            if (_est._rol == "3")
            {
                lbl_rol.Text    = "Estudiante.";
                lbl_rol.Visible = true;
            }
            #endregion
        }
Пример #2
0
 public int mantenimientoEstudiante(E_estudiante est, int num)
 {
     try
     {
         estudiante _est = new estudiante();
         if (num != -1)
         {
             _est = db.estudiantes.Where(val => val.usuario == est._usuario).Single <estudiante>();
         }
         _est.nombreE         = est._nombre;
         _est.apellidoMaterno = est._ape1;
         _est.apellidoPaterno = est._ape2;
         _est.identificacion  = est._identificacion;
         _est.direccion       = est._direccion;
         _est.fechaNaci       = Convert.ToDateTime(est._fechaNac);
         _est.direccion       = est._direccion;
         _est.telefono        = est._telefono;
         _est.email           = est._email;
         _est.rol             = Convert.ToInt32(est._rol);
         _est.usuario         = est._usuario;
         _est.contrasena      = est._contrasena;
         if (num == -1)
         {
             _est.estado = 1;
             db.estudiantes.InsertOnSubmit(_est);
         }
         db.SubmitChanges();
         return(1);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
Пример #3
0
 public E_estudiante obtenerDatosEst(string usu)
 {
     try
     {
         E_estudiante obj = db.estudiantes.Where(val => val.usuario == usu || val.email == usu).Select(val => new E_estudiante()
         {
             _nombre         = val.nombreE,
             _ape1           = val.apellidoMaterno,
             _ape2           = val.apellidoPaterno,
             _identificacion = val.identificacion,
             _direccion      = val.direccion,
             _fechaNac       = val.fechaNaci.ToString(),
             _email          = val.email,
             _telefono       = val.telefono,
             _rol            = val.rol.ToString(),
             _usuario        = val.usuario,
             _contrasena     = val.contrasena,
         }).FirstOrDefault();
         return(obj);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Пример #4
0
        private void btn_iniciar_Click(object sender, EventArgs e)
        {
            P_login         _negLog = new P_login();
            P_menuPrincipal _menu   = new P_menuPrincipal();

            Folder_Menu.G_menuAdmin _gMenu = new Folder_Menu.G_menuAdmin();
            string resp = "";

            if (txt_usu.Text != string.Empty)
            {
                if (txt_contra.Text != string.Empty)
                {
                    resp = _negLog.inicio(txt_usu.Text.Trim(), txt_contra.Text.Trim());
                    if (resp == "1")
                    {
                        usuario = txt_usu.Text.Trim();
                        Folder_Menu.G_menuAdmin _menuPrin = new Folder_Menu.G_menuAdmin();
                        this.Hide();
                        _menuPrin.Show();
                    }
                    else if (resp == "3")
                    {
                        E_estudiante _est = new E_estudiante();
                        _est    = _menu.obtenerDatosEst(txt_usu.Text.Trim());
                        usuario = _est._usuario;
                        Folder_Estudiante.G_menuEstudiante _menuEst = new Folder_Estudiante.G_menuEstudiante();
                        this.Hide();
                        _menuEst.Show();
                    }
                    else if (resp == "2")
                    {
                        E_empleado _emple = new E_empleado();
                        _emple  = _menu.obtenerDatos(txt_usu.Text.Trim());
                        usuario = _emple._usuario;
                        Folder_Profe.G_menuProfe _menuProf = new Folder_Profe.G_menuProfe();
                        this.Hide();
                        _menuProf.Show();
                    }
                    else
                    {
                        MessageBox.Show("Sus credenciales no son correctas.");
                    }
                }
                else
                {
                    MessageBox.Show("Sus credenciales no son correctas.");
                }
            }
            else
            {
                MessageBox.Show("No pueden haber campos en blanco.");
            }
        }
Пример #5
0
 private void btn_identEstM_Click(object sender, EventArgs e)
 {
     try
     {
         E_estudiante _est = new E_estudiante();
         _est = _matricula.buscarEst(txt_usuMatEst.Text);
         if (_est == null)
         {
             MessageBox.Show("No existe el registro.");
         }
         else
         {
             txt_nomEstM.Text  = _est._nombre;
             txt_ape1EstM.Text = _est._ape1;
             txt_ape2EstM.Text = _est._ape2;
             txt_idenEstM.Text = _est._identificacion;
         }
     }
     catch (Exception)
     {
         MessageBox.Show("No existe el registro.");
     }
 }
Пример #6
0
        private void btn_guardarEst_Click(object sender, EventArgs e)
        {
            try
            {
                #region validacion
                bool _resul   = false;
                bool _estado  = true;
                bool _estado2 = true;
                bool _estado3 = true;
                bool _estado4 = true;
                foreach (char i1 in txt_nombreEst.Text)
                {
                    if (char.IsDigit(i1))
                    {
                        _estado = false;
                        break;
                    }
                }
                if (_estado == false)
                {
                    error1.SetError(txt_nombreEst, "El nombre no puede contener numeros.");
                }
                else
                {
                    error1.Clear();
                    _estado = true;
                }

                foreach (char i2 in txt_apellidoUnoEst.Text)
                {
                    if (char.IsDigit(i2))
                    {
                        _estado2 = false;
                        break;
                    }
                }
                if (_estado2 == false)
                {
                    error2.SetError(txt_apellidoUnoEst, "El apellido no puede contener numeros.");
                }
                else
                {
                    error2.Clear();
                    _estado2 = true;
                }

                foreach (char i3 in txt_apellidoDosEst.Text)
                {
                    if (char.IsDigit(i3))
                    {
                        _estado3 = false;
                        break;
                    }
                }
                if (_estado3 == false)
                {
                    error3.SetError(txt_apellidoDosEst, "El apellido no puede contener numeros.");
                }
                else
                {
                    error3.Clear();
                    _estado3 = true;
                }

                if (txt_contraEst.TextLength < 8)
                {
                    error5.SetError(txt_contraEst, "El usuario debe ser mayor a 8 caracteres.");
                    _estado4 = false;
                }
                else
                {
                    error5.Clear();
                    _estado4 = true;
                }

                if (_estado && _estado2 && _estado3 && _estado4)
                {
                    _resul = true;
                }
                else
                {
                    _resul = false;
                }
                #endregion

                if (_resul)
                {
                    E_estudiante _est = new E_estudiante();
                    int          resp = -1;
                    _est._nombre         = txt_nombreEst.Text;
                    _est._ape1           = txt_apellidoUnoEst.Text;
                    _est._ape2           = txt_apellidoDosEst.Text;
                    _est._identificacion = msk_ideEst.Text;
                    _est._direccion      = txt_direccionEst.Text;
                    _est._email          = txt_emailEst.Text;
                    _est._usuario        = txt_usuEst.Text;
                    _est._contrasena     = txt_contraEst.Text;
                    _est._telefono       = msk_telefonoEst.Text;
                    _est._fechaNac       = msk_fechaNacEst.Text;
                    _est._rol            = "3";
                    resp = _menu.insertaEstudiante(_est, 1);
                    if (resp == 1)
                    {
                        MessageBox.Show("Guardado.");
                        G_menuEstudiante_Load(sender, e);
                        txt_nombreEst.Enabled      = false;
                        txt_apellidoUnoEst.Enabled = false;
                        txt_apellidoDosEst.Enabled = false;
                        txt_direccionEst.Enabled   = false;
                        msk_telefonoEst.Enabled    = false;
                        txt_contraEst.Enabled      = false;
                        txt_emailEst.Enabled       = false;
                        btn_guardarEst.Visible     = false;
                        btn_actEst.Visible         = true;
                    }
                    else
                    {
                        MessageBox.Show("No se a logrado actualizar.");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex);
            }
        }
Пример #7
0
 public int insertaEstudiante(E_estudiante est, int numero)
 {
     return(_DEst.mantenimientoEstudiante(est, numero));
 }