示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            String _id = Request.QueryString["topic"];
            if (!String.IsNullOrEmpty(_id))
            {
                if (Regex.IsMatch(_id, @"^\d+$"))
                {
                    ForumTopics _topic = new ForumTopics(this.ConnectionString);
                    _topic.LitePopulate(_id, true);

                    if (!_topic.IsEmpty())
                    {
                        ViewState["topic"] = _topic.ID.ToString();
                        lbl_Title.Text = _topic.Title;
                        lbl_Story.Text = _topic.Topic;
                        BindData(_topic);
                    }
                    else
                    {
                        NoIdSupply();
                    }
                }
                else
                {
                    NoIdSupply();
                }
            }
            else
            {
                NoIdSupply();
            }
        }
    }
示例#2
0
    protected void PostComment_Click(Object sender, EventArgs e)
    {
        String _id = ViewState["topic"].ToString();
        CustomProfile _profile = (CustomProfile)HttpContext.Current.Profile;
        ForumTopics _newTopic = new ForumTopics(this.ConnectionString);
        _newTopic.Topic = txt_Topic.Text;
        _newTopic.ParentId = Convert.ToInt32(_id);
        _newTopic.Status = Convert.ToInt32(Enums.enumStatuses.Active);
        _newTopic.CultureInfo = _profile.Culture;
        if (_newTopic.Save())
        {
            pnl_Threads.Visible = true;
            pnl_PostForm.Visible = false;
            span_Post.Visible = true;
            txt_Topic.Text = "";

            ForumTopics _topic = new ForumTopics(this.ConnectionString);
            _topic.LitePopulate(_id, true);

            BindData(_topic);
        }
        else
        {
            this.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "alert('An unexpected error has occurred. Please try again.');", true);
        }
    }