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); } }
/// <summary> /// 初始化编辑表单 /// </summary> private void Edit() { btnAdd.Visible = true; btnAdd.Text = "另存为新记录"; btnEdit.Visible = true; btnDel.Visible = true; try { ZhuJi.Modules.AdsModule.IDAL.IAdsInfor adsInfor = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.AdsModule.NHibernateDAL.AdsInfor)) as ZhuJi.Modules.AdsModule.IDAL.IAdsInfor; ZhuJi.Modules.AdsModule.Domain.AdsInfor domainAdsInfor = adsInfor.GetObject(_identity); UIMapping.BindObjectToControls(domainAdsInfor, this); } catch (Exception ex) { ShowMessage(ex); } }
/// <summary> /// 点击删除按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { try { ZhuJi.Modules.AdsModule.Domain.AdsInfor domainAdsInfor = new ZhuJi.Modules.AdsModule.Domain.AdsInfor(); domainAdsInfor.Id = int.Parse(Id.Text); 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); } catch (Exception ex) { ShowMessage(ex); } Response.Redirect(Request.Url.ToString(), true); }
/// <summary> /// 点击编辑按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEdit_Click(object sender, EventArgs e) { if (Page.IsValid) { try { ZhuJi.Modules.AdsModule.Domain.AdsInfor domainAdsInfor = new ZhuJi.Modules.AdsModule.Domain.AdsInfor(); UIMapping.BindControlsToObject(domainAdsInfor, this); ZhuJi.Modules.AdsModule.IDAL.IAdsInfor adsInfor = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.AdsModule.NHibernateDAL.AdsInfor)) as ZhuJi.Modules.AdsModule.IDAL.IAdsInfor; adsInfor.Update(domainAdsInfor); } catch (Exception ex) { ShowMessage(ex); } } }
/// <summary> /// 初始化查询列表 /// </summary> public void List() { try { ZhuJi.Modules.AdsModule.IDAL.IAdsInfor adsInfor = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.AdsModule.NHibernateDAL.AdsInfor)) as ZhuJi.Modules.AdsModule.IDAL.IAdsInfor; rptList.DataSource = adsInfor.GetObjects(base.Where, base.OrderNo, base.PageNo, base.PageSize); rptList.DataBind(); if (base.IsShowPager) { simplePager.Visible = true; simplePager.CurrentPage = base.PageNo; simplePager.PageSize = base.PageSize; simplePager.PageUrl = Request.Url.ToString(); simplePager.RecordCount = adsInfor.GetRowCount; simplePager.DataBind(); } } catch (Exception ex) { ShowMessage(ex); } }