Exemplo n.º 1
0
        /// <summary>
        /// 向角色中添加用户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbAddUser_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(hfSelectUserAD.Value) && tvRole.SelectedNode != null)
            {
                RoleBLL bll = new RoleBLL();
                bool    ret = bll.AddUserToRoleUser(tvRole.SelectedValue, hfSelectUserAD.Value);
                if (ret)
                {
                    hfSelectUserAD.Value = string.Empty;
                    if (tvRole.SelectedNode != null)
                    {
                        //DataSet ds = DBManager.GetRoleUserByCode(tvRole.SelectedNode.Value);
                        DataSet ds = bll.GetRoleUserByCode(tvRole.SelectedNode.Value);
                        if (ds != null && ds.Tables.Count > 1)
                        {
                            gvUser.DataSource = ds.Tables[1];
                            gvUser.DataBind();
                        }

                        //取得角色信息
                        //DataTable dtRole = DBManager.GetRoleInfoByRoleCode(tvRole.SelectedNode.Value);
                        dtRole = bll.GetRoleInfoByRoleCode(tvRole.SelectedNode.Value);

                        if (dtRole != null)
                        {
                            txtRoleName.Text    = dtRole.Rows[0]["RoleName"].ToString();
                            txtProcessType.Text = dtRole.Rows[0]["processtype"].ToString();
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 保存多个员工到角色
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void bnSave_Click(object sender, ImageClickEventArgs e)
 {
     if (!string.IsNullOrEmpty(hfSelectUserAD.Value))
     {
         RoleBLL bll = new RoleBLL();
         bool    ret = bll.AddUserToRoleUser(this.hfRoleCode.Text, hfSelectUserAD.Value);
         LoadRoleUserMes();
         if (ret)
         {
             ExecAlertScritp("添加成功!");
         }
         else
         {
             ExecAlertScritp("添加失败!");
         }
     }
 }