private void buttonInapoi_Click(object sender, EventArgs e) { this.Hide(); ProfilElev f = new ProfilElev(); f.Show(); }
private void buttonInapoi_Click(object sender, EventArgs e) { if (MessageBox.Show("Ești sigur că vrei să întrerupi testul?", "Ieșire din test", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.Hide(); ProfilElev f = new ProfilElev(); f.Show(); } }
private void labelProfil_Click(object sender, EventArgs e) { if (Conectare.status == 0 || Conectare.status == 1) { this.Hide(); ProfilProfesor_Inspector f = new ProfilProfesor_Inspector(); f.Show(); } else if (Conectare.status == -1) { this.Hide(); ProfilElev f = new ProfilElev(); f.Show(); } }
private void buttonUrmat_Click(object sender, EventArgs e) { if (checkBoxNici.Checked == true) { Conectare.Rezultat = Conectare.Rezultat - 1; } else if (checkBoxPutin.Checked == true) { Conectare.Rezultat = Conectare.Rezultat - 0.5; } else if (checkBoxMulte.Checked == true) { Conectare.Rezultat = Conectare.Rezultat + 0.5; } else if (checkBoxMereu.Checked == true) { Conectare.Rezultat = Conectare.Rezultat + 1; } if ((checkBoxDepinde.Checked == true || checkBoxMereu.Checked == true || checkBoxMulte.Checked == true || checkBoxNici.Checked == true || checkBoxPutin.Checked == true) && Conectare.Numar_Intrebare <= Conectare.Total) { this.Hide(); TestCooperare f = new TestCooperare(); f.Show(); } else if (Conectare.Numar_Intrebare > Conectare.Total) { timerCronom.Enabled = false; SqlConnection con = new SqlConnection(Conectare.variabila); con.Open(); string querry = @"UPDATE Conturi_elevi SET Alegeri = @aleg WHERE Email = '" + Conectare.conectat + "' "; SqlCommand com = new SqlCommand(querry, con); com.Parameters.AddWithValue("aleg", (Conectare.Rezultat / Conectare.Total).ToString()); com.ExecuteNonQuery(); con.Close(); MessageBox.Show("Felicitări! Ați terminat testul de cooperare.", "Test terminat", MessageBoxButtons.OK, MessageBoxIcon.None); this.Hide(); ProfilElev f = new ProfilElev(); f.Show(); } }
private void buttonConectare_Click(object sender, EventArgs e) { if (Conectare.status == -2) { this.Hide(); Login f = new Login(); f.Show(); } else { if (Conectare.status == 0 || Conectare.status == 1) { this.Hide(); ProfilProfesor_Inspector f = new ProfilProfesor_Inspector(); f.Show(); } else if (Conectare.status == -1) { this.Hide(); ProfilElev f = new ProfilElev(); f.Show(); } } }
private void buttonGata_Click(object sender, EventArgs e) { if (comboBoxAlegPoz1.Text == "" || comboBoxAlegPoz2.Text == "" || comboBoxAlegResp1.Text == "" || comboBoxAlegResp2.Text == "") { MessageBox.Show("Există spații necompletate.", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (comboBoxAlegPoz1.Text == comboBoxAlegPoz2.Text || comboBoxAlegPoz1.Text == comboBoxAlegResp1.Text || comboBoxAlegPoz1.Text == comboBoxAlegResp2.Text || comboBoxAlegPoz2.Text == comboBoxAlegResp1.Text || comboBoxAlegPoz2.Text == comboBoxAlegResp2.Text || comboBoxAlegResp1.Text == comboBoxAlegResp2.Text) { MessageBox.Show("Nu puteți răspunde cu același elev mai mult de o dată.", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int[] vect_alegeri = new int[5]; string[] numar_litera = new string[5]; numar_litera = Conectare.Clase.Split(' ').Select(text => text.ToString()).ToArray(); SqlConnection con = new SqlConnection(Conectare.variabila); con.Open(); string querry = @"SELECT * FROM Conturi_elevi WHERE Numar_Clasa = '" + Int32.Parse(numar_litera[0]) + "' AND Litera_Clasa = '" + numar_litera[1] + "' "; SqlCommand com = new SqlCommand(querry, con); SqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { if (reader["Nume"].ToString() + " " + reader["Prenume"].ToString() == comboBoxAlegPoz1.Text) { vect_alegeri[0] = Int32.Parse(reader["Id"].ToString()); } else if (reader["Nume"].ToString() + " " + reader["Prenume"].ToString() == comboBoxAlegPoz2.Text) { vect_alegeri[1] = Int32.Parse(reader["Id"].ToString()); } else if (reader["Nume"].ToString() + " " + reader["Prenume"].ToString() == comboBoxAlegResp1.Text) { vect_alegeri[2] = Int32.Parse(reader["Id"].ToString()); } else if (reader["Nume"].ToString() + " " + reader["Prenume"].ToString() == comboBoxAlegResp2.Text) { vect_alegeri[3] = Int32.Parse(reader["Id"].ToString()); } } reader.Close(); con.Close(); con.Open(); string querry1 = @"UPDATE Conturi_elevi SET Raspunsuri = @rasp WHERE Email = '" + Conectare.conectat + "' "; SqlCommand com1 = new SqlCommand(querry1, con); com1.Parameters.AddWithValue("rasp", vect_alegeri[0].ToString() + " " + vect_alegeri[1].ToString() + " " + vect_alegeri[2].ToString() + " " + vect_alegeri[3].ToString()); com1.ExecuteNonQuery(); con.Close(); MessageBox.Show("Felicitări! Ați terminat testul sociometric.", "Test terminat", MessageBoxButtons.OK, MessageBoxIcon.None); this.Hide(); ProfilElev f = new ProfilElev(); f.Show(); } }
private void buttonAcces_Click(object sender, EventArgs e) { if (comboBoxTip.SelectedIndex == 0) { SqlConnection con = new SqlConnection(Conectare.variabila); con.Open(); string querry = @"SELECT * FROM Conturi_profesori_inspectori WHERE Email = '" + textBoxEmail.Text + "' "; SqlCommand com = new SqlCommand(querry, con); SqlDataReader reader = com.ExecuteReader(); if (reader.HasRows == true) { textBoxEmail.BackColor = System.Drawing.Color.White; textBoxEmail.ForeColor = System.Drawing.Color.Black; textBoxEmail.Font = new Font(textBoxEmail.Font.FontFamily, textBoxEmail.Font.Size, FontStyle.Regular); con.Close(); con.Open(); querry = @"SELECT * FROM Conturi_profesori_inspectori WHERE Email = '" + textBoxEmail.Text + "' AND Parola = '" + textBoxParola.Text + "' "; SqlCommand com1 = new SqlCommand(querry, con); reader = com1.ExecuteReader(); if (reader.HasRows == true) { while (reader.Read()) { if (reader["Scoala"].ToString() == "" || reader["Clase"].ToString() == "") { Conectare.status = 1; } else { Conectare.status = 0; } } reader.Close(); Conectare.conectat = textBoxEmail.Text; textBoxParola.BackColor = System.Drawing.Color.White; textBoxParola.ForeColor = System.Drawing.Color.Black; this.Hide(); ProfilProfesor_Inspector f = new ProfilProfesor_Inspector(); f.Show(); } else { textBoxParola.BackColor = System.Drawing.Color.DarkOrange; textBoxParola.ForeColor = System.Drawing.Color.White; textBoxEmail.BackColor = System.Drawing.Color.White; textBoxEmail.ForeColor = System.Drawing.Color.Black; textBoxEmail.Font = new Font(textBoxEmail.Font.FontFamily, textBoxEmail.Font.Size, FontStyle.Regular); MessageBox.Show("Parolă incorectă!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { textBoxEmail.BackColor = System.Drawing.Color.DarkOrange; textBoxEmail.ForeColor = System.Drawing.Color.White; textBoxEmail.Font = new Font(textBoxEmail.Font.FontFamily, textBoxEmail.Font.Size, FontStyle.Bold); MessageBox.Show("Email sau ocupație invalidă!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); } reader.Close(); } else if (comboBoxTip.SelectedIndex == 1) { SqlConnection con = new SqlConnection(Conectare.variabila); con.Open(); string querry = @"SELECT * FROM Conturi_elevi WHERE Email = '" + textBoxEmail.Text + "' "; SqlCommand com = new SqlCommand(querry, con); SqlDataReader reader = com.ExecuteReader(); if (reader.HasRows == true) { textBoxEmail.BackColor = System.Drawing.Color.White; textBoxEmail.ForeColor = System.Drawing.Color.Black; textBoxEmail.Font = new Font(textBoxEmail.Font.FontFamily, textBoxEmail.Font.Size, FontStyle.Regular); con.Close(); con.Open(); querry = @"SELECT * FROM Conturi_elevi WHERE Email = '" + textBoxEmail.Text + "' AND Parola = '" + textBoxParola.Text + "' "; SqlCommand com1 = new SqlCommand(querry, con); reader = com1.ExecuteReader(); if (reader.HasRows == true) { Conectare.status = -1; while (reader.Read()) { Conectare.Clase = reader["Numar_Clasa"].ToString() + " " + reader["Litera_Clasa"].ToString(); } reader.Close(); Conectare.conectat = textBoxEmail.Text; textBoxParola.BackColor = System.Drawing.Color.White; textBoxParola.ForeColor = System.Drawing.Color.Black; this.Hide(); ProfilElev f = new ProfilElev(); f.Show(); } else { textBoxParola.BackColor = System.Drawing.Color.DarkOrange; textBoxParola.ForeColor = System.Drawing.Color.White; textBoxEmail.BackColor = System.Drawing.Color.White; textBoxEmail.ForeColor = System.Drawing.Color.Black; textBoxEmail.Font = new Font(textBoxEmail.Font.FontFamily, textBoxEmail.Font.Size, FontStyle.Regular); MessageBox.Show("Parolă incorectă!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { textBoxEmail.BackColor = System.Drawing.Color.DarkOrange; textBoxEmail.ForeColor = System.Drawing.Color.White; textBoxEmail.Font = new Font(textBoxEmail.Font.FontFamily, textBoxEmail.Font.Size, FontStyle.Bold); MessageBox.Show("Email sau ocupație invalidă!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); } reader.Close(); } else { comboBoxTip.BackColor = System.Drawing.Color.DarkOrange; MessageBox.Show("Alegeți o ocupație!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); } }