예제 #1
0
        public List <ViewCourse> GetStudentAllCourseDetailsWithRegistrationNo(StudentMustafa student)
        {
            Query = "SELECT * FROM StudentCourseResult WHERE StudentRegNo=@regNo ";

            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Command.Parameters.Clear();
            Command.Parameters.Add("regNo", SqlDbType.VarChar);
            Command.Parameters["regNo"].Value = student.RegNo;
            Reader = Command.ExecuteReader();
            List <ViewCourse> studentCoursesInfo = new List <ViewCourse>();

            while (Reader.Read())
            {
                ViewCourse studentCourseInfo = new ViewCourse();


                studentCourseInfo.Code       = Reader["Code"].ToString();
                studentCourseInfo.CourseName = Reader["Name"].ToString();
                studentCourseInfo.Grade      = Reader["Grade"].ToString();

                studentCoursesInfo.Add(studentCourseInfo);
            }
            Reader.Close();
            Connection.Close();
            return(studentCoursesInfo);
        }
예제 #2
0
        public JsonResult GetStudentAllCoursesDetailsWithRegNo(StudentMustafa student)
        {
            var studentCourseDetails = aViewResultManager.GetStudentAllCourseDetailsWithRegistrationNo(student);


            return(Json(studentCourseDetails));
        }
예제 #3
0
        public StudentMustafa GetStudentDetailsWithRegistrationNo(StudentMustafa student)
        {
            Query   = "SELECT * FROM StudentResult WHERE RegistrationNo=@regNo";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Command.Parameters.Clear();
            Command.Parameters.Add("regNo", SqlDbType.VarChar);
            Command.Parameters["regNo"].Value = student.RegNo;
            Reader = Command.ExecuteReader();
            StudentMustafa studentInfo = new StudentMustafa();

            while (Reader.Read())
            {
                studentInfo.Name  = Reader["Name"].ToString();
                studentInfo.Email = Reader["Email"].ToString();
                // studentInfo.Code = Reader["DeptName"].ToString();
                studentInfo.Code = Reader["Code"].ToString();
                //  studentInfo.CourseName = Reader["CourseName"].ToString();
                studentInfo.Grade = Reader["Grade"].ToString();
                //studentInfo.RegNo = Reader["StudentRegNo"].ToString();
                //studentInfo.DepartmentId = Convert.ToInt32(Reader["DepartmentId"].ToString());
            }
            Reader.Close();
            Connection.Close();
            return(studentInfo);
        }
        public JsonResult GetStudentDetails(StudentMustafa student)
        {
            var studentDetails = anEnrollCourseManager.GetStudentDetailsWithRegistrationNo(student);

            TempData["std"] = studentDetails;
            var courses = anEnrollCourseManager.GetAllCoursesByDeptId(studentDetails.DepartmentId);

            studentDetails.Courses = courses;
            return(Json(studentDetails));
        }
        public ActionResult EnrollStudentCourse(StudentMustafa student)
        {
            ViewBag.Students = anEnrollCourseManager.GetAllStudentsRegistrationNo();
            StudentMustafa aStudent = (StudentMustafa)TempData["std"];

            aStudent.CourseId = student.CourseId;
            aStudent.Date     = student.Date;
            ViewBag.Message   = anEnrollCourseManager.Enroll(aStudent);
            return(View());
        }
예제 #6
0
 public string Enroll(StudentMustafa student)
 {
     if (anEnrollCourseGateway.IsCourseExists(student))
     {
         return("This Course has been enrolled already");
     }
     else
     {
         int isRowAffected = anEnrollCourseGateway.Enroll(student);
         if (isRowAffected > 0)
         {
             return("Enrolled successfully");
         }
         else
         {
             return("course enrolled failed");
         }
     }
 }
예제 #7
0
        public List <StudentMustafa> GetAllStudentsRegistrationNo()
        {
            Query = "SELECT * FROM Student";

            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Reader = Command.ExecuteReader();
            List <StudentMustafa> students = new List <StudentMustafa>();

            while (Reader.Read())
            {
                StudentMustafa student = new StudentMustafa()
                {
                    Id    = (int)Reader["id"],
                    RegNo = Reader["RegistrationNo"].ToString()
                };
                students.Add(student);
            }
            Reader.Close();
            Connection.Close();
            return(students);
        }
        public int Enroll(StudentMustafa student)
        {
            Query   = "INSERT INTO StudentCourse VALUES(@courseId, @studentRegNo, @date, @departmentId)";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Command.Parameters.Clear();

            Command.Parameters.Add("courseId", SqlDbType.Int);
            Command.Parameters["courseId"].Value = student.CourseId;
            Command.Parameters.Add("studentRegNo", SqlDbType.VarChar);
            Command.Parameters["studentRegNo"].Value = student.RegNo;

            Command.Parameters.Add("date", SqlDbType.Date);
            Command.Parameters["date"].Value = student.Date;

            Command.Parameters.Add("departmentId", SqlDbType.VarChar);
            Command.Parameters["departmentId"].Value = student.DepartmentId;
            int isRowEffected = Command.ExecuteNonQuery();

            Connection.Close();
            return(isRowEffected);
        }
        public StudentMustafa GetStudentDetailsWithRegistrationNo(StudentMustafa student)
        {
            Query   = "SELECT s.Name, s.Email, s.DepartmentId,s.RegistrationNo,d.Code from Student s INNER JOIN Department d on d.id = s.DepartmentId where s.id = @id";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Command.Parameters.Clear();
            Command.Parameters.Add("id", SqlDbType.Int);
            Command.Parameters["id"].Value = student.Id;
            Reader = Command.ExecuteReader();
            StudentMustafa studentInfo = new StudentMustafa();

            while (Reader.Read())
            {
                studentInfo.Name         = Reader["Name"].ToString();
                studentInfo.Email        = Reader["Email"].ToString();
                studentInfo.Code         = Reader["Code"].ToString();
                studentInfo.RegNo        = Reader["RegistrationNo"].ToString();
                studentInfo.DepartmentId = Convert.ToInt32(Reader["DepartmentId"].ToString());
            }
            Reader.Close();
            Connection.Close();
            return(studentInfo);
        }
        public bool IsCourseExists(StudentMustafa student)
        {
            Query   = "SELECT * FROM StudentCourse Where StudentRegNo = @str AND CourseId = @courseId ";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Command.Parameters.Clear();
            Command.Parameters.Add("str", SqlDbType.VarChar);
            Command.Parameters["str"].Value = student.RegNo;
            Command.Parameters.Add("courseId", SqlDbType.Int);
            Command.Parameters["courseId"].Value = student.CourseId;
            Reader = Command.ExecuteReader();


            bool isExist = false;

            if (Reader.HasRows)
            {
                isExist = true;
            }
            Reader.Close();
            Connection.Close();
            return(isExist);
        }
예제 #11
0
        public ActionResult ViewResult(StudentMustafa student)
        {
            ViewBag.Students = aViewResultManager.GetAllStudentsRegistrationNo();

            return(View());
        }
예제 #12
0
 public List <ViewCourse> GetStudentAllCourseDetailsWithRegistrationNo(StudentMustafa student)
 {
     return(aViewResultGateway.GetStudentAllCourseDetailsWithRegistrationNo(student));
 }
예제 #13
0
 public StudentMustafa GetStudentDetailsWithRegistrationNo(StudentMustafa student)
 {
     return(aViewResultGateway.GetStudentDetailsWithRegistrationNo(student));
 }
예제 #14
0
 public StudentMustafa GetStudentDetailsWithRegistrationNo(StudentMustafa student)
 {
     return(anEnrollCourseGateway.GetStudentDetailsWithRegistrationNo(student));
 }