protected void gvList_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { ZhuJi.UUMS.Domain.ControlsType domainControlsType = new ZhuJi.UUMS.Domain.ControlsType(); TextBox txtText = (TextBox)gvList.Rows[e.RowIndex].FindControl("txtText"); TextBox txtValue = (TextBox)gvList.Rows[e.RowIndex].FindControl("txtValue"); TextBox txtOrderBy = (TextBox)gvList.Rows[e.RowIndex].FindControl("txtOrderBy"); domainControlsType.Id = int.Parse(gvList.Rows[e.RowIndex].Cells[0].Text); domainControlsType.Text = txtText.Text.Trim(); domainControlsType.Value = txtValue.Text.Trim(); domainControlsType.OrderBy = int.Parse(txtOrderBy.Text.Trim()); ZhuJi.UUMS.IDAL.IControlsType controlsType = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.ControlsType)) as ZhuJi.UUMS.IDAL.IControlsType; controlsType.Update(domainControlsType); gvList.EditIndex = -1; BindGrid(); } catch (Exception ex) { ShowMessage(ex); } }
/// <summary> /// 初始化查询列表 /// </summary> public void BindGrid() { try { ZhuJi.UUMS.IDAL.IControlsType controlsType = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.ControlsType)) as ZhuJi.UUMS.IDAL.IControlsType; gvList.DataSource = controlsType.GetObjects(base.Where, base.OrderNo); gvList.DataBind(); } catch (Exception ex) { ShowMessage(ex); } }
/// <summary> /// 初始化添加/编辑表单 /// </summary> public void Initialize() { btnAdd.Visible = false; btnEdit.Visible = false; btnDel.Visible = false; try { ZhuJi.UUMS.IDAL.IResources resources = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Resources)) as ZhuJi.UUMS.IDAL.IResources; IList <ZhuJi.UUMS.Domain.Resources> listResources = resources.GetObjects(); foreach (ZhuJi.UUMS.Domain.Resources domainResources in listResources) { ResourcesId.Items.Add(new ListItem(domainResources.ResourceName.ToString(), domainResources.Id.ToString())); } ZhuJi.UUMS.IDAL.IControlsType controlsType = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.ControlsType)) as ZhuJi.UUMS.IDAL.IControlsType; IList <ZhuJi.UUMS.Domain.ControlsType> listControlsType = controlsType.GetObjects(); foreach (ZhuJi.UUMS.Domain.ControlsType domainControlsType in listControlsType) { ControlType.Items.Add(new ListItem(domainControlsType.Text.ToString(), domainControlsType.Id.ToString())); } ZhuJi.UUMS.IDAL.IControlsAttribute controlsAttribute = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.ControlsAttribute)) as ZhuJi.UUMS.IDAL.IControlsAttribute; IList <ZhuJi.UUMS.Domain.ControlsAttribute> listControlsAttribute = controlsAttribute.GetObjects(); foreach (ZhuJi.UUMS.Domain.ControlsAttribute domainControlsAttribute in listControlsAttribute) { Attribute.Items.Add(new ListItem(domainControlsAttribute.Text.ToString(), domainControlsAttribute.Id.ToString())); } } catch (Exception ex) { ShowMessage(ex); } switch (_command) { case "ADD": Add(); break; case "EDIT": Edit(); break; } }
protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { ZhuJi.UUMS.Domain.ControlsType domainControlsType = new ZhuJi.UUMS.Domain.ControlsType(); domainControlsType.Id = int.Parse(gvList.Rows[e.RowIndex].Cells[0].Text); ZhuJi.UUMS.IDAL.IControlsType controlsType = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.ControlsType)) as ZhuJi.UUMS.IDAL.IControlsType; controlsType.Delete(domainControlsType); gvList.EditIndex = -1; BindGrid(); } catch (Exception ex) { throw ex; } }