public int AddStudentSubject(StudentSubject studentSubject)
        {
            StudentSubjectDao = new StudentSubjectDao();

            //convert from business object to data access object

            DataAccess.Domain.StudentSubject studentSubjectData = new DataAccess.Domain.StudentSubject { UserId = studentSubject.UserId, SubjectName = studentSubject.SubjectName, SubjectCode = studentSubject.SubjectCode, AssignmentName = studentSubject.AssignmentName, SubjectDescription = studentSubject.SubjectDescription, Assignment = studentSubject.Assignment, AssignmentSize = studentSubject.AssignmentSize };

            return StudentSubjectDao.AddStudentSubject(studentSubjectData);
        }
        public StudentSubject GetAssignemnt(int studentSubjectId)
        {
            StudentSubjectDao = new StudentSubjectDao();

            //convert from business object to data access object

            DataAccess.Domain.StudentSubject studentSubjectData = new DataAccess.Domain.StudentSubject { StudentSubjectId = studentSubjectId };

            studentSubjectData = StudentSubjectDao.GetStudentSubject(studentSubjectData);

            // map data objects to business objects

            StudentSubject studentSubject = new StudentSubject() { UserId = studentSubjectData.UserId, SubjectName = studentSubjectData.SubjectName, SubjectDescription = studentSubjectData.SubjectDescription, SubjectCode = studentSubjectData.SubjectCode, StudentSubjectId = studentSubjectData.StudentSubjectId, AssignmentName = studentSubjectData.AssignmentName, Assignment = studentSubjectData.Assignment, AssignmentSize = studentSubjectData.AssignmentSize };

            return studentSubject;
        }
        public List<StudentSubject> GetStudentSubjects(User user, string studentId)
        {
            List<StudentSubject> list = new List<StudentSubject>();

            StudentSubjectDao = new StudentSubjectDao();

            //convert from business object to data access object
            int userIdToUse = 0;

            if (user.UserType == UserType.Employer)
            {
               // get it from student dao

                UserDao = new UserDao();
                 // go into data access open connection, bring query, fill in datatable
                DataTable resultDataTable = UserDao.GetUser("select * from WAE_LTU_USER where student_id='" + studentId + "'");

                if (resultDataTable.Rows.Count == 1)
                {
                    DataRow userRecord = resultDataTable.Rows[0];
                    userIdToUse = (int)userRecord.ItemArray[0];
                }
            }
            else if (user.UserType == UserType.Student)
            {
                userIdToUse = Convert.ToInt32(user.UserId);
            }
            else
            {
                throw new ArgumentOutOfRangeException();
            }

            DataAccess.Domain.User userData = new DataAccess.Domain.User { UserId = userIdToUse };

            List<DataAccess.Domain.StudentSubject> studentSubjectDataList = StudentSubjectDao.GetStudentSubjects(userData);

            // map list of data objects to business objects

            foreach (DataAccess.Domain.StudentSubject record in studentSubjectDataList)
            {
                var businessStudentSubject = new StudentSubject{ UserId = record.UserId, Assignment= record.Assignment, AssignmentName= record.AssignmentName, StudentSubjectId= record.StudentSubjectId, SubjectCode = record.SubjectCode, SubjectDescription = record.SubjectDescription, SubjectName= record.SubjectName};
                list.Add(businessStudentSubject);
            }

            return list;
        }