public CommentViewModel(MBlogModel.Comment comment)
 {
     Comment   = BBCode.ToHtml(comment.CommentText);
     Commented = comment.Commented;
     EMail     = comment.EMail;
     Name      = comment.Name ?? "Anonymous";
 }
Exemple #2
0
    private void generateTopic()
    {
        string         sql = "SELECT UserDetails.UName, UserDetails.ProfileID, UserDetails.USign, UserDetails.UType, ReplyDate, ReplyContent, ReplyID, ReplyStatus, UserDetails.Username FROM Reply LEFT JOIN UserDetails ON Reply.ReplyCreator = UserDetails.Username WHERE TopicID= @tid AND (ReplyStatus= @status OR ReplyStatus= @status2) ORDER BY ReplyDate";
        SqlDataAdapter da  = new SqlDataAdapter(sql, con);

        da.SelectCommand.Parameters.AddWithValue("@tid", Request.QueryString["title"].ToString());
        da.SelectCommand.Parameters.AddWithValue("@status", "Active");
        da.SelectCommand.Parameters.AddWithValue("@status2", "Deleted");
        SqlConnectionStringBuilder cmdbuild = new SqlConnectionStringBuilder();
        DataTable dt = new DataTable();

        da.Fill(dt);
        con.Close();
        int page        = Convert.ToInt32(Request.QueryString["page"].ToString());
        int startingrow = (page - 1) * rowToPrint;
        int endingrow   = (page * rowToPrint);

        if (endingrow > dt.Rows.Count)
        {
            endingrow = dt.Rows.Count;
        }

        for (int i = startingrow; i < endingrow; i++)
        {
            string title = dt.Rows[i]["Username"].ToString();
            //if (title.Equals(string.Empty))
            //{
            //    title = dt.Rows[i]["Username"].ToString();
            //}
            NameValueCollection queryString = HttpUtility.ParseQueryString(string.Empty);
            queryString["id"] = dt.Rows[i]["ProfileID"].ToString();
            string imageurl = "ProfileImageHandler.ashx?" + queryString;
            string username = dt.Rows[i]["Username"].ToString();
            string date     = getDataTableDate(dt.Rows[i]["ReplyDate"]);
            string content  = dt.Rows[i]["ReplyContent"].ToString();
            string userType = dt.Rows[i]["UType"].ToString();
            if (userType.Equals("User"))
            {
                userType = "Member";
            }
            else if (userType.Equals("Moderator") || userType.Equals("Admin"))
            {
                userType = "Moderator";
            }
            string userStatus  = dt.Rows[i]["USign"].ToString();
            string replyID     = dt.Rows[i]["ReplyID"].ToString();
            int    replyStatus = dt.Rows[i]["ReplyStatus"].ToString().Equals("Active")?1:2;
            content = BBCode.ToHtml(content);
            generateReply(title, imageurl, date, content, userType, userStatus, replyID, replyStatus, username);
            //generateReply(title, imageurl, date, content);
        }
        int fullpageNumber = dt.Rows.Count / rowToPrint;
        int lastpageNumber = dt.Rows.Count % rowToPrint;

        if (lastpageNumber != 0)
        {
            fullpageNumber += 1;
        }
        generatePagination(page, fullpageNumber);
    }
Exemple #3
0
    protected void AssignmentRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        ApplicationDbContext dbContext = new ApplicationDbContext();

        int assignmentId = int.Parse(e.CommandArgument.ToString());

        Assignment assignment = dbContext.Assignments.Where(a => a.Id == assignmentId).FirstOrDefault();

        AssignmentTitleLabel.Text = assignment.Title;

        try
        {
            AssignmentContentLabel.Text = BBCode.ToHtml(assignment.Content);
        }
        catch
        {
            AssignmentContentLabel.Text = "Some tags did not load correctly<br />" + assignment.Content;
        }

        Session["CurrentAssignment"] = assignment;

        SubmissionRepeater.DataBind();
        GradeSubmissionView.DataBind();

        HomePanel.Visible       = false;
        AssignmentPanel.Visible = true;

        ActivePanelLabel.Text = "Assignments";
    }
Exemple #4
0
    protected void LessonRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        ApplicationDbContext dbContext = new ApplicationDbContext();

        int lessonId = int.Parse(e.CommandArgument.ToString());

        Lesson lesson = dbContext.Lessons.Where(l => l.Id == lessonId).FirstOrDefault();

        LessonTitleLabel.Text = lesson.Title;

        try
        {
            LessonContentLabel.Text = BBCode.ToHtml(lesson.Content);
        }
        catch
        {
            LessonContentLabel.Text = "Some tags did not load correctly<br />" + lesson.Content;
        }

        Session["CurrentLesson"] = lesson;
        //currentLesson = lesson;

        LessonAttachmentRepeater.DataBind();

        HomePanel.Visible   = false;
        LessonPanel.Visible = true;

        ActivePanelLabel.Text = "Lessons";
    }
 public void DefaultParserWellconfigured()
 {
     try
     {
         BBCode.ToHtml(RandomValue.String());
     }
     catch (BBCodeParsingException)
     {
     }
 }
Exemple #6
0
 public void DefaultParserWellconfigured([PexAssumeNotNull] string input)
 {
     try
     {
         BBCode.ToHtml(input);
     }
     catch (BBCodeParsingException)
     {
     }
 }
Exemple #7
0
 public override bool IsValid(object value)
 {
     try
     {
         BBCode.ToHtml(value.ToString());
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }