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(); }