protected void Insert_Click(object sender, EventArgs e) { Model.Article article = new Model.Article(); string str = BlogNameText.Value; if (str.Equals("") || str.Equals("博客标题")) { article.Title = "无标题"; } else { article.Title = str; } article.Info = BlogContentBox.Text; article.QQ = qq; article.Name = name; if (new DAL.DArticle().Insert(article)) { Response.Write("<script language='javascript'>alert('发布成功!')</script>"); } else { Response.Write("<script language='javascript'>alert('发布失败!')</script>"); } }
private void validerButton_Click(object sender, EventArgs e) { if (titreTextBox.Text == "" || auteurTextBox.Text == "" || editeurTextBox.Text == "" || numEditionTextBox.Text == "" || cheminTextBox.Text == "") { MessageBox.Show("Veuillez remplir tous les champs correctement."); } else { Article art = new Article(titreTextBox.Text, auteurTextBox.Text, cheminTextBox.Text, copyrightCheckBox.Checked, numEditionTextBox.Text, editeurTextBox.Text); bool found = false; foreach (Document d in ctrl.mediatheque.GetDocuments<Texte>()) { if (art.path == d.path) { found = true; break; } } if (!found) { ctrl.mediatheque.Ajouter(art); ctrl.mainform.refreshLists(); this.Close(); } else { MessageBox.Show("Ce fichier est déjà présent dans la médiathèque."); } } }
/// <summary> /// 访问次数 /// </summary> public void addCount(Model.Article model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Article set "); strSql.Append("[Count]=[Count]+1 "); strSql.Append(" where ID=" + model.ID + " "); SQLHelper.ExecuteNonQuery(strSql.ToString()); }
public ModifArticleForm(Article _art, Ctrl _ctrl) { InitializeComponent(); art = _art; ctrl = _ctrl; titreTextBox.Text = art.titre; auteurTextBox.Text = art.auteur; editeurTextBox.Text = art.editeur; numEditionTextBox.Text = art.numEdition; }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Model.Article model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Article set "); strSql.Append("Author='" + model.Author + "',"); strSql.Append("TypeId=" + model.TypeId + ","); strSql.Append("Subject='" + model.Subject + "',"); strSql.Append("Content='" + model.Content + "',"); strSql.Append("[Count]=" + model.Count); strSql.Append(" where ID=" + model.ID + " "); SQLHelper.ExecuteNonQuery(strSql.ToString()); }
public void select() { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); model = arcbll.GetModel(id); DataTable dt = typbll.GetList(0); for (int i = 0; i < dt.Rows.Count; i++) { DropDownList1.Items.Add(new ListItem(dt.Rows[i]["Type"].ToString(), dt.Rows[i]["ID"].ToString())); } this.TextBox1.Text = model.Subject.ToString(); this.TextBox2.Text = model.Content.ToString(); }
private void NewsTypeBind(Model.Article model) { List <Model.ArticleType> typelist = new BLL.ArticleType().GetList(0, "Lang='zh_cn' and IsShow=1 ", "Sort asc"); if (typelist != null && typelist.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (Model.ArticleType item in typelist) { sb.AppendFormat("<li {0}>{1}</li>", item.ClassID.Value == model.ClassID.Value ? "class='active'" : "", item.ClassName); } lit_NewsType.Text = sb.ToString(); } }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Model.Article model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Article("); strSql.Append("Author,TypeId,Subject,Content,[Count]"); strSql.Append(")"); strSql.Append(" values ("); strSql.Append("'" + model.Author + "',"); strSql.Append("" + model.TypeId + ","); strSql.Append("'" + model.Subject + "',"); strSql.Append("'" + model.Content + "',"); strSql.Append("" + model.Count); strSql.Append(")"); SQLHelper.ExecuteNonQuery(strSql.ToString()); }
private void DealRightContent(int id, string qq) { DAL.DArticle DAr = new DAL.DArticle(); if (id != 0) { info = DAr.GetArticleById(id); singleBlogDiv.Attributes["style"] = "display:block;min-height:800px;"; MainContentDiv.Attributes["style"] = "display:none;"; DAr.AddReadedMount(id); } else { singleBlogDiv.Attributes["style"] = "display:none;"; MainContentDiv.Attributes["style"] = "display:block;"; PageList = new Paging(DAr.GetByQQ(qq).ToList <Object>(), 6); RefreshList(); } }
protected void Button1_Click(object sender, EventArgs e) { model = dal.GetModel(1); Label1.Text = model.Author.ToString(); }