/// <summary> /// 删除事件 /// </summary> protected void rolebGrid_RowCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "delete") { try { object[] keys = rolebGrid.DataKeys[e.RowIndex]; int id = int.Parse(keys[0].ToString()); FineOffice.Modules.SYS_Role model = roleBll.GetModel(m => m.ID == id); if (!model.IsModify.Value) { Alert.ShowInParent(string.Format("系统角色:{0},不允许删除!", model.RoleName)); return; } roleBll.Delete(model); ChangeTrackingList <EntitySearcher> changeTrackingList = ViewState["sql"] as ChangeTrackingList <EntitySearcher>; GridColumn column = rolebGrid.FindColumn(rolebGrid.SortColumn); rolebGrid_Bind(changeTrackingList, column.SortField, rolebGrid.SortDirection); } catch (Exception ex) { Alert.Show(ex.Message); } } }
private void InitModule() { int id = int.Parse(Request["id"]); FineOffice.Modules.SYS_Role model = roleBll.GetModel(d => d.ID == id); hiddenID.Text = id.ToString(); txtOrdering.Text = model.Ordering.ToString(); txtRemark.Text = model.Remark; txtRoleName.Text = model.RoleName; chkStop.Checked = model.Stop.Value; }
protected void roleGrid_RowSelect(object sender, FineUI.GridRowSelectEventArgs e) { int roleID = int.Parse(roleGrid.DataKeys[e.RowIndex][0].ToString()); FineOffice.Modules.SYS_Role model = roleBll.GetModel(r => r.ID == roleID); hiddenSelectedIDs.Text = model.AuthorityList; hiddenSelectedNodes.Text = model.MenuList; List <int> selectNodes = this.JsonToList <int>(model.MenuList); SelectRoleCheckTreeNode(tvwMenu.Nodes, selectNodes); this.UpdateSelectedRowIndexArray(); }
protected void btnSave_Click(object sender, EventArgs e) { FineOffice.Modules.SYS_Role model = new FineOffice.Modules.SYS_Role(); model.Ordering = int.Parse(txtOrdering.Text); model.RoleName = txtRoleName.Text.Trim(); model.IsModify = true; model.Remark = txtRemark.Text.Trim(); model.Stop = chkStop.Checked; try { roleBll.Add(model); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("subwin_close")); } catch (Exception ex) { Alert.Show(ex.Message); } }
protected void btnAwardRole_Click(object sender, EventArgs e) { int roleID = int.Parse(roleGrid.DataKeys[roleGrid.SelectedRowIndex][0].ToString()); string roleName = roleGrid.DataKeys[roleGrid.SelectedRowIndex][1].ToString(); FineOffice.Modules.SYS_Role model = roleBll.GetModel(r => r.ID == roleID); List <int> menus = GetCheckedNodeIDs(); model.MenuList = JsonSerialize.Serialize(menus); List <int> authoritys = new List <int>(); int[] selectArray = authorityGrid.SelectedRowIndexArray; for (int i = 0; i < selectArray.Length; i++) { authoritys.Add(int.Parse(authorityGrid.DataKeys[selectArray[i]][0].ToString())); } model.AuthorityList = JsonSerialize.Serialize(authoritys); roleBll.Update(model); Alert.Show(string.Format("角色-{0},授权成功!", roleName)); }
protected void btnSave_Click(object sender, EventArgs e) { int id = int.Parse(hiddenID.Text); FineOffice.Modules.SYS_Role model = roleBll.GetModel(d => d.ID == id); if (!model.IsModify.Value) { Alert.ShowInParent(string.Format("系统角色:{0},不允许修改!", model.IsModify)); return; } model.Ordering = int.Parse(txtOrdering.Text); model.RoleName = txtRoleName.Text.Trim(); model.Remark = txtRemark.Text.Trim(); model.Stop = chkStop.Checked; try { roleBll.Update(model); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("subwin_close")); } catch (Exception ex) { Alert.Show(ex.Message); } }