private void toolStripButton2_Click(object sender, EventArgs e)
        {
            DireccionGestor.setcloseshowuser();
            if (DireccionGestor.getorigen() == "" || DireccionGestor.getorigen() == null || DireccionGestor.getorigen() == "out")
            {
                UserAccessForm menu = new UserAccessForm();
                //menu.WindowState = FormWindowState.Normal;
                menu.Show();

                LoginClass save = new LoginClass();
                // this.Close();
            }
            else if (DireccionGestor.getorigen() == "buscador" || UsersShowForm.getstate() == "edit")
            {
                UsersShowForm menu = new UsersShowForm();
                //menu.WindowState = FormWindowState.Maximized;
                menu.Show();
                LoginClass save = new LoginClass();
                // this.Hide();
            }
            else if (DireccionGestor.getorigen() == "inicio")
            {
                DireccionGestor menu = new DireccionGestor();

                //menu.WindowState = FormWindowState.Maximized;
                menu.Show();
                LoginClass save = new LoginClass();
                // this.Hide();
            }

            this.Close();
        }
예제 #2
0
 private void verUsuariosToolStripMenuItem_Click(object sender, EventArgs e)
 {
     showuser             = new UsersShowForm();
     showuser.WindowState = FormWindowState.Maximized;
     showuser.Show();
     this.Close();
 }
        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();
            }
        }
        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;
                }
            }
        }
예제 #5
0
        private void userPasswordForm_Load(object sender, EventArgs e)
        {
            try {
                picturetext.Hide();
                OKbutton.BackColor     = Color.Green;
                cancelbutton.BackColor = Color.Red;
                userlabel.Text         = UsersShowForm.getdatum()[0];
                tipolabel.Text         = UsersShowForm.getdatum()[1];
                LoginClass show  = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                string     orden = "select * from  USERS_TABLE where USER_NAME = '" + userlabel.Text + "';";
                show.fillpic(picturetext, orden);


                if (picturetext.Text != "")
                {
                    string path        = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
                    string combinacion = System.IO.Path.Combine(path, "users");
                    string fotopath    = System.IO.Path.Combine(combinacion, picturetext.Text);
                    pictureBox.ImageLocation = fotopath;
                }

                if (UsersShowForm.getstate() == "change")
                {
                    seguridadlabel.Text = "CAMBIAR CONTRASEÑA";
                }
                else
                {
                    seguridadlabel.Text = "CONTROL DE SEGURIDAD";
                    newlabel.Hide();
                    newpasstextbox.Hide();
                }
            }
            catch (ArgumentNullException pap) {
                pap.ToString();
                MessageBox.Show("TIENE QUE SELECCIONAR UN USUARIO PARA EJECUTAR LAS FUNCIONES DEL MENU");
            }
            catch (NullReferenceException pap)
            {
                pap.ToString();
                MessageBox.Show("TIENE QUE SELECCIONAR UN USUARIO PARA EJECUTAR LAS FUNCIONES DEL MENU");
            }
        }
        private void savebuttonstrip_Click(object sender, EventArgs e)
        {
            int hour  = DateTime.Now.Hour;
            int min   = DateTime.Now.Minute;
            int sec   = DateTime.Now.Second;
            int day   = DateTime.Now.Day;
            int month = DateTime.Now.Month;
            int year  = DateTime.Now.Year;


            string fecha = day.ToString() + "/" + month.ToString() + "/" + year.ToString();
            string hora  = hour.ToString() + ":" + min.ToString() + ":" + sec.ToString();

            carga men = new carga();

            men.WindowState = FormWindowState.Normal;
            men.Show();
            LoginClass save = new LoginClass(dbserver, dbname, dbuser, dbpassword, dbport);

            if (UsersShowForm.getstate() == "edit")
            {
                if (nameBox.Text == "" || passwordbox.Text == "" || usercombo.Text == "" || askbox1.Text == "" || answerbox1.Text == "" || askbox2.Text == "" || answerbox2.Text == "" || askbox3.Text == "" || answerbox3.Text == "" || askbox4.Text == "" || answerbox4.Text == "" || askbox5.Text == "" || answerbox5.Text == "")
                {
                    men.Close();
                    if (nameBox.Text == "")
                    {
                        nameBox.BackColor = Color.Red;
                    }
                    else
                    {
                        nameBox.BackColor = Color.Green;
                    }
                    if (passwordbox.Text == "")
                    {
                        passwordbox.BackColor = Color.Red;
                    }
                    else
                    {
                        passwordbox.BackColor = Color.Green;
                    }
                    if (usercombo.Text == "")
                    {
                        usercombo.BackColor = Color.Red;
                    }
                    else
                    {
                        usercombo.BackColor = Color.Green;
                    }

                    if (askbox1.Text == "")
                    {
                        askbox1.BackColor = Color.Red;
                    }
                    else
                    {
                        askbox1.BackColor = Color.Green;
                    }
                    if (answerbox1.Text == "")
                    {
                        answerbox1.BackColor = Color.Red;
                    }
                    else
                    {
                        answerbox1.BackColor = Color.Green;
                    }

                    if (askbox2.Text == "")
                    {
                        askbox2.BackColor = Color.Red;
                    }
                    else
                    {
                        askbox2.BackColor = Color.Green;
                    }
                    if (answerbox2.Text == "")
                    {
                        answerbox2.BackColor = Color.Red;
                    }
                    else
                    {
                        answerbox2.BackColor = Color.Green;
                    }

                    if (askbox3.Text == "")
                    {
                        askbox3.BackColor = Color.Red;
                    }
                    else
                    {
                        askbox3.BackColor = Color.Green;
                    }
                    if (answerbox3.Text == "")
                    {
                        answerbox3.BackColor = Color.Red;
                    }
                    else
                    {
                        answerbox3.BackColor = Color.Green;
                    }

                    if (askbox4.Text == "")
                    {
                        askbox4.BackColor = Color.Red;
                    }
                    else
                    {
                        askbox4.BackColor = Color.Green;
                    }
                    if (answerbox4.Text == "")
                    {
                        answerbox4.BackColor = Color.Red;
                    }
                    else
                    {
                        answerbox4.BackColor = Color.Green;
                    }

                    if (askbox5.Text == "")
                    {
                        askbox5.BackColor = Color.Red;
                    }
                    else
                    {
                        askbox5.BackColor = Color.Green;
                    }
                    if (answerbox5.Text == "")
                    {
                        answerbox5.BackColor = Color.Red;
                    }
                    else
                    {
                        answerbox5.BackColor = Color.Green;
                    }

                    if (institucionbox.Text == "")
                    {
                        institucionbox.BackColor = Color.Red;
                    }
                    else
                    {
                        institucionbox.BackColor = Color.Green;
                    }
                    if (telefonobox.Text == "")
                    {
                        telefonobox.BackColor = Color.Red;
                    }
                    else
                    {
                        telefonobox.BackColor = Color.Green;
                    }
                    if (emailbox.Text == "")
                    {
                        emailbox.BackColor = Color.Red;
                    }
                    else
                    {
                        emailbox.BackColor = Color.Green;
                    }
                    MessageBox.Show("HAY DATOS IMPORTANTES VACIOS");
                }
                else
                {
                    string name        = nameBox.Text;
                    string password    = passwordbox.Text;
                    string usertipo    = usercombo.Text;
                    string ask1        = askbox1.Text;
                    string answer1     = answerbox1.Text;
                    string ask2        = askbox2.Text;
                    string answer2     = answerbox2.Text;
                    string ask3        = askbox3.Text;
                    string answer3     = answerbox3.Text;
                    string ask4        = askbox4.Text;
                    string answer4     = answerbox4.Text;
                    string ask5        = askbox5.Text;
                    string answer5     = answerbox5.Text;
                    string foto        = picturetextbox.Text;
                    string email       = emailbox.Text;
                    string telefono    = telefonobox.Text;
                    string institucion = institucionbox.Text;
                    string orden       = "UPDATE users_table SET USER_NAME= '" + name + "', USER_PASSWORD='******', USERTIPO='" + usertipo + "', QUESTION1='" + ask1 + "',ANSWER1='" + answer1 + "', QUESTION2='" + ask2 + "',ANSWER2='" + answer2 + "',QUESTION3='" + ask3 + "',ANSWER3='" + answer3 + "',QUESTION4='" + ask4 + "',ANSWER4='" + answer4 + "',QUESTION5='" + ask5 + "',ANSWER5='" + answer5 + "',PICTURE_ROUTE='" + picturetextbox.Text + "' ,INSTITUCION='" + institucion + "',TELEFONO='" + telefono + "',EMAIL='" + email + "' WHERE USER_NAME = '" + UsersShowForm.getdatum()[0] + "' AND USERTIPO = '" + UsersShowForm.getdatum()[1] + "' AND ID = '" + UsersShowForm.getdatum()[2] + "' AND FECHA_CREACION = '" + UsersShowForm.getdatum()[3] + "'; ";
                    save.ordensql(orden);
                    men.Close();
                    MessageBox.Show("USUARIO " + UsersShowForm.getdatum()[0] + " HA SIDO MODIFICADO");
                    if (UserAccessForm.getusername() != nameBox.Text)
                    {
                        UserAccessForm add = new UserAccessForm();
                        add.WindowState = FormWindowState.Maximized;
                        add.Show();
                        this.Close();
                    }
                    else
                    {
                        UsersShowForm add = new UsersShowForm();
                        add.WindowState = FormWindowState.Maximized;
                        add.Show();
                        this.Close();
                    }
                }
            }
            else
            {
                if (save.UserNoCopied(nameBox.Text) == true)
                {
                    men.Close();
                    MessageBox.Show("El usuario " + nameBox.Text + " ya existe");
                    if (MessageBox.Show("Agregar a otro usuario?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                    {
                        save = new LoginClass();

                        DireccionGestor menu = new DireccionGestor();
                        menu.WindowState = FormWindowState.Normal;
                        menu.Show();
                        this.Close();
                    }
                    else
                    {
                        save = new LoginClass();
                        UserAddForm menu = new UserAddForm();
                        menu.WindowState = FormWindowState.Normal;
                        menu.Show();
                        this.Close();
                    }
                }
                else if (save.UserNoCopied(nameBox.Text) == false)
                {
                    if (passwordbox.Text != passwordsecuritybox.Text)
                    {
                        men.Close();
                        MessageBox.Show("LAS CONTRASEÑAS NO COINCIDEN");
                    }

                    else
                    {
                        if (nameBox.Text == "" || passwordbox.Text == "" || passwordsecuritybox.Text == "" || askbox1.Text == "" || askbox2.Text == "" || askbox3.Text == "" || askbox4.Text == "" || askbox5.Text == "" || answerbox1.Text == "" || answerbox2.Text == "" || answerbox3.Text == "" || answerbox4.Text == "" || answerbox5.Text == "" || emailbox.Text == "" || telefonobox.Text == "" || institucionbox.Text == "")
                        {
                            men.Close();

                            MessageBox.Show("Hay datos importantes vacios, termine el formulario.");
                        }

                        else
                        {
                            if (DireccionGestor.getorigen() == "inicio")
                            {
                                //institucion, telefono, email
                                if (save.CreateNewUser(nameBox.Text, passwordbox.Text, picturetextbox.Text, askbox1.Text, askbox2.Text, askbox3.Text, askbox4.Text, askbox5.Text, answerbox1.Text, answerbox2.Text, answerbox3.Text, answerbox4.Text, answerbox5.Text, usercombo.Text, fecha, hora, institucionbox.Text, telefonobox.Text, emailbox.Text) == true)
                                {
                                    men.Close();
                                    MessageBox.Show("NUEVO USUARIO " + nameBox.Text + " HA SIDO CREADO EXITOSAMENTE.");
                                    if (MessageBox.Show("Agregar a otro usuario?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                                    {
                                        save = new LoginClass();

                                        DireccionGestor menu = new DireccionGestor();
                                        menu.WindowState = FormWindowState.Normal;
                                        menu.Show();
                                        this.Close();
                                    }
                                    else
                                    {
                                        save = new LoginClass();

                                        UserAddForm menu = new UserAddForm();
                                        menu.WindowState = FormWindowState.Normal;
                                        menu.Show();
                                        this.Close();
                                    }
                                }
                                else if (DireccionGestor.getorigen() == "buscador")
                                {
                                    men.Close();
                                    MessageBox.Show("NUEVO USUARIO " + nameBox.Text + " HA SIDO CREADO.");

                                    if (MessageBox.Show("Agregar a otro usuario?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                                    {
                                        save = new LoginClass();

                                        UsersShowForm menu = new UsersShowForm();
                                        menu.WindowState = FormWindowState.Normal;
                                        menu.Show();
                                        this.Close();
                                    }
                                    else
                                    {
                                        save = new LoginClass();

                                        UserAddForm menu = new UserAddForm();
                                        menu.WindowState = FormWindowState.Normal;
                                        menu.Show();
                                        this.Close();
                                    }
                                }

                                else
                                {
                                    men.Close();
                                    MessageBox.Show("NUEVO USUARIO " + nameBox.Text + " HA SIDO CREADO.");

                                    if (MessageBox.Show("Agregar a otro usuario?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                                    {
                                        save = new LoginClass();

                                        DireccionGestor menu = new DireccionGestor();
                                        menu.WindowState = FormWindowState.Normal;
                                        menu.Show();
                                        this.Close();
                                    }
                                    else
                                    {
                                        save = new LoginClass();

                                        UserAddForm menu = new UserAddForm();
                                        menu.WindowState = FormWindowState.Normal;
                                        menu.Show();
                                        this.Close();
                                    }
                                }
                            }
                            else if (DireccionGestor.getorigen() == "" || DireccionGestor.getorigen() == null || DireccionGestor.getorigen() == "out")
                            {
                                //institucion,telefono,email
                                if (save.CreateNewUser(nameBox.Text, passwordbox.Text, picturetextbox.Text, askbox1.Text, askbox2.Text, askbox3.Text, askbox4.Text, askbox5.Text, answerbox1.Text, answerbox2.Text, answerbox3.Text, answerbox4.Text, answerbox5.Text, usercombo.Text, fecha, hora, institucionbox.Text, telefonobox.Text, emailbox.Text) == true)
                                {
                                    men.Close();
                                    MessageBox.Show("NUEVO USUARIO " + nameBox.Text + " NO PUDO SER CREADO.");
                                    if (MessageBox.Show("Agregar a otro usuario?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                                    {
                                        save = new LoginClass();

                                        UserAccessForm menu = new UserAccessForm();
                                        menu.WindowState = FormWindowState.Normal;
                                        menu.Show();
                                        this.Close();
                                    }
                                    else
                                    {
                                        save = new LoginClass();

                                        UserAddForm menu = new UserAddForm();
                                        menu.WindowState = FormWindowState.Normal;
                                        menu.Show();
                                        this.Close();
                                    }
                                }

                                else
                                {
                                    men.Close();
                                    MessageBox.Show("NUEVO USUARIO " + nameBox.Text + " HA SIDO CREADO EXITOSAMENTE.");

                                    if (MessageBox.Show("Agregar a otro usuario?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                                    {
                                        save = new LoginClass();

                                        UserAccessForm menu = new UserAccessForm();
                                        menu.WindowState = FormWindowState.Normal;
                                        menu.Show();
                                        this.Close();
                                    }
                                    else
                                    {
                                        save = new LoginClass();

                                        UserAddForm menu = new UserAddForm();
                                        menu.WindowState = FormWindowState.Normal;
                                        menu.Show();
                                        this.Close();
                                    }
                                }
                            }
                        }
                    }
                }
            }


            save = new LoginClass();
        }
        private void savebuttonstrip_Click(object sender, EventArgs e)
        {
            if (passwordbox.Text == "" || answerbox1.Text == "" || answerbox2.Text == "" || answerbox3.Text == "" || answerbox4.Text == "" || answerbox5.Text == "")
            {
                if (passwordbox.Text == "")
                {
                    passwordbox.BackColor = Color.Red;
                }
                else
                {
                    passwordbox.BackColor = Color.Green;
                }
                if (answerbox1.Text == "")
                {
                    answerbox1.BackColor = Color.Red;
                }
                else
                {
                    answerbox1.BackColor = Color.Green;
                }
                if (answerbox2.Text == "")
                {
                    answerbox2.BackColor = Color.Red;
                }
                else
                {
                    answerbox2.BackColor = Color.Green;
                }
                if (answerbox3.Text == "")
                {
                    answerbox3.BackColor = Color.Red;
                }
                else
                {
                    answerbox3.BackColor = Color.Green;
                }
                if (answerbox4.Text == "")
                {
                    answerbox4.BackColor = Color.Red;
                }
                else
                {
                    answerbox4.BackColor = Color.Green;
                }
                if (answerbox5.Text == "")
                {
                    answerbox5.BackColor = Color.Red;
                }
                else
                {
                    answerbox5.BackColor = Color.Green;
                }
            }
            else
            {
                LoginClass log = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());

                if (log.setConectionsecurity(userlabel.Text, passwordbox.Text, answerbox1.Text, answerbox2.Text, answerbox3.Text, answerbox4.Text, answerbox5.Text) == true)
                {
                    count = 0;

                    UsersShowForm begin = new UsersShowForm();
                    begin.WindowState = FormWindowState.Normal;
                    begin.Show();
                    this.Close();
                }
                else
                {
                    problempanel.Show();
                    MessageBox.Show("ERROR AL INTRODUCIR DATOS");
                    if (count == 5)
                    {
                        MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE CERRARA LA APLICACION");
                        this.Dispose();
                        Application.Exit();
                    }
                    count++;
                }
            }
        }
예제 #8
0
        private void OKbutton_Click(object sender, EventArgs e)
        {
            string orden;

            if (UsersShowForm.getstate() == "change")
            {
                if (passwordbox.Text == "" || newpasstextbox.Text == "" || repettextbox.Text == "")
                {
                    if (passwordbox.Text == "")
                    {
                        passwordbox.BackColor = Color.Red;
                    }
                    else
                    {
                        passwordbox.BackColor = Color.Green;
                    }
                    if (newpasstextbox.Text == "")
                    {
                        newpasstextbox.BackColor = Color.Red;
                    }
                    else
                    {
                        newpasstextbox.BackColor = Color.Green;
                    }
                    if (repettextbox.Text == "")
                    {
                        repettextbox.BackColor = Color.Red;
                    }
                    else
                    {
                        repettextbox.BackColor = Color.Green;
                    }

                    MessageBox.Show("HAY DATAOS IMPORTANTES VACIOS");
                }
                else if (newpasstextbox.Text != repettextbox.Text)
                {
                    repettextbox.BackColor = Color.Red;
                    MessageBox.Show("LOS CAMPOS PARA CAMBIAR LAS CONTRASEÑA DEBEN DE SER IGUALES");
                }
                else
                {
                    LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                    if (show.setConection(userlabel.Text, passwordbox.Text))
                    {
                        cuenta = 0;
                        orden  = "UPDATE users_table SET USER_PASSWORD='******' WHERE USER_NAME='" + UsersShowForm.getdatum()[0] + "' AND USERTIPO='" + UsersShowForm.getdatum()[1] + "' AND ID='" + UsersShowForm.getdatum()[2] + "' AND FECHA_CREACION='" + UsersShowForm.getdatum()[3] + "';";
                        if (show.ordensql(orden) == true)
                        {
                            MessageBox.Show("CONTRASEÑA CAMBIADA CON EXITO");
                            show = new LoginClass();
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("CONTRASEÑA CAMBIADA");
                            show = new LoginClass();
                            this.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("CONTRASEÑA EQUIVOCADA, POR FAVOR RECTIFIQUE");
                        passwordbox.BackColor = Color.Red;
                        newpasstextbox.Text   = "";
                        repettextbox.Text     = "";
                        cuenta++;
                        if (cuenta == 3)
                        {
                            MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE EMPEZARA UNA RECTIFICACION DE DATOS");
                            UserSecurityForm begin = new UserSecurityForm();
                            begin.WindowState = FormWindowState.Maximized;
                            begin.Show();
                            this.Close();
                        }
                    }
                }
            }
            else if (UsersShowForm.getstate() == "edit")
            {
                if (passwordbox.Text == "" || repettextbox.Text == "")
                {
                    if (passwordbox.Text == "")
                    {
                        passwordbox.BackColor = Color.Red;
                    }
                    else
                    {
                        passwordbox.BackColor = Color.Green;
                    }
                    if (repettextbox.Text == "")
                    {
                        repettextbox.BackColor = Color.Red;
                    }
                    else
                    {
                        repettextbox.BackColor = Color.Green;
                    }
                    MessageBox.Show("HAY DATAOS IMPORTANTES VACIOS");
                }
                else if (passwordbox.Text != repettextbox.Text)
                {
                    repettextbox.BackColor = Color.Red;
                    MessageBox.Show("LAS CONTRASEÑAS DEBEN DE SER IGUALES");
                }
                else
                {
                    LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                    if (show.setConection(userlabel.Text, passwordbox.Text))
                    {
                        cuenta = 0;
                        UserAddForm add = new UserAddForm();
                        add.WindowState = FormWindowState.Maximized;
                        add.Show();
                        DireccionGestor.setcloseshowuser();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("CONTRASEÑA EQUIVOCADA, POR FAVOR RECTIIQUE");
                        passwordbox.BackColor = Color.Red;
                        newpasstextbox.Text   = "";
                        repettextbox.Text     = "";
                        cuenta++;
                        if (cuenta == 3)
                        {
                            MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE EMPEZARA UNA RECTIFICACION DE DATOS");
                            UserSecurityForm begin = new UserSecurityForm();
                            begin.WindowState = FormWindowState.Normal;
                            begin.Show();
                            this.Close();
                        }
                    }
                }
            }
            else if (UsersShowForm.getstate() == "delete")
            {
                if (passwordbox.Text == "" || repettextbox.Text == "")
                {
                    if (passwordbox.Text == "")
                    {
                        passwordbox.BackColor = Color.Red;
                    }
                    else
                    {
                        passwordbox.BackColor = Color.Green;
                    }
                    if (repettextbox.Text == "")
                    {
                        repettextbox.BackColor = Color.Red;
                    }
                    else
                    {
                        repettextbox.BackColor = Color.Green;
                    }
                    MessageBox.Show("HAY DATAOS IMPORTANTES VACIOS");
                }
                else
                {
                    LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                    if (show.setConection(userlabel.Text, passwordbox.Text))
                    {
                        cuenta = 0;
                        orden  = "DROP TABLE IF EXISTS `" + UsersShowForm.getdatum()[0] + "_employee_table;`";
                        show.ordensql(orden);
                        orden = "DROP TABLE IF EXISTS `" + UsersShowForm.getdatum()[0] + "_student_table;`";
                        show.ordensql(orden);
                        orden = "DROP TABLE IF EXISTS `" + UsersShowForm.getdatum()[0] + "_events_table;`";
                        show.ordensql(orden);
                        orden = "DROP TABLE IF EXISTS `" + UsersShowForm.getdatum()[0] + "_movements_table`;";
                        show.ordensql(orden);
                        orden = "delete from users.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.ordensql(orden);

                        MessageBox.Show("USUARIO " + UsersShowForm.getdatum()[0] + " ELIMINADO");


                        if (UserAccessForm.getusername() == UsersShowForm.getdatum()[0])
                        {
                            DireccionGestor.setcloseshowuser();
                            UserAccessForm begin = new UserAccessForm();
                            begin.WindowState = FormWindowState.Normal;
                            begin.Show();
                            this.Close();
                        }
                        else
                        {
                            show = new LoginClass();
                            UsersShowForm.setrefresh("refresh");
                            this.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("CONTRASEÑA EQUIVOCADA, POR FAVOR RECTIIQUE");
                        cuenta++;
                        if (cuenta == 3)
                        {
                            MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE EMPEZARA UNA RECTIFICACION DE DATOS");
                            UserSecurityForm begin = new UserSecurityForm();
                            begin.WindowState = FormWindowState.Normal;
                            begin.Show();
                            this.Close();
                        }
                    }
                }
            }
            else if (UsersShowForm.getstate() == "save")
            {
                if (passwordbox.Text == "" || repettextbox.Text == "")
                {
                    if (passwordbox.Text == "")
                    {
                        passwordbox.BackColor = Color.Red;
                    }
                    else
                    {
                        passwordbox.BackColor = Color.Green;
                    }
                    if (repettextbox.Text == "")
                    {
                        repettextbox.BackColor = Color.Red;
                    }
                    else
                    {
                        repettextbox.BackColor = Color.Green;
                    }
                    MessageBox.Show("HAY DATAOS IMPORTANTES VACIOS");
                }
                else
                {
                    LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                    if (show.setConection(userlabel.Text, passwordbox.Text))
                    {
                        cuenta = 0;
                        //some codde heereeee
                    }
                    else
                    {
                        MessageBox.Show("CONTRASEÑA EQUIVOCADA, POR FAVOR RECTIIQUE");
                        cuenta++;
                        if (cuenta == 3)
                        {
                            MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE EMPEZARA UNA RECTIFICACION DE DATOS");
                            UserSecurityForm begin = new UserSecurityForm();
                            begin.WindowState = FormWindowState.Normal;
                            begin.Show();
                            this.Close();
                        }
                    }
                }
            }
            else if (UsersShowForm.getstate() == "cargar")
            {
                if (passwordbox.Text == "" || repettextbox.Text == "")
                {
                    if (passwordbox.Text == "")
                    {
                        passwordbox.BackColor = Color.Red;
                    }
                    else
                    {
                        passwordbox.BackColor = Color.Green;
                    }
                    if (repettextbox.Text == "")
                    {
                        repettextbox.BackColor = Color.Red;
                    }
                    else
                    {
                        repettextbox.BackColor = Color.Green;
                    }
                    MessageBox.Show("HAY DATAOS IMPORTANTES VACIOS");
                }
                else
                {
                    LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                    if (show.setConection(userlabel.Text, passwordbox.Text))
                    {
                        cuenta = 0;
                        //some codde heereeee
                    }
                    else
                    {
                        MessageBox.Show("CONTRASEÑA EQUIVOCADA, POR FAVOR RECTIIQUE");
                        cuenta++;
                        if (cuenta == 3)
                        {
                            MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE EMPEZARA UNA RECTIFICACION DE DATOS");
                            UserSecurityForm begin = new UserSecurityForm();
                            begin.WindowState = FormWindowState.Normal;
                            begin.Show();
                            this.Close();
                        }
                    }
                }
            }
            else if (UsersShowForm.getstate() == "comprobar")
            {
                if (passwordbox.Text == "" || repettextbox.Text == "")
                {
                    if (passwordbox.Text == "")
                    {
                        passwordbox.BackColor = Color.Red;
                    }
                    else
                    {
                        passwordbox.BackColor = Color.Green;
                    }
                    if (repettextbox.Text == "")
                    {
                        repettextbox.BackColor = Color.Red;
                    }
                    else
                    {
                        repettextbox.BackColor = Color.Green;
                    }
                    MessageBox.Show("HAY DATAOS IMPORTANTES VACIOS");
                }
                else
                {
                    LoginClass show = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                    if (show.setConection(userlabel.Text, passwordbox.Text))
                    {
                        cuenta = 0;
                        ShowSubjects.setpaso(true);
                    }
                    else
                    {
                        MessageBox.Show("CONTRASEÑA EQUIVOCADA, POR FAVOR RECTIIQUE");
                        cuenta++;
                        if (cuenta == 3)
                        {
                            ShowSubjects.setpaso(false);
                            MessageBox.Show("POR MOTIVOS DE SEGURIDAD SE EMPEZARA UNA RECTIFICACION DE DATOS");
                            UserSecurityForm begin = new UserSecurityForm();
                            begin.WindowState = FormWindowState.Normal;
                            begin.Show();
                            this.Close();
                        }
                    }
                }


                ///////////////////////////////////
            }
            else
            {
                MessageBox.Show("HA OCURRIDO ALGO DURANTE EL PROCESO");
            }
        }