private void BindData() { EWF_RoleBLL role = new EWF_RoleBLL((Guid)ViewState["Role"]); #region 绑定基本信息 lb_ID.Text = ViewState["Role"].ToString(); tbx_Name.Text = role.Model.Name; tbx_Description.Text = role.Model.Description; ddl_Type.SelectedValue = role.Model.Type.ToString(); #endregion #region 绑定角色关联明细信息 DataTable dt = role.GetDetailList(); if (dt.Rows.Count > 0) { ddl_Level.SelectedValue = dt.Rows[0]["OrganizeCityLevel"].ToString(); } #endregion }
private void BindData() { EWF_RoleBLL role = new EWF_RoleBLL((Guid)ViewState["Role"]); #region 绑定基本信息 lb_ID.Text = ViewState["Role"].ToString(); tbx_Name.Text = role.Model.Name; tbx_Description.Text = role.Model.Description; ddl_Type.SelectedValue = role.Model.Type.ToString(); #endregion #region 绑定角色关联明细信息 DataTable dt = role.GetDetailList(); DataColumn[] pk = { dt.Columns["ScrValue"], dt.Columns["RecipientStaff"] }; dt.PrimaryKey = pk; dt.AcceptChanges(); ViewState["DTDetail"] = dt; BindGrid(); #endregion }
protected void bt_Save_Click(object sender, EventArgs e) { if ((Guid)ViewState["Role"] != Guid.Empty && ddl_Level.SelectedValue != "0") { EWF_RoleBLL role = new EWF_RoleBLL((Guid)ViewState["Role"]); role.Model.Name = tbx_Name.Text; role.Model.Description = tbx_Description.Text; role.Update(); DataTable dt = role.GetDetailList(); if (dt.Rows.Count > 0 && ddl_Level.SelectedValue != dt.Rows[0]["OrganizeCityLevel"].ToString()) { role.Delete_OrganizeCityManager((int)dt.Rows[0]["OrganizeCityLevel"]); } role.Add_OrganizeCityManager(int.Parse(ddl_Level.SelectedValue)); Response.Redirect("RoleList.aspx"); } }