protected void btnPublishAndUnpublish_Click(object sender, EventArgs e) { NietoYostenDbDataContext db = new NietoYostenDbDataContext(); int sectionId = int.Parse(ddlSection.SelectedValue); var q = from a in db.Articles where a.SectionId == sectionId select a; int i = 0; foreach (Article a in q) { CheckBox chk = (CheckBox)rptArticles.Items[i].FindControl(String.Format("chkArticle{0}", a.ArticleId)); if (chk != null && chk.Checked) { a.Published = ((Button)sender).ID == "btnPublish" ? true : false; // Update search index MyLucene.UpdateArticle(a); } i++; } db.SubmitChanges(); rptArticles.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { NietoYostenDbDataContext db = new NietoYostenDbDataContext(); MembershipUser user = Membership.GetUser(); int articleId = int.Parse(Page.RouteData.Values["ArticleId"].ToString()); Article article = db.Articles.Single(a => a.ArticleId == articleId); article.Title = txtTitle.Text; article.IntroText = introEditor.Text; article.Content = contentEditor.Text; article.SectionId = int.Parse(ddlSection.SelectedValue); article.ModifiedBy = (Guid)user.ProviderUserKey; article.DateModified = DateTime.Now; db.SubmitChanges(); // Update index MyLucene.UpdateArticle(article); Response.Redirect("~/admin/AdminSiteContent.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { NietoYostenDbDataContext db = new NietoYostenDbDataContext(); var q = from h in db.HomePageArticles orderby h.Position where h.Position >= 1 && h.Position <=4 select h; int i = 1; foreach (var hpa in q) { GetDataFromRow((HomePageArticle)hpa, i); i++; } db.SubmitChanges(); Response.Redirect("~/admin/AdminSiteContent.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { // Insert the article into the DB NietoYostenDbDataContext db = new NietoYostenDbDataContext(); db.Log = new DebugTextWriter(); MembershipUser user = Membership.GetUser(); Article article = new Article { Title = HttpUtility.HtmlEncode(txtTitle.Text), IntroText = introEditor.Text, Content = contentEditor.Text, SectionId = int.Parse(ddlSection.SelectedValue), CreatedBy = (Guid)user.ProviderUserKey, DateCreated = DateTime.Now }; db.Articles.InsertOnSubmit(article); db.SubmitChanges(); MyLucene.UpdateArticle(article); Response.Redirect("~/Admin/AdminSiteContent.aspx"); }