public UserAccessForm()
        {
            InitializeComponent();


            string       path       = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string       targetPath = System.IO.Path.Combine(path, "users");
            FuncionClass f          = new FuncionClass();

            try
            {
                dbserver   = f.readperfil(targetPath)[0];
                dbname     = f.readperfil(targetPath)[1];
                dbuser     = f.readperfil(targetPath)[2];
                dbpassword = f.readperfil(targetPath)[3];
                dbport     = f.readperfil(targetPath)[4];
            }
            catch (NullReferenceException er)
            {
                er.ToString();


                dbserver   = "localhost";
                dbname     = "users";
                dbuser     = "******";
                dbpassword = "******";
                dbport     = "3306";
            }


            mode = "carga";
        }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     dbport.Text     = "";
     dbserver.Text   = "";
     dbpassword.Text = "";
     dbuser.Text     = "";
     dbname.Text     = "";
     FuncionClass F = new FuncionClass();
 }
        private void UserSecurityForm_Load(object sender, EventArgs e)
        {
            picturetext.Hide();
            string dbserver   = "";
            string dbname     = "";
            string dbuser     = "";
            string dbpassword = "";
            string dbport     = "";

            string       path       = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string       targetPath = System.IO.Path.Combine(path, "users");
            FuncionClass f          = new FuncionClass();

            try
            {
                dbserver   = f.readperfil(targetPath)[0];
                dbname     = f.readperfil(targetPath)[1];
                dbuser     = f.readperfil(targetPath)[2];
                dbpassword = f.readperfil(targetPath)[3];
                dbport     = f.readperfil(targetPath)[4];
            }
            catch (NullReferenceException er)
            {
                er.ToString();
            }

            f = new FuncionClass(dbserver, dbname, dbuser, dbpassword, dbport);



            LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());

            try
            {
                string orden = "select * from users_table WHERE USER_NAME = '" + UsersShowForm.getdatum()[0] + "' AND USERTIPO = '" + UsersShowForm.getdatum()[1] + "' AND ID = '" + UsersShowForm.getdatum()[2] + "' AND FECHA_CREACION = '" + UsersShowForm.getdatum()[3] + "'; ";

                show.fillsecurity(userlabel, asklabel1, asklabel2, asklabel3, asklabel4, asklabel5, picturetext, orden);
                if (picturetext.Text != "")
                {
                    path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
                    string combinacion = System.IO.Path.Combine(path, UserAccessForm.getusername());

                    string fotopath = System.IO.Path.Combine(combinacion, picturetext.Text);
                    pictureBox.ImageLocation = fotopath;
                }
                problempanel.Hide();
                picturetext.Hide();
            }
            catch (NullReferenceException pad) {
                problempanel.Hide();
                picturetext.Hide();
                pad.ToString();
            }
        }
Beispiel #4
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            FuncionClass f     = new FuncionClass(dbserver.Text, dbname.Text, dbuser.Text, dbpassword.Text, dbport.Text);
            string       orden = "select * from users_table";

            if (f.ordensql(orden))
            {
                MessageBox.Show("BASE DE DATOS MYSQL ENLAZADA");
            }
            else
            {
                MessageBox.Show("BASE DE DATOS MYSQL NO PUDO SER ENLAZADA");
            }
        }
        private void UserAddForm_Load(object sender, EventArgs e)
        {
            picturetextbox.Hide();


            string       path       = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string       targetPath = System.IO.Path.Combine(path, "users");
            FuncionClass f          = new FuncionClass();

            try
            {
                dbserver   = f.readperfil(targetPath)[0];
                dbname     = f.readperfil(targetPath)[1];
                dbuser     = f.readperfil(targetPath)[2];
                dbpassword = f.readperfil(targetPath)[3];
                dbport     = f.readperfil(targetPath)[4];
            }
            catch (NullReferenceException er)
            {
                er.ToString();
            }

            f = new FuncionClass(dbserver, dbname, dbuser, dbpassword, dbport);
            titlelabel.Text = "AGREGAR USUARIO";


            if (UsersShowForm.getstate() == "edit")
            {
                repetlabel.Hide();
                passwordsecuritybox.Hide();
                titlelabel.Text = "MODIFICAR USUARIO";
                LoginClass show  = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                string     orden = "select * from users_table WHERE USER_NAME = '" + UsersShowForm.getdatum()[0] + "' AND USERTIPO = '" + UsersShowForm.getdatum()[1] + "' AND ID = '" + UsersShowForm.getdatum()[2] + "' AND FECHA_CREACION = '" + UsersShowForm.getdatum()[3] + "'; ";

                show.fillevery(nameBox, passwordbox, usercombo, askbox1, answerbox1, askbox2, answerbox2, askbox3, answerbox3, askbox4, answerbox4, askbox5, answerbox5, picturetextbox, institucionbox, telefonobox, emailbox, orden);
                if (picturetextbox.Text != "")
                {
                    path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
                    string combinacion = System.IO.Path.Combine(path, UserAccessForm.getusername());

                    string fotopath = System.IO.Path.Combine(combinacion, picturetextbox.Text);
                    pictureBox.ImageLocation = fotopath;
                }
            }
        }
Beispiel #6
0
        private void Databaseperfil_Load(object sender, EventArgs e)
        {
            string       path       = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string       targetPath = System.IO.Path.Combine(path, "users");
            FuncionClass f          = new FuncionClass();

            try {
                dbserver.Text   = f.readperfil(targetPath)[0];
                dbname.Text     = f.readperfil(targetPath)[1];
                dbuser.Text     = f.readperfil(targetPath)[2];
                dbpassword.Text = f.readperfil(targetPath)[3];
                dbport.Text     = f.readperfil(targetPath)[4];
            } catch (NullReferenceException er) {
                er.ToString();


                dbserver.Text   = "localhost";
                dbname.Text     = "users";
                dbuser.Text     = "root";
                dbpassword.Text = "1234";
                dbport.Text     = "3306";
            }
        }