コード例 #1
0
ファイル: Post_dal.cs プロジェクト: swindyDeer/Fashion
        //将一条数据转化为Post-model数据
        //帖子的第一张图片,内容的前200个字符
        public Post_model ToPictureModel(DataRow row)
        {
            Post_model post_model = new Post_model();

            post_model.postContent       = row["content"].ToString();            //内容
            post_model.firstPostPhotoUrl = row["PostPhoto_PhotoUrl"].ToString(); //图
            post_model.postId            = (int)row["id"];
            return(post_model);
        }
コード例 #2
0
ファイル: Post_dal.cs プロジェクト: swindyDeer/Fashion
        /// <summary>
        /// 将一条数据转化为Post_model数据
        /// 原贴帖子id  标题 内容的前200字符  帖子的第一张图片 日期
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        public Post_model ToShortModel(DataRow row)
        {
            Post_model post_model = new Post_model();

            post_model.postId            = (int)row["id"];
            post_model.postCaption       = row["caption"].ToString();
            post_model.postContent       = row["content"].ToString();
            post_model.firstPostPhotoUrl = row["photoUrl"].ToString();
            post_model.postDate          = (DateTime)row["datetime"];
            return(post_model);
        }
コード例 #3
0
ファイル: Post_dal.cs プロジェクト: swindyDeer/Fashion
        /// <summary>
        /// 获取帖子编号为postId的数据,一条数据
        /// </summary>
        /// <param name="postId">帖子编号</param>
        /// <returns></returns>
        public Post_model GetOnePost(int postId)
        {
            string sqlStr = "select * from PostView where id=@postId";

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@postId", postId)
            };
            DataTable  dataTable  = SqlHelper.ExecuteDataTable(sqlStr, parameters);
            Post_model post_model = new Post_model();

            post_model = ToModel(dataTable.Rows[0]);
            return(post_model);
        }
コード例 #4
0
ファイル: TopicController.cs プロジェクト: swindyDeer/Fashion
        public ActionResult PostDetails()
        {
            LoginStatusConfig();          //配置登录状态
            int postId = Convert.ToInt32(Request["postId"]);
            //获取postId的原帖数据
            Post_bll   post_bll  = new Post_bll();
            Post_model post_mode = post_bll.GetOnePost(postId);

            ViewData["post_mode"] = post_mode;
            //获取对postId原帖的回帖数据
            ReplyPost_bll          replyPost_bll       = new ReplyPost_bll();
            List <ReplyPost_model> replyPost_modelList = replyPost_bll.GetReplyPost(postId);

            return(View(replyPost_modelList));
        }
コード例 #5
0
ファイル: Post_dal.cs プロジェクト: swindyDeer/Fashion
        /// <summary>
        /// 将一条数据转化为Post_model数据
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        public Post_model ToModel(DataRow row)
        {
            Post_model post_model = new Post_model();

            post_model.User.userId       = (int)row["userId"];
            post_model.User.userName     = row["userName"].ToString();
            post_model.User.signature    = (row["signature"] != DBNull.Value ? row["signature"].ToString() : null);
            post_model.User.touXiangUrl  = row["touXiangUrl"].ToString();
            post_model.postId            = (int)row["id"];
            post_model.postCaption       = row["caption"].ToString();
            post_model.postContent       = row["content"].ToString();
            post_model.firstPostPhotoUrl = row["PostPhoto_PhotoUrl"].ToString();
            post_model.postDate          = (DateTime)row["datetime"];
            post_model.postHtmlUrl       = row["htmlUrl"].ToString();
            post_model.postSupportCount  = (int)row["supportCount"];
            post_model.Theme.themeName   = row["themeName"].ToString();
            post_model.Theme.themeId     = (int)row["themeId"];
            post_model.commentCount      = (row["commentCount"] != DBNull.Value ? (int)row["commentCount"] : 0);
            post_model.tuiTieCount       = (row["tuiTieCount"] != DBNull.Value ? (int)row["tuiTieCount"] : 0);
            return(post_model);
        }