Ejemplo n.º 1
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            try
            {
                string email = tIdentificacion.Text;
                string pwd   = tPassword.Text;
                labelError.Text = "";

                //Comprobar contraseña con IDUMA
                UsuarioJSON userJSON = IDUMA.Acceso(email, pwd);
                user = new Usuario(userJSON.UserEmail);

                if (user.Email == null)
                {
                    GoRegistro(userJSON);
                }
                else
                {
                    GoPaginaPrincipal();
                }
                this.Close();
            }
            catch (Exception ex)
            {
                labelError.Text = ex.Message;
                Console.WriteLine(ex.StackTrace);
            }
        }
Ejemplo n.º 2
0
        public string GetMusicosJSON()
        {
            try
            {
                using (var db = new nosso_showEntities(Conexao.GetString()))
                {
                    List <usuario> usuarios = db.usuario.Where(x => x.Tipo == 4 && !x.Teste).OrderBy(x => x.ID).ToList();
                    var            lista    = new List <UsuarioJSON>();

                    for (int i = 0; i < usuarios.Count; i++)
                    {
                        var at = usuarios[i];

                        var u = new UsuarioJSON(at);

                        lista.Add(u);
                    }

                    return(JsonConvert.SerializeObject(lista));
                }
            }
            catch { }

            return(string.Empty);
        }
Ejemplo n.º 3
0
        private void GoRegistro(UsuarioJSON userJSON)
        {
            RegistroUMA registro = new RegistroUMA(userJSON);

            this.Visible = false;
            registro.ShowDialog();
            this.Close();
        }
Ejemplo n.º 4
0
        public RegistroUMA(UsuarioJSON userJSON)
        {
            InitializeComponent();

            this.userJSON     = userJSON;
            grados            = new List <Grado>();
            asigs             = new List <Asignatura>();
            listGrado.Enabled = false;
            listAsig.Enabled  = false;
            listPreferencias.DisplayMember = "nombre_preferencia";
            labelError.Text     = "";
            t_correoReg.Text    = userJSON.UserEmail;
            t_correoReg.Enabled = false;
            t_Nombre.Text       = userJSON.Nombre + " " + userJSON.PrimerApellido + " " + userJSON.SegundoApellido;
            t_Nombre.Enabled    = false;
            tRol.Text           = userJSON.CategoryName;
            tRol.Enabled        = false;
            if (userJSON.CategoryName.ToUpper().Equals("ESTUDIANTE") || userJSON.CategoryName.ToUpper().Equals("PDI"))
            {
                CargarGrados();
                foreach (Grado g in grados)
                {
                    CargarAsignaturas(g);
                }
            }
            //AÑADIR USUARIO A LA BD
            user          = new Usuario(userJSON.UserEmail, new Rol(userJSON.CategoryName), userJSON.Nombre, userJSON.PrimerApellido, userJSON.SegundoApellido, userJSON.Situation);
            user.Aceptado = true;
            foreach (Grado g in grados)
            {
                user.AddGrado(g);
            }
            foreach (Asignatura a in asigs)
            {
                user.AddAsignatura(a);
            }
        }