Пример #1
0
        private void back_Click(object sender, EventArgs e)
        {
            Autentificare_elev auth = new Autentificare_elev();

            auth.Show();
            this.Hide();
        }
        private void register_Click(object sender, EventArgs e)
        {
            short  exist = 0;
            string query = string.Format("SELECT Email,Parola FROM Elevi WHERE Email='{0}' AND Parola='{1}';", email.Text, parola.Text);

            exist = MyData.countApparitions(query);
            if (nume.Text == string.Empty || prenume.Text == string.Empty || username.Text == string.Empty || email.Text == string.Empty || parola.Text == string.Empty || reParola.Text == string.Empty)
            {
                MessageBox.Show("Te rog sa completezi toate campurile", "Matrice la matematica", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (exist >= 1)
            {
                MessageBox.Show("E-mailul introdus exista deja. Alege altul", "Matrice la matematica", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                string elevi = string.Format("INSERT INTO Elevi (Nume,Prenume,Username,Email,Parola)VALUES('{0}','{1}','{2}','{3}','{4}');", nume.Text, prenume.Text, username.Text, email.Text, parola.Text);
                MyData.writeData("Elevi", elevi);
                MessageBox.Show("Contul a fost creat cu succes", "Matrice la matematica", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Autentificare_elev auth = new Autentificare_elev();
                auth.Show();
                this.Hide();
            }
        }