예제 #1
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;
        }
예제 #2
0
        /// <summary>
        /// 处理回复
        /// </summary>
        /// <param name="ds"></param>
        /// <returns></returns>
        protected void HandleReply(DataSet ds)
        {
            dsReplies.Tables.Add("replies");
            dsReplies.Tables[0].Columns.AddRange(new DataColumn[] {
                new DataColumn("ID"),
                new DataColumn("PostReplyContent"),
                new DataColumn("PosterID"),
                new DataColumn("PostReplyTime"),
                new DataColumn("ReplierID"),
                new DataColumn("ReplierType"),
                new DataColumn("ReplierName"),
                new DataColumn("PostReplySN")
            });

            DataRow row;
            int count = ds.Tables[0].Rows.Count;
            int current = AspNetPager.PageSize * (AspNetPager.CurrentPageIndex - 1) + 1;

            ExtendBLL.Post post = new ExtendBLL.Post();
            string replierName = String.Empty;

            for (int i = current - 1; (i < current + AspNetPager.PageSize - 1) && (i < count); i++)
            {
                row = ds.Tables[0].Rows[i];

                replierName = post.GetAuthorName(int.Parse(row["ReplierID"].ToString()), row["ReplierType"].ToString());

                dsReplies.Tables[0].Rows.Add(
                    row["ID"],
                    row["PostReplyContent"],
                    row["PosterID"],
                    row["PostReplyTime"],
                    row["ReplierID"],
                    row["ReplierType"],
                    string.IsNullOrEmpty(replierName) ? "<del>已删除用户</del>" : replierName,
                    i + 1
                );
            }
        }