protected void btnDel_Click(object sender, EventArgs e) { Repeater list = (Repeater)AdsInforList1.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.AdsModule.Domain.AdsInfor domainAdsInfor = new ZhuJi.Modules.AdsModule.Domain.AdsInfor(); domainAdsInfor.Id = int.Parse(id); ZhuJi.Modules.AdsModule.IDAL.IAdsInfor adsInfor = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.AdsModule.NHibernateDAL.AdsInfor)) as ZhuJi.Modules.AdsModule.IDAL.IAdsInfor; adsInfor.Delete(domainAdsInfor); Response.Redirect(Request.Url.ToString(), true); } catch (Exception ex) { ShowMessage(ex); } }
protected void btnEdit_Click(object sender, EventArgs e) { Repeater list = (Repeater)AdsInforList1.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; AdsInforEdit1.Identity = int.Parse(id); AdsInforEdit1.Command = "EDIT"; AdsInforEdit1.Initialize(); }