Exemplo n.º 1
0
 public CreacionCurso(Cuenta u, int t)
 {
     user = u;
     tipo = t;
     InitializeComponent();
 }
Exemplo n.º 2
0
        private void actualizarCuenta()
        {
            switch (tipo)
            {
            case 0:
                tipoidCuenta = "id_Invitado";
                tipotabla    = "Invitado";
                break;

            case 1:
                tipoidCuenta = "id_Alumno";
                tipotabla    = "Alumno";
                break;

            case 2:
                tipoidCuenta = "id_Docente";
                tipotabla    = "Docente";
                break;

            case 3:
                tipoidCuenta = "id_Ong";
                tipotabla    = "Ong";
                break;

            default:
                tipoidCuenta = "id_Admin";
                tipotabla    = "Admin";
                break;
            }
            try
            {
                if (tipo > 0)
                {
                    user = new Cuenta(user.id);
                    MySQLDB  miBD  = new MySQLDB();
                    object[] tupla = miBD.Select("SELECT email FROM " + tipotabla + " where " + tipoidCuenta + " = " + user.Id + ";")[0];
                    lEmail.Visible = true;
                    bEmail.Visible = true;
                    email          = (string)tupla[0];
                    lEmail.Text    = "Tu Email es: " + email;

                    if (tipo == 2 || tipo == 3)
                    {
                        lTlfn.Visible = true;
                        bTlfn.Visible = true;
                        object[] tupla2 = miBD.Select("SELECT telefono FROM " + tipotabla + " where " + tipoidCuenta + " = " + user.Id + ";")[0];
                        telefono   = (string)tupla2[0];
                        lTlfn.Text = "Tu Telefono es: " + telefono;

                        if (tipo == 3)
                        {
                            lDireccion.Visible = true;
                            bDirección.Visible = true;
                            object[] tupla3 = miBD.Select("SELECT direccion FROM Ong where " + tipoidCuenta + " = " + user.Id + ";")[0];
                            direccion       = (string)tupla3[0];
                            lDireccion.Text = "Tu Direccion es: " + direccion;
                        }
                    }
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            lNombre.Text = "Nombre de usuario: " + user.nombre;
            String tp;

            switch (tipo)
            {
            case 0:
                tp = "Invitado";
                break;

            case 1:
                tp = "Alumno";
                break;

            case 2:
                tp = "Docente";
                break;

            case 3:
                tp = "ONG";
                break;

            default:
                tp = "Administrador";
                break;
            }
            lTipo.Text = "Tipo de cuenta: " + tp;
        }