private void home_Click(object sender, EventArgs e) { this.Hide(); main ss = new main(); ss.Show(); }
private void pictureBox2_Click(object sender, EventArgs e) { this.Close(); main m = new main(); m.Show(); }
private void toolStripMenuItem5_Click(object sender, EventArgs e) { this.Close(); main m = new main(); m.Show(); }
private void pictureBox1_Click(object sender, EventArgs e) { Hide(); main ss = new main(); ss.Show(); }
private void home_Click(object sender, EventArgs e) { GlobalVariables.Semester = temp; this.Hide(); main ss = new main(); ss.Show(); }
private void timer1_Tick(object sender, EventArgs e) { if (progressBar1.Value < 100) { progressBar1.Value += 2; } else { timer1.Stop(); m.Show(); Hide(); } }
private void button1_Click(object sender, EventArgs e) { DateTime end_of_exams_semester_a = new DateTime(DateTime.Today.Year, 3, 5); DateTime end_of_semester_b = new DateTime(DateTime.Today.Year, 6, 15); DateTime end_of_exams_semester_b = new DateTime(DateTime.Today.Year, 7, 15); SqlDataReader read = db.Select("*", "NewUsers"); try { if (textBox1.Text == "") { MessageBox.Show("Logon Failure: unknown ID or invalid password"); return; } if (SQLFunctions.checkExistsEmail(textBox1.Text)) { if (SQLFunctions.checkLogIn(Convert.ToInt32(SQLFunctions.getIDbyEmail(textBox1.Text)), textBox2.Text)) { this.Hide(); if (SQLFunctions.checkRole(Convert.ToInt32(SQLFunctions.getIDbyEmail(textBox1.Text.ToString()))) == "Student") { FormMenuStudent mainForm = new FormMenuStudent(Convert.ToInt32(SQLFunctions.getIDbyEmail(textBox1.Text.ToString())), textBox2.Text); mainForm.Show(); } else if (SQLFunctions.checkRole(Convert.ToInt32(SQLFunctions.getIDbyEmail(textBox1.Text.ToString()))) == "SecretaryA") { FormMenuSecretary mainForm = new FormMenuSecretary(Convert.ToInt32(SQLFunctions.getIDbyEmail(textBox1.Text.ToString())), textBox2.Text); mainForm.Show(); } else if (SQLFunctions.checkRole(Convert.ToInt32(SQLFunctions.getIDbyEmail(textBox1.Text.ToString()))) == "Exam Department") { FormMenuExamDepartment mainForm = new FormMenuExamDepartment(); mainForm.Show(); } else if (SQLFunctions.checkRole(Convert.ToInt32(SQLFunctions.getIDbyEmail(textBox1.Text.ToString()))) == "Admin") { FormMenuAdmin mainForm = new FormMenuAdmin(); mainForm.Show(); } else { while (read.Read()) { if (textBox1.Text == read["Email"].ToString().Trim() && textBox2.Text == read["Password"].ToString().Trim()) { ID = read["ID"].ToString(); // GlobalVariables h;.ID = read["ID"].ToString().Trim(); GlobalVariables.User_ID = read["ID"].ToString().Trim(); GlobalVariables.Full_Name = read["FirstName"].ToString().Trim() + " " + read["LastName"].ToString().Trim(); GlobalVariables.User_Permission = read["Role"].ToString().Trim(); GlobalVariables.User_Department = read["Department"].ToString().Trim(); GlobalVariables.User_Email = read["Email"].ToString().Trim(); if (monthCalendar1.MaxDate >= DateTime.Today && monthCalendar1.MinDate <= DateTime.Today) { GlobalVariables.Semester = "A"; } else if (monthCalendar1.MaxDate < DateTime.Today && DateTime.Today <= end_of_exams_semester_a) { GlobalVariables.Semester = "Exam Period semester A"; } else if (end_of_exams_semester_a < DateTime.Today && DateTime.Today <= end_of_semester_b) { GlobalVariables.Semester = "B"; } else if (end_of_exams_semester_b >= DateTime.Today && DateTime.Today > end_of_semester_b) { GlobalVariables.Semester = "Exam Period semester B"; } else { GlobalVariables.Semester = "Summer Semester"; } IsFound = true; GlobalVariables.maxDate = monthCalendar1.MaxDate; GlobalVariables.minDate = monthCalendar1.MinDate; break; } GlobalVariables.maxDate = monthCalendar1.MaxDate; GlobalVariables.minDate = monthCalendar1.MinDate; } read.Close(); if (!IsFound) { MessageBox.Show("You have to sign up before"); textBox1.Text = ""; textBox2.Text = ""; return; } this.Hide(); main m = new main(); m.Show(); } } else { MessageBox.Show("Logon Failure: unknown ID or invalid password"); } } else { MessageBox.Show("Logon Failure: unknown ID or invalid password"); } } catch (SqlException exception) { MessageBox.Show(exception.ToString()); } finally { if (db.isconnected == true) { db.CloseConnection(); } } }
private void button1_Click(object sender, EventArgs e) { try { first = textBox1.Text; last = textBox2.Text; ////username = first + last[0] + last[1]; reader = db.Select("*", "NewUsers", "Email", textBox6.Text); int count = 0, count_id = 0; while (reader.Read()) { if (reader["Email"].ToString().Trim().Equals(textBox6.Text)) { count++; } } reader.Close(); reader = db.Select("*", "NewUsers", "ID", textBox3.Text); while (reader.Read()) { if (reader["ID"].ToString().Trim().Equals(textBox3.Text)) { count_id++; } } reader.Close(); if (count == 0 && count_id == 0) { reader.Close(); id = textBox3.Text; password = textBox4.Text; password_again = textBox5.Text; email = textBox6.Text; Role = role.Text; department = Department_comboBox.Text; unit = comboBox1.Text; if (password == password_again) { db.InsertUser(first, last, id, email, password, Role, department, unit); this.Hide(); main ss = new main(); ss.Show(); } else { MessageBox.Show("Wrong input!\n The passwords are Different"); } } else if (count != 0) { MessageBox.Show("Wrong input!\n Email already exist in the system"); } else if (count_id != 0) { MessageBox.Show("Wrong input!\n ID already exist in the system"); } } catch (Exception) { MessageBox.Show("Could not connect to sql"); } finally { if (db.isconnected == true) { db.CloseConnection(); } } }