Esempio n. 1
0
        public List <AnswerComment> GenModel4mDS(DataSet dsAnswerComments)
        {
            AnswerComment model = new AnswerComment();

            model.AnswerComments = new List <AnswerComment>();

            if (dsAnswerComments.RowsExists())
            {
                DataTable dtAnswerComments = dsAnswerComments.Tables[0];

                for (int i = 0; i < dtAnswerComments.Rows.Count; i++)
                {
                    AnswerComment item = new AnswerComment();
                    item.CommentBy           = int.Parse(dtAnswerComments.Rows[i]["CommentBy"].ToString());
                    item.CommentByUname      = dtAnswerComments.Rows[i]["CommentByUname"].ToString();
                    item.CommentByMarksScore = int.Parse(dtAnswerComments.Rows[i]["CommentByMarksScore"].ToString());
                    item.CommentDt           = DateTime.Parse(dtAnswerComments.Rows[i]["CommentDt"].ToString());
                    item.CommentEdits        = int.Parse(dtAnswerComments.Rows[i]["CommentEdits"].ToString());
                    item.CommentId           = int.Parse(dtAnswerComments.Rows[i]["CommentId"].ToString());
                    if (dtAnswerComments.Rows[i]["CommentMarksEarned"].ToString() != "")
                    {
                        item.CommentMarksEarned = int.Parse(dtAnswerComments.Rows[i]["CommentMarksEarned"].ToString());
                    }
                    item.CommentStatus   = int.Parse(dtAnswerComments.Rows[i]["CommentStatus"].ToString());
                    item.CommentStatusBy = int.Parse(dtAnswerComments.Rows[i]["CommentStatusBy"].ToString());
                    item.CommentTxt      = dtAnswerComments.Rows[i]["CommentTxt"].ToString().SanitizeOutput();
                    item.AnswerId        = int.Parse(dtAnswerComments.Rows[i]["AnswerId"].ToString());
                    model.AnswerComments.Add(item);
                }
            }
            return(model.AnswerComments);
        }
Esempio n. 2
0
 public static AnswerComment InitializeIfNone(AnswerComment answerComment)
 {
     if (answerComment == null)
     {
         answerComment = new UI.Models.AnswerComment();
         answerComment.AnswerComments = new List <UI.Models.AnswerComment>();
     }
     return(answerComment);
 }