public List <StudentResultView> GetStudentResultByStudentId(int?studentId)
        {
            string query = "SELECT * FROM StudentResultView WHERE StudentId = '" + studentId + "' AND Action = 'Enrolled' ORDER BY CourseCode ASC";

            Command = new SqlCommand(query, Connection);
            Connection.Open();
            List <StudentResultView> studentResultViews = new List <StudentResultView>();

            Reader = Command.ExecuteReader();
            while (Reader.Read())
            {
                StudentResultView studentResultView = new StudentResultView();
                studentResultView.StudentId          = (int)Reader["StudentId"];
                studentResultView.StudentName        = Reader["StudentName"].ToString();
                studentResultView.Email              = Reader["Email"].ToString();
                studentResultView.RegistrationNumber = Reader["RegistrationNumber"].ToString();
                studentResultView.DepartmentId       = (int)Reader["DepartmentId"];
                studentResultView.DepartmentName     = Reader["DepartmentName"].ToString();
                studentResultView.CourseId           = (int)Reader["CourseId"];
                studentResultView.CourseCode         = Reader["CourseCode"].ToString();
                studentResultView.CourseTitle        = Reader["CourseTitle"].ToString();
                studentResultView.Credit             = (double)Reader["Credit"];
                studentResultView.GradeLatter        = Reader["GradeLatter"].ToString();
                if (studentResultView.GradeLatter != "Not Graded Yet")
                {
                    studentResultView.GradeId = (int)Reader["GradeId"];
                }
                studentResultView.GradePoint = (decimal)Reader["GradePoint"];
                studentResultViews.Add(studentResultView);
            }
            Reader.Close();
            Connection.Close();
            return(studentResultViews);
        }
예제 #2
0
        public List <StudentResultView> GetStudentResultViewByStudentId(int studentId)
        {
            Query = " select * From GetstudentResult where StudentId='" + studentId + "'";

            Command = new SqlCommand(Query, Connection);

            Connection.Open();

            Reader = Command.ExecuteReader();

            List <StudentResultView> resultViews = new List <StudentResultView>();

            while (Reader.Read())
            {
                StudentResultView resultView = new StudentResultView();

                //resultView.Id = (int)Reader["Id"];
                //resultView.CourseId = (int)Reader["CourseId"];
                resultView.StudentId = (int)Reader["studentId"];
                resultView.Code      = Reader["Code"].ToString();
                resultView.Name      = Reader["Name"].ToString();
                resultView.Grade     = Reader["Grade"].ToString();

                resultViews.Add(resultView);
            }
            Reader.Close();
            Connection.Close();
            return(resultViews);
        }
예제 #3
0
 public IEnumerable <StudentResultView> GetStudentResult()
 {
     try
     {
         connection = new SqlConnection(connectionString);
         string query = "SELECT *FROM StudentResultView";
         command = new SqlCommand(query, connection);
         List <StudentResultView> studentResultViews = new List <StudentResultView>();
         connection.Open();
         reader = command.ExecuteReader();
         while (reader.Read())
         {
             StudentResultView studentResult = new StudentResultView();
             {
                 studentResult.StudentId = Convert.ToInt32(reader["studentId"].ToString());
                 studentResult.Code      = reader["code"].ToString();
                 studentResult.Name      = reader["courseName"].ToString();
                 studentResult.Grade     = reader["grade"].ToString();
             };
             studentResultViews.Add(studentResult);
         }
         reader.Close();
         return(studentResultViews);
     }
     catch (Exception exception)
     {
         throw new Exception("Unable to connect ", exception);
     }
     finally
     {
         connection.Close();
     }
 }
예제 #4
0
        private void InitializeStudentResult()
        {
            var resultModel = new ResultModel();
            StudentResultPresenter presenter = new StudentResultPresenter(resultModel);

            var studentResultView = new StudentResultView();

            compContainer.AttachView(studentResultView);

            studentResultView.AttachToPresenter(presenter, true);

            checkButton.Tag = studentResultView;
        }
        public List <StudentResultView> GetCoursesByStudent(int id)
        {
            string query = "SELECT * FROM StudentResultView WHERE StudentId = @id and Flag = @Flag";

            Command = new SqlCommand(query, Connection);
            Command.Parameters.AddWithValue("@id", id);
            Command.Parameters.AddWithValue("@Flag", 1);
            List <StudentResultView> resultViewList = new List <StudentResultView>();

            Connection.Open();
            Reader = Command.ExecuteReader();
            while (Reader.Read())
            {
                StudentResultView studentResultView = new StudentResultView();
                studentResultView.CourseName = Reader["CourseName"].ToString();
                studentResultView.CourseId   = Convert.ToInt32(Reader["CourseId"]);
                resultViewList.Add(studentResultView);
            }
            Reader.Close();
            Connection.Close();
            return(resultViewList);
        }