Esempio n. 1
0
        public List<RosterSearchResult> RosterUserSearch(RosterStudent studentSearch)
        {
            List<RosterSearchResult> students = new List<RosterSearchResult>();

            using (var cn = new SqlConnection(Settings.GetConnectionString()))
            {
                var cmd = new SqlCommand("RosterGetStudentsNotInCourse", cn);
                cmd.CommandType = CommandType.StoredProcedure;

                if (!string.IsNullOrEmpty(studentSearch.LastName))
                    cmd.Parameters.Add(new SqlParameter("@LastName", studentSearch.LastName));

                if (studentSearch.GradeLevelID != null)
                    cmd.Parameters.Add(new SqlParameter("@GradeLevelID", studentSearch.GradeLevelID));

                cmd.Parameters.AddWithValue("@CourseID", studentSearch.CourseID);

                cn.Open();
                using (var dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        var student = new RosterSearchResult();
                        student.UserID = (int)dr["UserID"];
                        student.FirstName = dr["FirstName"].ToString();
                        student.LastName = dr["LastName"].ToString();
                        student.GradeLevelName = dr["GradeLevelName"].ToString();

                        students.Add(student);
                    }
                }
            }
            return students;
        }
Esempio n. 2
0
        public List<RosterStudent> GetRosterStudents(int teacherID, int courseID)
        {
            List<RosterStudent> students = new List<RosterStudent>();

            using (var cn = new SqlConnection(Settings.GetConnectionString()))
            {
                var cmd = new SqlCommand("RosterGetStudentsInCourse", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@TeacherID", teacherID);
                cmd.Parameters.AddWithValue("@CourseID", courseID);

                cn.Open();
                using (var dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        var student = new RosterStudent();
                        student.FirstName = dr["FirstName"].ToString();
                        student.LastName = dr["LastName"].ToString();
                        student.Email = dr["Email"].ToString();
                        student.IsDeleted = (bool)dr["IsDeleted"];
                        if (dr["GradeLevelID"] != DBNull.Value)
                            student.GradeLevelID = (byte)dr["GradeLevelID"];
                        student.RosterID = (int)dr["RosterID"];
                        student.CourseID = (int)dr["CourseID"];

                        students.Add(student);
                    }
                }
            }

            return students;
        }
Esempio n. 3
0
        public void AddStudent(RosterStudent student)
        {
            using (var cn = new SqlConnection(Settings.GetConnectionString()))
            {
                var cmd = new SqlCommand("RosterInsertStudent", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@CourseID", student.CourseID);
                cmd.Parameters.AddWithValue("@UserID", student.UserID);
                cmd.Parameters.AddWithValue("@CurrentGrade", student.CurrentGrade);

                cn.Open();
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 4
0
        public ActionResult Roster(RosterStudent student)
        {
            student.CourseID = 2;
            var studentSearch = _lmsRosterManager.RosterUserSearch(student);
            var currentUser = IdentityHelper.GetLmsUserForCurrentUser(this);
            var roster = _lmsRosterManager.GetRosterStudents(currentUser.UserID, 2);

            RosterViewModel model = new RosterViewModel();

            model.CreateGradeLevel(_lmsGradeLevelManager.GradeLevelGetAll());
            model.StudentSearchResults = studentSearch.Data;
            model.CourseRoster = roster.Data;

            return View(model);
        }
Esempio n. 5
0
        public DataResponse<List<RosterSearchResult>> RosterUserSearch(RosterStudent student)
        {
            var response = new DataResponse<List<RosterSearchResult>>();

            try
            {
                response.Data = _lmsRosterRepository.RosterUserSearch(student);
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
            }

            return response;
        }      
Esempio n. 6
0
 public void AddStudent(RosterStudent student)
 {
     _lmsRosterRepository.AddStudent(student);
 }