protected void btnDel_Click(object sender, EventArgs e) { Repeater list = (Repeater)MethodsList1.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.UUMS.Domain.Methods domainMethods = new ZhuJi.UUMS.Domain.Methods(); domainMethods.Id = int.Parse(id); ZhuJi.UUMS.IDAL.IMethods methods = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Methods)) as ZhuJi.UUMS.IDAL.IMethods; methods.Delete(domainMethods); Response.Redirect(Request.Url.ToString(), true); } 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.UUMS.Domain.Methods domainMethods = new ZhuJi.UUMS.Domain.Methods(); domainMethods.Id = int.Parse(Id.Text); ZhuJi.UUMS.IDAL.IMethods methods = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Methods)) as ZhuJi.UUMS.IDAL.IMethods; methods.Delete(domainMethods); } catch (Exception ex) { ShowMessage(ex); } Response.Redirect(Request.Url.ToString(), true); }
/// <summary> /// 初始化编辑表单 /// </summary> private void Edit() { btnAdd.Visible = true; btnAdd.Text = "另存为新记录"; btnEdit.Visible = true; btnDel.Visible = true; try { ZhuJi.UUMS.IDAL.IMethods methods = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Methods)) as ZhuJi.UUMS.IDAL.IMethods; ZhuJi.UUMS.Domain.Methods domainMethods = methods.GetObject(_identity); UIMapping.BindObjectToControls(domainMethods, this); } catch (Exception ex) { ShowMessage(ex); } }
/// <summary> /// 点击编辑按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEdit_Click(object sender, EventArgs e) { if (Page.IsValid) { try { ZhuJi.UUMS.Domain.Methods domainMethods = new ZhuJi.UUMS.Domain.Methods(); UIMapping.BindControlsToObject(domainMethods, this); ZhuJi.UUMS.IDAL.IMethods methods = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Methods)) as ZhuJi.UUMS.IDAL.IMethods; methods.Update(domainMethods); } catch (Exception ex) { ShowMessage(ex); } } }
/// <summary> /// 初始化查询列表 /// </summary> public void List() { try { ZhuJi.UUMS.IDAL.IMethods methods = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Methods)) as ZhuJi.UUMS.IDAL.IMethods; rptList.DataSource = methods.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 = methods.GetRowCount; simplePager.DataBind(); } } catch (Exception ex) { ShowMessage(ex); } }