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