public string insertNewMessage(string courseCode, string courseNumber, string userId, string message)
        {
            QandATableAdapter qaAdapter = new QandATableAdapter();
            CourseTableAdapter courseAdapter = new CourseTableAdapter();
            AssetTableAdapter assetAdapter = new AssetTableAdapter();
            var table = courseAdapter.GetIdByCourseDetails(courseCode, Convert.ToInt32(courseNumber));
            if (table.Count > 0)
            {

                qaAdapter.InsertNewQuestion(message, Convert.ToInt32(userId), null, null, DateTime.Now, null, Convert.ToInt32(table[0].Id));
                var qaTable = qaAdapter.GetMessageListByCourseId(Convert.ToInt32(table[0].Id));
                int qaID = qaTable[qaTable.Count-1].Id;
                assetAdapter.InsertAsset(qaID.ToString(), qaID.ToString(), 3104);
                return "success";
            }
            return "failed";
        }
        public MessageBox GetMessageBox(string courseCode, string courseNumber)
        {
            MessageBox messageBox = new MessageBox(courseCode + courseNumber, "");
            QandATableAdapter qaAdapter = new QandATableAdapter();
            CourseTableAdapter courseAdapter = new CourseTableAdapter();
            var courseIdList = courseAdapter.GetIdByCourseDetails(courseCode, Convert.ToInt32(courseNumber));
            int courseId = courseIdList[0].Id;
            var qaTable = qaAdapter.GetMessageListByCourseId(courseId);
            AnswerTypeTableAdapter answerTypeAdapter = new AnswerTypeTableAdapter();
            UserDataTableAdapter userAdapter = new UserDataTableAdapter();
            foreach (var row in qaTable)
            {
                int userId = row.AskedBy;
                string username = userAdapter.GetUserDataById(userId)[0].Username;
                Message message = new Message(username, row.Question);
                message.createTime = row.CreatedTime.ToString("G");
                message.messageId = row.Id;
                try
                {
                    Answer answer = new Answer(row.AnswerType, row.Answer);
                    message.addAnswer(answer);
                }
                catch (StrongTypingException e)
                {

                }
                messageBox.addMessage(message);
            }
            return messageBox;
        }