Ejemplo n.º 1
0
        /// <summary>
        /// �����ظ�
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnReply_Click(object sender, EventArgs e)
        {
            int postID = int.Parse(Request.QueryString["id"]);

            LabMS.BLL.PostReply postReply = new LabMS.BLL.PostReply();
            LabMS.Model.PostReply postReplyInfo = new LabMS.Model.PostReply();

            postReplyInfo.ReplierID = 1; // TBD
            postReplyInfo.PosterID = postID;
            postReplyInfo.PostReplyContent = Server.HtmlEncode(ReplyNew.Text);
            postReplyInfo.PostReplyTime = DateTime.Now;

            postReply.Add(postReplyInfo);

            // �󶨻ظ�
            BindReply();

            ReplyNew.Text = "";
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 新增回复
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnReply_Click(object sender, EventArgs e)
        {
            int postID = int.Parse(Request.QueryString["postID"]);

            LabMS.BLL.PostReply postReply = new LabMS.BLL.PostReply();
            LabMS.Model.PostReply postReplyInfo = new LabMS.Model.PostReply();

            postReplyInfo.ReplierID = int.Parse(Session["UserID"].ToString());
            postReplyInfo.ReplierType = Base.PrivilegeManager.GetUserTypeCode();

            postReplyInfo.PosterID = postID;
            postReplyInfo.PostReplyContent = Server.HtmlEncode(ReplyNew.Text);
            postReplyInfo.PostReplyTime = DateTime.Now;

            postReply.Add(postReplyInfo);

            // 绑定回复
            GetPost();
            GetReplies();

            ReplyNew.Text = "";
        }
Ejemplo n.º 3
0
        /// <summary>
        /// ��������
        /// </summary>
        /// <param name="ds"></param>
        /// <returns></returns>
        protected DataSet HandleData(DataSet ds)
        {
            ds.Tables[0].Columns.Add("PostUserName");
            ds.Tables[0].Columns.Add("PostReplyLatestTime");

            ExtendBLL.Post post = new ExtendBLL.Post();
            LabMS.Model.PostReply prInfo = new LabMS.Model.PostReply();

            string authorName = String.Empty;
            string preName = String.Empty;

            for (int i = ds.Tables[0].Rows.Count - 1; i > -1; i--)
            {
                prInfo = post.GetLatestReply(int.Parse(ds.Tables[0].Rows[i]["ID"].ToString()));

                if (prInfo != null)
                {
                    ds.Tables[0].Rows[i]["PostReplyLatestTime"] = prInfo.PostReplyTime;
                }

                authorName = post.GetAuthorName(int.Parse(ds.Tables[0].Rows[i]["PosterID"].ToString()), ds.Tables[0].Rows[i]["PosterType"].ToString());
                preName = post.GetAuthorNamePrefix(ds.Tables[0].Rows[i]["PosterType"].ToString());

                ds.Tables[0].Rows[i]["PostUserName"] = preName + (string.IsNullOrEmpty(authorName) ? " <del>��ɾ���û�</del>" : authorName);
                // TBD ɾ��û��Ȩ���Ķ�������
            }

            return ds;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// ��ȡ���Ļظ�
        /// </summary>
        /// <param name="postID">���ӱ�ʶ</param>
        /// <returns></returns>
        public LabMS.Model.PostReply GetLatestReply(int postID)
        {
            LabMS.Model.PostReply model = new LabMS.Model.PostReply();

            System.Data.DataSet ds = Maticsoft.DBUtility.DbHelperSQL.Query("select top 1 * from PostReply where PosterID = @postID order by [ID] desc ",
                new System.Data.SqlClient.SqlParameter("@postID", postID));
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                model.PostReplyContent = ds.Tables[0].Rows[0]["PostReplyContent"].ToString();
                if (ds.Tables[0].Rows[0]["PosterID"].ToString() != "")
                {
                    model.PosterID = int.Parse(ds.Tables[0].Rows[0]["PosterID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PostReplyTime"].ToString() != "")
                {
                    model.PostReplyTime = DateTime.Parse(ds.Tables[0].Rows[0]["PostReplyTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ReplierID"].ToString() != "")
                {
                    model.ReplierID = int.Parse(ds.Tables[0].Rows[0]["ReplierID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ReplierType"].ToString() != "")
                {
                    model.ReplierType = int.Parse(ds.Tables[0].Rows[0]["ReplierType"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public LabMS.Model.PostReply GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 [ID],PostReplyContent,PosterID,PostReplyTime,ReplierID,ReplierType from PostReply ");
            strSql.Append(" where [ID]=@ID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)};
            parameters[0].Value = ID;

            LabMS.Model.PostReply model=new LabMS.Model.PostReply();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                if(ds.Tables[0].Rows[0]["ID"].ToString()!="")
                {
                    model.ID=int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                model.PostReplyContent=ds.Tables[0].Rows[0]["PostReplyContent"].ToString();
                if(ds.Tables[0].Rows[0]["PosterID"].ToString()!="")
                {
                    model.PosterID=int.Parse(ds.Tables[0].Rows[0]["PosterID"].ToString());
                }
                if(ds.Tables[0].Rows[0]["PostReplyTime"].ToString()!="")
                {
                    model.PostReplyTime=DateTime.Parse(ds.Tables[0].Rows[0]["PostReplyTime"].ToString());
                }
                if(ds.Tables[0].Rows[0]["ReplierID"].ToString()!="")
                {
                    model.ReplierID=int.Parse(ds.Tables[0].Rows[0]["ReplierID"].ToString());
                }
                if(ds.Tables[0].Rows[0]["ReplierType"].ToString()!="")
                {
                    model.ReplierType=int.Parse(ds.Tables[0].Rows[0]["ReplierType"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }