protected void btnDel_Click(object sender, EventArgs e) { Repeater list = (Repeater)SiteList1.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.Portal.Domain.Site domainSite = new ZhuJi.Portal.Domain.Site(); domainSite.Id = int.Parse(id); ZhuJi.Portal.IDAL.ISite site = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Site)) as ZhuJi.Portal.IDAL.ISite; site.Delete(domainSite); Response.Redirect(Request.Url.ToString(), true); } catch (Exception ex) { ShowMessage(ex); } }
protected void btnEdit_Click(object sender, EventArgs e) { Repeater list = (Repeater)SiteList1.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; SiteEdit1.Identity = int.Parse(id); SiteEdit1.Command = "EDIT"; SiteEdit1.Initialize(); }