protected void btnDel_Click(object sender, EventArgs e) { Repeater list = (Repeater)ArticleList1.FindControl("rptList"); string id = UIControlHelper.GetCheckBoxByRepeater(list, "chkId"); if (id.Length == 0) { MessageHelper.ShowAndBack(Page, MessageHelper.GetMessage("NOCHECK")); return; } if (id.Split(',').Length > 1) { MessageHelper.ShowAndBack(Page, MessageHelper.GetMessage("MORECHECK")); return; } try { ZhuJi.Modules.ArticleModule.Domain.Article domainArticle = new ZhuJi.Modules.ArticleModule.Domain.Article(); domainArticle.Id = int.Parse(id); ZhuJi.Modules.ArticleModule.IDAL.IArticle article = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.ArticleModule.NHibernateDAL.Article)) as ZhuJi.Modules.ArticleModule.IDAL.IArticle; article.Delete(domainArticle); Response.Redirect(Request.Url.ToString(), true); } catch (Exception ex) { ShowMessage(ex); } }
protected void btnEdit_Click(object sender, EventArgs e) { Repeater list = (Repeater)ArticleList1.FindControl("rptList"); string id = UIControlHelper.GetCheckBoxByRepeater(list, "chkId"); if (id.Length == 0) { MessageHelper.ShowAndBack(Page, MessageHelper.GetMessage("NOCHECK")); return; } if (id.Split(',').Length > 1) { MessageHelper.ShowAndBack(Page, MessageHelper.GetMessage("MORECHECK")); return; } Initialize(); pnlEdit.Visible = true; ArticleEdit1.Identity = int.Parse(id); ArticleEdit1.Command = "EDIT"; ArticleEdit1.Initialize(); }
/// <summary> /// 点击搜索 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSearch_Click(object sender, EventArgs e) { if (Page.IsValid) { if (txtBeginTime.Text.Trim().Length > 0 && txtEndTime.Text.Trim().Length > 0) { ArticleList1.Where = string.Format("tmp.CreatedByDate between {0} and {1}", txtBeginTime.Text.Trim(), txtEndTime.Text.Trim()); } if (txtTitle.Text.Length > 0) { if (ArticleList1.Where != null && ArticleList1.Where.Length > 0) { ArticleList1.Where += string.Format(" and tmp.Title like '%{0}%'", txtTitle.Text.Trim()); } else { ArticleList1.Where = string.Format("tmp.Title like '%{0}%'", txtTitle.Text.Trim()); } } ArticleList1.List(); } }