Exemplo n.º 1
0
        public List <QuestionComment> GenModel4mDS(DataSet dsQuestionComments)
        {
            QuestionComment model = new QuestionComment();

            model.QuestionComments = new List <QuestionComment>();

            if (dsQuestionComments.RowsExists())
            {
                DataTable dtQuestionComments = dsQuestionComments.Tables[0];

                for (int i = 0; i < dtQuestionComments.Rows.Count; i++)
                {
                    QuestionComment item = new QuestionComment();
                    item.CommentBy           = int.Parse(dtQuestionComments.Rows[i]["CommentBy"].ToString());
                    item.CommentByUname      = dtQuestionComments.Rows[i]["CommentByUname"].ToString();
                    item.CommentByMarksScore = int.Parse(dtQuestionComments.Rows[i]["CommentByMarksScore"].ToString());
                    item.CommentDt           = DateTime.Parse(dtQuestionComments.Rows[i]["CommentDt"].ToString());
                    item.CommentEdits        = int.Parse(dtQuestionComments.Rows[i]["CommentEdits"].ToString());
                    item.CommentId           = int.Parse(dtQuestionComments.Rows[i]["CommentId"].ToString());
                    if (dtQuestionComments.Rows[i]["CommentMarksEarned"].ToString() != "")
                    {
                        item.CommentMarksEarned = int.Parse(dtQuestionComments.Rows[i]["CommentMarksEarned"].ToString());
                    }
                    item.CommentStatus   = int.Parse(dtQuestionComments.Rows[i]["CommentStatus"].ToString());
                    item.CommentStatusBy = int.Parse(dtQuestionComments.Rows[i]["CommentStatusBy"].ToString());
                    item.CommentTxt      = dtQuestionComments.Rows[i]["CommentTxt"].ToString().SanitizeOutput();
                    item.CommentTxtHtml  = dtQuestionComments.Rows[i]["CommentTxtHtml"].ToString().SanitizeOutput();
                    item.QuestionId      = int.Parse(dtQuestionComments.Rows[i]["QuestionId"].ToString());
                    model.QuestionComments.Add(item);
                }
            }
            return(model.QuestionComments);
        }
Exemplo n.º 2
0
 public static QuestionComment InitializeIfNone(QuestionComment questionComment)
 {
     if (questionComment == null)
     {
         questionComment = new UI.Models.QuestionComment();
         questionComment.QuestionComments = new List <UI.Models.QuestionComment>();
     }
     return(questionComment);
 }