Exemple #1
0
 private void StudentPanel_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (TestForm.test_on)
     {
         MessageBox.Show("Nu poti iesi din test daca nu ai dat finalizare.", "Informatii", MessageBoxButtons.OK, MessageBoxIcon.Error);
         e.Cancel = true;
     }
     Main_form.CloseMain();
 }
Exemple #2
0
        private void register_btn_Click(object sender, EventArgs e)
        {
            if (nume_txt.Text == string.Empty || nick_txt.Text == string.Empty || prenume_txt.Text == string.Empty || pass_txt.Text == string.Empty || repass_txt.Text == string.Empty)
            {
                MessageBox.Show("Toate campurile sunt obligatorii.", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (nick_txt.Text == Main_form.director_acc[0])
            {
                MessageBox.Show("Nickname deja folosit,alege altul.", "Nick folosit", MessageBoxButtons.OK, MessageBoxIcon.Error);
                nick_txt.Text = string.Empty;
                return;
            }
            //verifica daca contul exista in baza de date Studenti si Profesori ( nick -ul mai exact ) dupa verifica daca exista numele si prenumele in baza de date.
            if (NickAlreadyExisted(nick_txt.Text))
            {
                MessageBox.Show("Nickname deja folosit,alege altul.", "Nick folosit", MessageBoxButtons.OK, MessageBoxIcon.Error);
                nick_txt.Text = string.Empty;
            }
            if (NumeAlreadyExisted(nume_txt.Text, prenume_txt.Text))
            {
                MessageBox.Show("Acel nume si prenume exista deja in baza de date.Poti avea doar un cont cu acealsi nume.", "Nume existent", MessageBoxButtons.OK, MessageBoxIcon.Error);
                nume_txt.Text = prenume_txt.Text = string.Empty;
            }
            //update table
            string addsql = string.Format("INSERT INTO Studenti(Nick,Parola)VALUES('{0}','{1}');", nick_txt.Text, pass_txt.Text);

            MyData.execSql(addsql);
            string sqlID      = string.Format("SELECT ID_Student FROM Studenti WHERE Nick='{0}' and Parola='{1}';", nick_txt.Text, pass_txt.Text);
            int    id_student = MyData.selectData(sqlID, "ID_Student");
            string addNume    = string.Format("INSERT INTO Grades(ID_Student,Nume,Prenume)VALUES({0},'{1}','{2}');", id_student, nume_txt.Text, prenume_txt.Text);

            MyData.execSql(addNume);
            MessageBox.Show("Cont creat cu succes, acum te poti loga !", "Succes !", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Main_form.CloseMain();
        }
Exemple #3
0
 private void DirectorPanel_FormClosed(object sender, FormClosedEventArgs e)
 {
     Main_form.CloseMain();
 }
Exemple #4
0
 private void CreateAccount_FormClosed(object sender, FormClosedEventArgs e)
 {
     Main_form.CloseMain();
 }