Пример #1
0
    protected void btnCommit_Click(object sender, EventArgs e)
    {
        if (txtTilte.Text.Length == 0)
        {
            Javascript.GoHistory(-1, "请填写标题!", Page);
            return;
        }

        if (Textarea1.Value.Length == 0)
        {
            Javascript.GoHistory(-1, "请填写内容!", Page);
            return;
        }

        DalOperationAboutBbs dalOperationAboutBbs = new DalOperationAboutBbs();
        UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();
        BbsTopics topic = new BbsTopics
        {
            courseNo = Request["forumId"],
            topicTitle = CommonUtility.JavascriptStringFilterAll(txtTilte.Text),
            topicContent = CommonUtility.JavascriptStringFilterAll(Textarea1.Value),
            topicUserName = (UserCookiesInfo.userType != 3) ? UserCookiesInfo.userName : UserCookiesInfo.userNo + "  " + UserCookiesInfo.userName,
            updateTime = DateTime.Now,
            topicUserNo = UserCookiesInfo.userNo,
            topicUserType = UserCookiesInfo.userType,
            isbigTop=1
        };
        if (hidAttachmentId.Value.CompareTo(string.Empty) != 0)
        {
            topic.attachmentIds = hidAttachmentId.Value;
        }
        if (hasControls(Request["forumId"]))
        {
            dalOperationAboutBbs.AddTopicByForumId(topic);//添加新话题
        }
        else
        {
            Javascript.GoHistory(-1, "您没有权限!", Page);
        }
        Javascript.RefreshParentWindow("BBSTopicList.aspx?tagName=" + Request["tagName"] + "&tag=2&forumId=" + Request["forumId"], Page);
    }
Пример #2
0
    // /// <summary>
    ///// 提交话题标签功能代码
    // /// </summary>
    // /// <param name="sender"></param>
    // /// <param name="e"></param>
    protected void btnCommit_Click(object sender, EventArgs e)
    {
        if (txtTilte.Text.Length == 0)
        {
            Javascript.GoHistory(-1, "请填写标题!", Page);
            return;
        }

        if (Textarea1.Value.Length == 0)
        {
            Javascript.GoHistory(-1, "请填写回复内容!", Page);
            return;
        }
        string tag = Request["tag"];
        if (tag == "1")
        {
            forumId = Request["forumId"].Trim() + Server.UrlDecode(Request["classID"].Trim()) + Request["termtag"].Trim();
        }
        DalOperationAboutBbs dalOperationAboutBbs = new DalOperationAboutBbs();
        UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();
        BbsTopics topic = new BbsTopics
        {
            courseNo = forumId,
            topicTitle = CommonUtility.JavascriptStringFilterAll(txtTilte.Text),
            topicContent = CommonUtility.JavascriptStringFilterAll(Textarea1.Value),
            topicUserName = (UserCookiesInfo.userType != 3) ? UserCookiesInfo.userName : UserCookiesInfo.userNo + "  " + UserCookiesInfo.userName,
            updateTime = DateTime.Now,
            topicUserNo = UserCookiesInfo.userNo,
            topicUserType = UserCookiesInfo.userType
        };
        if (hidAttachmentId.Value.CompareTo(string.Empty) != 0)
        {
            topic.attachmentIds = hidAttachmentId.Value;
        }
        dalOperationAboutBbs.AddTopicByForumId(topic);//添加新话题
        Javascript.AlertAndRedirect("添加主题成功!", "BBSTopicList.aspx?forumId=" + Request["forumId"] + "&classID=" + Server.UrlDecode(Request["classID"]) + "&termTag=" + Request["termTag"] + "&tag=" + tag, Page);
    }
Пример #3
0
        /// <summary>
        /// 添加主题
        /// </summary>
        /// <param name="bbsTopics">主题信息对象</param>
        /// <returns>添加的记录数</returns>
        public int AddTopicByForumId(BbsTopics bbsTopics)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@topicUserName", SqlDbType.NChar,20),
                    new SqlParameter("@topicTitle", SqlDbType.NChar,50),
                    new SqlParameter("@topicContent", SqlDbType.NText),

                    new SqlParameter("@courseNo", SqlDbType.NVarChar,50),

                    new SqlParameter("@attachmentIds", SqlDbType.NVarChar,200),
                    new SqlParameter("@userNo", SqlDbType.NVarChar,50),
                    new SqlParameter("@userType", SqlDbType.Int),
                    new SqlParameter("@isBigTop",SqlDbType.Int,4)
                    };
            parameters[0].Value = bbsTopics.topicUserName;
            parameters[1].Value = bbsTopics.topicTitle;
            parameters[2].Value = bbsTopics.topicContent;
            parameters[3].Value = bbsTopics.courseNo;
            parameters[4].Value = bbsTopics.attachmentIds;
            parameters[5].Value =bbsTopics.topicUserNo;
            parameters[6].Value =bbsTopics.topicUserType;
            parameters[7].Value = bbsTopics.isbigTop;

            return SqlHelper.ExecuteNonQuery(conn, CommandType.Text,"INSERT INTO [usta_BbsTopics]([topicUserName],[topicTitle],[topicContent],[courseNo],[attachmentIds],[topicUserNo],[topicUserType],[isbigTop])VALUES(@topicUserName,@topicTitle,@topicContent,@courseNo,@attachmentIds,@userNo,@userType,@isbigTop)", parameters);
        }
Пример #4
0
        /// <summary>
        /// 获取主题信息
        /// </summary>
        ///  <param name="topicId">话题编号</param>
        /// <returns>主题对象</returns>
        public BbsTopics FindTopicById(int topicId)
        {
            BbsTopics topic = null;
            string commandstring = "select topicId,topicUserName, topicTitle,topicContent, hits,courseNo,updateTime,attachmentIds,isTop ";
                   commandstring+="from dbo.usta_BbsTopics ";
                   commandstring += "where topicId=@topicId";
            SqlParameter[] parameters = new SqlParameter[1]{
                new SqlParameter("@topicId",topicId)
            };

            SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.Text, commandstring, parameters);
            if (dr.Read())
            {
                topic = new BbsTopics
                {
                    topicId = int.Parse(dr["topicId"].ToString().Trim()),
                    topicUserName = dr["topicUserName"].ToString().Trim(),
                    topicTitle = dr["topicTitle"].ToString().Trim(),
                    topicContent = dr["topicContent"].ToString().Trim(),
                    hits = int.Parse(dr["hits"].ToString().Trim()),
                    courseNo = dr["courseNo"].ToString().Trim(),
                    updateTime =DateTime.Parse(dr["updateTime"].ToString().Trim()),
                    attachmentIds = dr["attachmentIds"].ToString().Trim(),
                    isTop = int.Parse(dr["isTop"].ToString().Trim())
                };
            }
            dr.Close();
            conn.Close();
            return topic;
        }