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 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); } }
/// <summary> /// 初始化编辑表单 /// </summary> private void Edit() { btnAdd.Visible = true; btnAdd.Text = "另存为新记录"; btnEdit.Visible = true; btnDel.Visible = true; try { ZhuJi.Modules.AdsModule.IDAL.IAdsLocation adsLocation = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.AdsModule.NHibernateDAL.AdsLocation)) as ZhuJi.Modules.AdsModule.IDAL.IAdsLocation; ZhuJi.Modules.AdsModule.Domain.AdsLocation domainAdsLocation = adsLocation.GetObject(_identity); UIMapping.BindObjectToControls(domainAdsLocation, 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.AdsLocation domainAdsLocation = new ZhuJi.Modules.AdsModule.Domain.AdsLocation(); domainAdsLocation.Id = int.Parse(Id.Text); 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); } 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.AdsLocation domainAdsLocation = new ZhuJi.Modules.AdsModule.Domain.AdsLocation(); UIMapping.BindControlsToObject(domainAdsLocation, this); ZhuJi.Modules.AdsModule.IDAL.IAdsLocation adsLocation = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.AdsModule.NHibernateDAL.AdsLocation)) as ZhuJi.Modules.AdsModule.IDAL.IAdsLocation; adsLocation.Update(domainAdsLocation); } catch (Exception ex) { ShowMessage(ex); } } }
/// <summary> /// 点击添加按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { if (Page.IsValid) { try { ZhuJi.Modules.AdsModule.Domain.AdsLocation domainAdsLocation = new ZhuJi.Modules.AdsModule.Domain.AdsLocation(); UIMapping.BindControlsToObject(domainAdsLocation, this); ZhuJi.Modules.AdsModule.IDAL.IAdsLocation adsLocation = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.AdsModule.NHibernateDAL.AdsLocation)) as ZhuJi.Modules.AdsModule.IDAL.IAdsLocation; adsLocation.Insert(domainAdsLocation); _identity = domainAdsLocation.Id; Edit(); } 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.AdsLocation domainAdsLocation = new ZhuJi.Modules.AdsModule.Domain.AdsLocation(); domainAdsLocation.Id = int.Parse(Id.Text); 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); } catch (Exception ex) { ShowMessage(ex); } Response.Redirect(Request.Url.ToString(), true); }