Exemplo n.º 1
0
        // 绑定人员列表
        private void BindAllUserInfo()
        {
            IList userInfos = this.userInfoService.FindByOU(rootOUUnid, userType);

            HtmlOption[] userInfoOptions = new HtmlOption[userInfos.Count];
            User         userInfo;

            for (int i = 0; i < userInfos.Count; i++)
            {
                userInfo           = userInfos[i] as User;
                userInfoOptions[i] = new HtmlOption(userInfo.Name + " [" + userInfo.OUFullName + "]", userInfo.Unid);
            }
            this.Options.DataSource     = userInfoOptions;
            this.Options.DataTextField  = "OptionName";
            this.Options.DataValueField = "OptionValue";
            this.Options.DataBind();

            // 创建人员列表的json字符串
            JavaScriptArray  jsonArray = new JavaScriptArray();
            JavaScriptObject jsonObject;

            foreach (User userInfo1 in userInfos)
            {
                jsonObject = JsonUtils.CreateJsonObject(userInfo1);
                jsonArray.Add(jsonObject);
            }
            this.userInfosJson = JavaScriptConvert.SerializeObject(jsonArray);
        }
Exemplo n.º 2
0
        // 绑定岗位列表
        private void BindAllGroup()
        {
            IList groups = this.groupService.FindByOU(rootOUUnid, false, groupType, true);

            HtmlOption[] groupOptions = new HtmlOption[groups.Count];
            Group        group;

            for (int i = 0; i < groups.Count; i++)
            {
                group           = groups[i] as Group;
                groupOptions[i] = new HtmlOption(group.Name + " [" + group.OUFullName + "]", group.Unid);
            }
            this.Options.DataSource     = groupOptions;
            this.Options.DataTextField  = "OptionName";
            this.Options.DataValueField = "OptionValue";
            this.Options.DataBind();

            // 创建岗位列表的json字符串
            JavaScriptArray  jsonArray = new JavaScriptArray();
            JavaScriptObject jsonObject;

            foreach (Group group1 in groups)
            {
                jsonObject = JsonUtils.CreateJsonObject(group1);
                jsonArray.Add(jsonObject);
            }
            this.groupsJson = JavaScriptConvert.SerializeObject(jsonArray);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 通过OU选择岗位
        /// </summary>
        /// <param name="actionContext"></param>
        /// <param name="httpContext"></param>
        /// <returns>null</returns>
        public Forward FindGroupByOU(ActionContext actionContext, HttpContext httpContext)
        {
            AjaxForwardUtils.InitResponse(httpContext.Response);
            JavaScriptArray jsonArray = new JavaScriptArray();
            string          ouUnid    = RequestUtils.GetStringParameter(httpContext, "ouUnid", null);
            string          groupType = RequestUtils.GetStringParameter(httpContext, "groupType", "0");// 岗位类型:0--全部类型(默认),1--可派单岗位,2--不可派单岗位

            if (string.IsNullOrEmpty(ouUnid))
            {
                throw new Exception("OUUnid不能为空!需要在请求参数中包含有效的OUUnid值。");
            }

            // 获取该OU中的岗位信息
            IList groups = this.groupService.FindByOU(ouUnid, false, groupType);

            if (logger.IsDebugEnabled)
            {
                logger.Debug("ouUnid=" + ouUnid);
                logger.Debug("groupType=" + groupType);
                logger.Debug("count=" + groups.Count);
            }

            // 组合信息
            if (groups != null && groups.Count > 0)
            {
                foreach (Group group in groups)
                {
                    jsonArray.Add(JsonUtils.CreateJsonObject(group));
                }
            }

            httpContext.Response.Write(JavaScriptConvert.SerializeObject(jsonArray));
            return(null);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 生成列表对应的json字符串并写入到请求的响应中
        /// </summary>
        /// <param name="httpContext">Http上下文</param>
        /// <param name="lists">CTI列表</param>
        private static void WriteOptionsJsonData(HttpContext httpContext, IList lists)
        {
            JavaScriptArray jsonOptions = new JavaScriptArray();

            if (lists != null)
            {
                foreach (OptionItem item in lists)
                {
                    jsonOptions.Add(JsonUtils.CreateJsonObject(item));
                }
            }
            string jsonString = JavaScriptConvert.SerializeObject(jsonOptions);

            if (logger.IsDebugEnabled)
            {
                logger.Debug("json=" + jsonString);
            }

            AjaxForwardUtils.InitResponse(httpContext.Response);
            httpContext.Response.Write(jsonString);
        }
Exemplo n.º 5
0
 protected override JavaScriptObject CreatePageInfoItemJson(object pageInfoItem)
 {
     return(JsonUtils.CreateJsonObject(pageInfoItem));
 }