コード例 #1
0
 /// <summary>
 /// 绑定界面
 /// </summary>
 private void BindControls()
 {
     pictureBox1.Image   = Image.FromFile(System.Environment.CurrentDirectory + user.getlocalavatar());
     label_up.Text      += user.getName();
     label_time.Text    += article.getReleaseDate();
     label_sign.Text    += user.getSign();
     label_context.Text += article.getDescription();
     richTextBox1.Text   = article.getTxt();
 }
コード例 #2
0
        /// <summary>
        /// 保存文章到数据库
        /// </summary>
        /// <param name="article"></param>
        /// <returns></returns>
        public bool SaveArticle(Article.Model.Article article)
        {
            string sql = "select * from Article where contentId =" + article.getContentId();

            dt = conn.ExecuteDataTable(sql);
            if (dt.Rows.Count == 0)
            {
                string sqlInsert = "INSERT INTO 'Article' ('user', 'txt', 'description', 'contentId', 'isArticle', 'channelId', 'releaseDate', 'title', 'isRecommend', 'views', 'comments', 'stows', 'toplevel', 'cover', 'viewOnly') VALUES ('" + article.getUser() + "', '" + article.getTxt() + "', '" + article.getDescription() + "', '" + article.getContentId() + "', '" + article.getIsArticle() + "', '" + article.getChannelId() + "', '" + article.getReleaseDate() + "', '" + article.getTitle() + "', '" + article.getIsRecommend() + "', '" + article.getViews() + "', '" + article.getComments() + "', '" + article
                                   .getStows() + "', '" + article.getToplevel() + "', '" + article.getCover() + "', '" + article.getViewOnly() + "');";
                conn.ExecuteScalar(sqlInsert);
            }
            return(true);
        }