Esempio n. 1
0
        private void AlterarPwButton_Click(object sender, EventArgs e)
        {
            string novaPw = textBox4.Text;

            if (novaPw.Length < 8)
            {
                toolStripStatusLabel1.Text = "A password tem de ter no minimo 8 caracteres.";
            }
            else if (RegisterForm.CharEspeciais(novaPw))
            {
                toolStripStatusLabel1.Text = "A password contem caracteres especiais.";
            }
            else
            {
                int indice = dataGridView1.CurrentCell.RowIndex;

                string[] read = File.ReadAllLines(fileUsers);
                string[] ut   = read[indice].Split(';');

                string ln = ut[0] + ';' + ut[1] + ';' + novaPw + ';' + ut[3] + ';' + ut[4];

                ModFich(indice, ln);
                toolStripStatusLabel1.Text = "Password alterada com sucesso.";
            }
        }
Esempio n. 2
0
        private void GestaoDeSalasButton_Click(object sender, EventArgs e)
        {
            variaveis.CurrentForm = ActiveForm;
            this.Hide();

            RegisterForm rf = new RegisterForm();

            rf.Show();
        }
Esempio n. 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            UserTextBox.Text = "";
            PwTextBox.Text   = "";

            variaveis.CurrentForm = ActiveForm;
            this.Hide();

            RegisterForm rf = new RegisterForm();

            rf.Show();
        }
Esempio n. 4
0
        private void AlterarEmailButton_Click(object sender, EventArgs e)
        {
            string novoEmail = textBox3.Text;

            if (!RegisterForm.FormatoEmail(novoEmail))
            {
                toolStripStatusLabel1.Text = "O endereco nao se encontra no formato correto.";
            }
            else
            {
                int indice = dataGridView1.CurrentCell.RowIndex;

                string[] read = File.ReadAllLines(fileUsers);
                string[] ut   = read[indice].Split(';');

                bool emailEmUso = false;
                for (int i = 0; i < read.Length; i++)
                {
                    string[] split = read[i].Split(';');
                    if (split[1].ToLower() == novoEmail.ToLower())
                    {
                        emailEmUso = true;
                        break;
                    }
                }

                if (emailEmUso)
                {
                    toolStripStatusLabel1.Text = "O endereco ja se encontra em uso.";
                }
                else if (ut[1] == novoEmail)
                {
                    toolStripStatusLabel1.Text = "O endereco ja pertence ao utilizador selecionado.";
                }
                else
                {
                    string ln = ut[0] + ';' + novoEmail + ';' + ut[2] + ';' + ut[3] + ';' + ut[4];

                    ModFich(indice, ln);
                    toolStripStatusLabel1.Text = "Email alterado com sucesso.";
                }
            }
        }