private void DvBind() { IGroupManage gmobj = GetInterface.GetIGroupManage(); IList <MR_Group> groupList = gmobj.GetList(); this.gvList.DataSource = groupList; this.gvList.DataBind(); }
protected void lb_save_Click(object sender, EventArgs e) { IGroupManage gmobj = GetInterface.GetIGroupManage(); string gname = this.tb_GroupName.Text.Trim(); if (string.IsNullOrEmpty(gname)) { this.Alert(AdminCollect.ERR_GROUPNAME_NULL); return; } gmobj.AddUpdate(gname, 0); DvBind(); SiteRuleCheck.FlushPageAndRightCache(); }
/// <summary> /// 初始化权限组列表 /// </summary> /// <param name="bindIdList"></param> private void BindGroupList(bool bindIdList) { IGroupManage rgmobj = GetInterface.GetIGroupManage(); IList <MR_Group> groupList = rgmobj.GetList(); this.ddl_For.DataSource = groupList; this.ddl_For.DataTextField = "GName"; this.ddl_For.DataValueField = "GID"; this.ddl_For.DataBind(); //如果有传入页面ID string names = ""; string showids = ""; string span = ""; int searchCount = 0;//找到几个管理员ID会匹配 if (this.GroupIdList != string.Empty) { string[] idarr = this.GroupIdList.Split(','); foreach (MR_Group tmp in groupList) { if (Array.IndexOf(idarr, tmp.GID.ToString()) > -1) { names += span + tmp.GName; showids += span + tmp.GID.ToString(); span = ","; searchCount++; } } } //如果传入的ID能查找到管理员,添加一项, if (span == ",") { if (searchCount > 1) { this.ddl_For.Items.Add(new ListItem(names, showids)); } if (bindIdList) //如果默需要默认选择这一项 { this.ddl_For.SelectedValue = showids; } } }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e) { IGroupManage igm = GetInterface.GetIGroupManage(); int gid = this.gvList.DataKeys[e.RowIndex].Value.GetInt(0); bool result = igm.DeleteGroup(gid); this.gvList.EditIndex = -1; DvBind(); if (result) { this.Alert(AdminCollect.DELETE_SUCCESSFUL); } else { this.Alert(AdminCollect.DELETE_FAILED); } SiteRuleCheck.FlushPageAndRightCache(); }
/// <summary> /// 保存修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvList_RowUpdating(object sender, GridViewUpdateEventArgs e) { TextBox tb = (TextBox)this.gvList.Rows[e.RowIndex].FindControl("tb_Gname_Editor"); string newName = tb.Text.Trim(); int gid = this.gvList.DataKeys[e.RowIndex].Value.GetInt(0); if (string.IsNullOrEmpty(newName)) { this.Alert(AdminCollect.ERR_GROUPNAME_NULL); return; } IGroupManage igmobj = GetInterface.GetIGroupManage(); igmobj.AddUpdate(newName, gid); this.gvList.EditIndex = -1; DvBind(); SiteRuleCheck.FlushPageAndRightCache(); }