Beispiel #1
0
        private void BindDropDownList()
        {
            Group group = this.Domain;

            // 绑定已拥有的角色列表
            this.RoleUnids.DataSource     = group.RoleLists;
            this.RoleUnids.DataTextField  = "Name";
            this.RoleUnids.DataValueField = "Unid";
            this.RoleUnids.DataBind();

            // 绑定已包含的人员列表
            this.UserInfoUnids.DataSource     = group.UserInfoLists;
            this.UserInfoUnids.DataTextField  = "Name";
            this.UserInfoUnids.DataValueField = "Unid";
            this.UserInfoUnids.DataBind();

            // 绑定所有角色和OU的信息
            if (!string.IsNullOrEmpty(group.OUUnid))
            {
                IList roleList = ListUtils.WeedList(roleService.FindByOU(group.OUUnid), group.RoleLists);
                this.AllRoles.DataSource     = roleList;
                this.AllRoles.DataTextField  = "Name";
                this.AllRoles.DataValueField = "Unid";
                this.AllRoles.DataBind();

                string policyValue = PolicyHelper.GetPolicyValue("9001");
                if (string.IsNullOrEmpty(policyValue))
                {
                    policyValue = TSLibWeb.Constants.YESNO_YES;
                }
                IList ouList;
                if (policyValue.Equals(TSLibWeb.Constants.YESNO_YES, StringComparison.OrdinalIgnoreCase))
                {
                    ouList = this.ouInfoService.FindOUInfoByParentUnid(group.OUUnid, true, true);
                }
                else
                {
                    ouList = this.ouInfoService.FindOUInfoByParentUnid(group.OUUnid, true, false);
                }
                this.OUInfos.DataSource     = ouList;
                this.OUInfos.DataTextField  = "FullName";
                this.OUInfos.DataValueField = "Unid";
                this.OUInfos.DataBind();
                this.OUInfos.Text = group.OUUnid;

                // 获取该OU中的人员信息
                IList userInfoList = ListUtils.WeedList(this.userInfoService.FindByOU(group.OUUnid), group.UserInfoLists);
                this.AllUserInfos.DataSource     = userInfoList;
                this.AllUserInfos.DataTextField  = "Name";
                this.AllUserInfos.DataValueField = "Unid";
                this.AllUserInfos.DataBind();
            }
        }
Beispiel #2
0
        /// <summary>
        /// 通过OU选择岗位
        /// </summary>
        /// <param name="actionContext"></param>
        /// <param name="httpContext"></param>
        /// <returns>null</returns>
        public Forward UpdateOnOUChange(ActionContext actionContext, HttpContext httpContext)
        {
            httpContext.Response.ContentType = ("text/xml;charset=UTF-8");
            httpContext.Response.Charset     = "UTF-8";

            string ouUnid = httpContext.Request.Params["ouUnid"];

            if (string.IsNullOrEmpty(ouUnid))
            {
                httpContext.Response.Write("");
                return(null);
            }
            StringBuilder sb = new StringBuilder();

            sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
            sb.Append("<response>");

            // 更新角色信息
            IList roleList = roleService.FindByOU(ouUnid);

            foreach (Role role in roleList)
            {
                sb.Append("<roleEntry>");
                sb.Append("<name>" + role.Name + "</name>");
                sb.Append("<value>" + role.Unid + "</value>");
                sb.Append("</roleEntry>");
            }

            // 更新OU信息
            string policyValue = PolicyHelper.GetPolicyValue("9001");

            if (string.IsNullOrEmpty(policyValue))
            {
                policyValue = Constants.YESNO_YES;
            }
            IList ouList;

            if (policyValue.Equals(Constants.YESNO_YES, StringComparison.OrdinalIgnoreCase))
            {
                ouList = this.ouInfoService.FindOUInfoByParentUnid(ouUnid, true, true);
            }
            else
            {
                ouList = this.ouInfoService.FindOUInfoByParentUnid(ouUnid, true, false);
            }
            foreach (OUInfo ouInfo in ouList)
            {
                sb.Append("<ouInfoEntry>");
                sb.Append("<name>" + ouInfo.FullName + "</name>");
                sb.Append("<value>" + ouInfo.Unid + "</value>");
                sb.Append("</ouInfoEntry>");
            }

            // 更新人员信息
            IList userInfoList = this.userService.FindByOU(ouUnid);

            foreach (User userInfo in userInfoList)
            {
                sb.Append("<userInfoEntry>");
                sb.Append("<name>" + userInfo.Name + "</name>");
                sb.Append("<value>" + userInfo.Unid + "</value>");
                sb.Append("</userInfoEntry>");
            }
            sb.Append("</response>");
            httpContext.Response.Write(sb.ToString());
            return(null);
        }
 private void Initialize()
 {
     this.SecureTokenServiceIdentifier = PolicyHelper.GetPolicyValue(this.XrmPolicy, "SecureTokenServiceIdentifier", string.Empty);
 }