コード例 #1
0
ファイル: ContentService.cs プロジェクト: cristo-d/git-asp
        public static Content GetContentById(int topicid)    //外键的处理
        {
            string sql = "select * from BBS_Topic where TopicID=@TopicID";
            int    userid;
            int    classid;

            using (SqlDataReader reader = DBHelper.GetReader(sql, new SqlParameter("@TopicID", topicid)))
            {
                if (reader.Read())
                {
                    Content content = new Content();
                    content.Topicid    = (int)reader["TopicID"];
                    content.Title      = (string)reader["Title"];
                    content.Isclose    = (string)reader["IsClose"];
                    content.Contentery = (string)reader["Contentery"];
                    content.Createdon  = (DateTime)reader["CreatedOn"];
                    content.Repliedon  = (DateTime)reader["RepliedOn"];
                    userid             = (int)reader["UserID"];
                    classid            = (int)reader["ClassID"];
                    reader.Close();
                    content.Contentclass = CCService.GetContentclassById((int)reader["ClassID"]); //外键的处理
                    content.User         = UserService.GetUserById1((int)reader["UserID"]);       //外键的处理
                    return(content);
                }
                else
                {
                    reader.Close();
                    return(null);
                }
            }
        }
コード例 #2
0
ファイル: ReSevice.cs プロジェクト: cristo-d/git-asp
        private static IList <ContentReply> GetContentReplyBySql(string safeSql)
        {
            List <ContentReply> list  = new List <ContentReply>();
            DataTable           table = DBHelper.GetDataSet(safeSql);

            foreach (DataRow row in table.Rows)
            {
                ContentReply contentreply = new ContentReply();
                contentreply.Replyid      = (int)row["ReplyID"];
                contentreply.Recontentery = (string)row["ReContentery"];
                contentreply.Createon     = (DateTime)row["CreatedOn"];
                contentreply.Userid       = (int)row["UserID"];
                contentreply.Topicid      = (int)row["TopicID"];
                //contentreply.User.Headurl = (string)row["HeadUrl"];
                contentreply.Content = CCService.GetContentByTId((int)row["TopicID"]); //外键的处理
                contentreply.User    = UserService.GetUserById1((int)row["UserID"]);   //外键的处理
                list.Add(contentreply);
            }
            return(list);
        }
コード例 #3
0
ファイル: ContentService.cs プロジェクト: cristo-d/git-asp
        private static IList <Content> GetContentALL(string safeSql)
        {
            List <Content> list  = new List <Content>();
            DataTable      table = DBHelper.GetDataSet(safeSql);

            foreach (DataRow row in table.Rows)
            {
                Content content = new Content();
                content.Topicid      = (int)row["TopicID"];
                content.Title        = (string)row["Title"];
                content.Isclose      = (string)row["IsClose"];
                content.Contentery   = (string)row["Contentery"];
                content.Createdon    = (DateTime)row["CreatedOn"];
                content.Repliedon    = (DateTime)row["RepliedOn"];
                content.Replycount   = (int)row["ReplyCount"];
                content.Contentclass = CCService.GetContentclassById((int)row["ClassID"]); //外键的处理
                content.User         = UserService.GetUserById1((int)row["UserID"]);       //外键的处理

                list.Add(content);
            }
            return(list);
        }
コード例 #4
0
ファイル: CCService.cs プロジェクト: cristo-d/git-asp
        public static IList <ContentClass> GetAllContentclass()
        {
            string sqlAll = "select * from BBS_Class";

            return(CCService.GetContentclassBySql(sqlAll));
        }