/// <summary> /// 初始化添加/编辑表单 /// </summary> public void Initialize() { btnAdd.Visible = false; btnEdit.Visible = false; btnDel.Visible = false; CreatedByIp.Text = GlobalHelper.IP; CreatedByUser.Text = GlobalHelper.User; CreatedByDate.Text = GlobalHelper.Time.ToString(); try { ZhuJi.UUMS.IDAL.IRoles roles = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Roles)) as ZhuJi.UUMS.IDAL.IRoles; IList <ZhuJi.UUMS.Domain.Roles> listRoles = roles.GetObjects(); foreach (ZhuJi.UUMS.Domain.Roles domainRoles in listRoles) { RolesId.Items.Add(new ListItem(domainRoles.RoleName.ToString(), domainRoles.Id.ToString())); } } catch (Exception ex) { ShowMessage(ex); } switch (_command) { case "ADD": Add(); break; case "EDIT": Edit(); break; } }
/// <summary> /// 初始化查询列表 /// </summary> public void BindGrid() { try { ZhuJi.UUMS.IDAL.IRoles roles = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Roles)) as ZhuJi.UUMS.IDAL.IRoles; gvList.DataSource = roles.GetObjects(base.Where, base.OrderNo); gvList.DataBind(); } catch (Exception ex) { ShowMessage(ex); } }
protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { ZhuJi.UUMS.Domain.Roles domainRoles = new ZhuJi.UUMS.Domain.Roles(); domainRoles.Id = int.Parse(gvList.Rows[e.RowIndex].Cells[0].Text); ZhuJi.UUMS.IDAL.IRoles roles = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Roles)) as ZhuJi.UUMS.IDAL.IRoles; roles.Delete(domainRoles); gvList.EditIndex = -1; BindGrid(); } catch (Exception ex) { throw ex; } }
protected void gvList_RowInserting(object sender, EventArgs e) { try { ZhuJi.UUMS.Domain.Roles domainRoles = new ZhuJi.UUMS.Domain.Roles(); TextBox txtRoleName = (TextBox)gvList.FooterRow.FindControl("txtRoleName"); TextBox txtOrderBy = (TextBox)gvList.FooterRow.FindControl("txtOrderBy"); domainRoles.RoleName = txtRoleName.Text.Trim(); domainRoles.OrderBy = int.Parse(txtOrderBy.Text.Trim()); ZhuJi.UUMS.IDAL.IRoles roles = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Roles)) as ZhuJi.UUMS.IDAL.IRoles; roles.Insert(domainRoles); gvList.EditIndex = -1; BindGrid(); } catch (Exception ex) { ShowMessage(ex); } }
/// <summary> /// 初始化添加/编辑表单 /// </summary> public void Initialize() { btnAdd.Visible = false; btnEdit.Visible = false; btnDel.Visible = false; try { ZhuJi.UUMS.IDAL.IRoles roles = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Roles)) as ZhuJi.UUMS.IDAL.IRoles; IList <ZhuJi.UUMS.Domain.Roles> listRoles = roles.GetObjects(); foreach (ZhuJi.UUMS.Domain.Roles domainRoles in listRoles) { RolesId.Items.Add(new ListItem(domainRoles.RoleName.ToString(), domainRoles.Id.ToString())); } ZhuJi.UUMS.IDAL.IMethodExplain methodExplain = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.MethodExplain)) as ZhuJi.UUMS.IDAL.IMethodExplain; IList <ZhuJi.UUMS.Domain.MethodExplain> listMethodExplain = methodExplain.GetObjects(); foreach (ZhuJi.UUMS.Domain.MethodExplain domainMethodExplain in listMethodExplain) { ExplainId.Items.Add(new ListItem(domainMethodExplain.Title.ToString(), domainMethodExplain.Id.ToString())); } } catch (Exception ex) { ShowMessage(ex); } switch (_command) { case "ADD": Add(); break; case "EDIT": Edit(); break; } }