private void problemuserbutton_Click(object sender, EventArgs e)
        {
            UserSecurityForm begin = new UserSecurityForm();

            begin.WindowState = FormWindowState.Maximized;
            begin.Show();
            this.Hide();
        }
예제 #2
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");
            }
        }