Exemple #1
0
        private void submitBtn_Click(object sender, EventArgs e)
        {
            //grading procedure

            /*
             * //string connection = @"Data Source=BASMA-HP\SQLEXPRESS;Initial Catalog=ExaminationSystems;Integrated Security=True";
             * SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(DBLayer.connection);
             * SqlCommand sqlCommand = new SqlCommand();
             * sqlConnection.Open();
             * sqlCommand.CommandText = "Exam_Correction";
             * sqlCommand.CommandType = CommandType.StoredProcedure;
             * //sqlCommand.Parameters.AddWithValue("@Exam_ID", exam_id);
             * sqlCommand.Parameters.AddWithValue("@Exam_ID", MyExam.Exam.Id);
             * //sqlCommand.Parameters.AddWithValue("@Student_ID", student_id);
             * sqlCommand.Parameters.AddWithValue("@Student_ID", MyStudent.Student.Id);
             * sqlCommand.Connection = sqlConnection;
             * sqlCommand.ExecuteNonQuery();
             * sqlConnection.Close();
             */

            StudentDAL.setFinishExam(MyExam.Exam.Id);
            Student_Profile f = new Student_Profile();

            f.Show();
            this.Close();
        }
        private void LoginBtn_Click(object sender, EventArgs e)
        {
            Instructor loggedInstructor = null;
            Student    loggedStudent    = null;
            Admin      loggedAdmin      = null;

            if (insRadBtn.Checked)
            {
                loggedInstructor = InstructorDAL.GetByUserNameAndPassword(UserNameTextBox.Text, PasswordTextBox.Text);
                if (loggedInstructor == null)
                {
                    MessageBox.Show("Please Insert Correct Data For Instructor");
                }
                else
                {
                    loggedInstructor        = InstructorDAL.GetByUserNameAndPassword(UserNameTextBox.Text, PasswordTextBox.Text);
                    MyInstructor.Instructor = loggedInstructor;
                    Instructor_Profile f = new Instructor_Profile();
                    f.Show();
                    this.Hide();
                }
            }
            else if (studRadBtn.Checked)
            {
                loggedStudent = StudentDAL.GetByUserNameAndPassword(UserNameTextBox.Text, PasswordTextBox.Text);
                if (loggedStudent == null)
                {
                    MessageBox.Show("Please Insert Correct Data For Student");
                }
                else
                {
                    MyStudent.Student = loggedStudent;
                    Student_Profile f = new Student_Profile();
                    f.Show();
                    this.Hide();
                }
            }
            else
            {
                loggedAdmin = AdminDAL.GetByUserNameAndPassword(UserNameTextBox.Text, PasswordTextBox.Text);
                if (loggedAdmin == null)
                {
                    MessageBox.Show("Please Insert Correct Data For Admin");
                }
                else
                {
                    MyAdmin.Admin = loggedAdmin;
                    AdminProfile adm = new AdminProfile();
                    adm.Show();
                    this.Hide();
                }
            }
        }