Example #1
0
        /// <summary>
        /// 通过OU选择岗位页面
        /// </summary>
        /// <param name="actionContext"></param>
        /// <param name="httpContext"></param>
        /// <returns>通过OU选择岗位页面的Forward</returns>
        public Forward SelectGroupByOU(ActionContext actionContext, HttpContext httpContext)
        {
            // 获取参数
            string ouUnid       = RequestUtils.GetStringParameter(httpContext, "ouUnid", TSWEBContext.Current.CurUserUnitUnid);
            string type         = RequestUtils.GetStringParameter(httpContext, "type", "0");
            bool   singleSelect = RequestUtils.GetBoolParameter(httpContext, "singleSelect", true);

            // 重设参数
            RequestUtils.ResetParameter(httpContext, "ouUnid");
            RequestUtils.ResetParameter(httpContext, "type");
            RequestUtils.ResetParameter(httpContext, "singleSelect");

            return(actionContext.Forwards["selectGroupByOU"]);
        }
Example #2
0
        /// <summary>
        /// 为查询获取分页信息,通过Url="userAction.do?action=View&type=bySearch"调用
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="curUserInfo"></param>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <param name="sortField"></param>
        /// <param name="sortDir"></param>
        /// <returns></returns>
        private PageInfo GetPageInfoBySearch(HttpContext httpContext, int pageNo, int pageSize, string sortField, string sortDir)
        {
            PageInfo pageInfo;

            // 获取过滤条件
            bool canEmpty = RequestUtils.GetBoolParameter(httpContext, "canEmpty", true);

            string[] filterNames = RequestUtils.GetStringArrayParameter(httpContext,
                                                                        "filterNames", Constants.ITEM_SEPARATOR, new string[0]);
            string[] filterValues = RequestUtils.GetStringArrayParameter(httpContext,
                                                                         "filterValues", Constants.ITEM_SEPARATOR, null);
            string[] filterTypes = RequestUtils.GetStringArrayParameter(httpContext,
                                                                        "filterTypes", Constants.ITEM_SEPARATOR, null);
            if (logger.IsDebugEnabled)
            {
                logger.Debug("In GetPageInfoBySearch:");
                logger.Debug("  canEmpty=" + RequestUtils.GetStringParameter(httpContext, "canEmpty", "null"));
                logger.Debug("  filterNames="
                             + RequestUtils.GetStringParameter(httpContext, "filterNames", "null"));
                logger.Debug("  filterValues="
                             + RequestUtils.GetStringParameter(httpContext, "filterValues", "null"));
                logger.Debug("  filterTypes="
                             + RequestUtils.GetStringParameter(httpContext, "filterTypes", "null"));
                logger.Debug("  pageNo=" + pageNo);
                logger.Debug("  pageSize=" + pageSize);
                logger.Debug("  sortField=" + sortField);
                logger.Debug("  sortDir=" + sortDir);
            }

            // 创建过滤条件
            IList filters = new ArrayList();

            for (int i = 0; i < filterNames.Length; i++)
            {
                filters.Add(new FilterParameter(filterNames[i], filterValues[i], filterTypes[i]));
            }
            if (canEmpty)
            {
                pageInfo = this.userService.GetPage(pageNo, pageSize, sortField, sortDir, filters);
            }
            else
            {
                pageInfo = new PageInfo();
            }

            return(pageInfo);
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ListSelectionMode selectionMode = "true".Equals(this.Request["singleSelect"]) ? ListSelectionMode.Single : ListSelectionMode.Multiple;

            this.Options.SelectionMode = selectionMode;

            // 设置根OU节点
            this.rootOUUnid = RequestUtils.GetStringParameter(this.Context, "rootOUUnid", TSWEBContext.Current.CurUserUnitUnid);
            this.rootOUName = HttpUtility.UrlDecode(RequestUtils.GetStringParameter(this.Context, "rootOUName", TSWEBContext.Current.CurUser.UnitFullName));
            this.userType   = HttpUtility.UrlDecode(RequestUtils.GetStringParameter(this.Context, "userType", null));

            // 是否预加载所有符合条件的岗位信息
            bool preLoadAllUserInfo = RequestUtils.GetBoolParameter(this.Context, "preLoad", false);

            if (preLoadAllUserInfo)
            {
                BindAllUserInfo();
            }

            if (string.IsNullOrEmpty(userInfosJson))
            {
                userInfosJson = JavaScriptConvert.SerializeObject(new JavaScriptArray());
            }
        }
Example #4
0
        /// <summary>
        /// 通过OU选择岗位
        /// </summary>
        /// <param name="actionContext"></param>
        /// <param name="httpContext"></param>
        /// <returns>null</returns>
        public Forward GetDepartmentNodes(ActionContext actionContext, HttpContext httpContext)
        {
            AjaxForwardUtils.InitResponse(httpContext.Response);
            string node   = RequestUtils.GetStringParameter(httpContext, "node", "");// 指定的ou的unid(点击树节点)
            string type   = RequestUtils.GetStringParameter(httpContext, "type", "all");
            string ouType = RequestUtils.GetStringParameter(httpContext, "ouType", null);

            if (logger.IsDebugEnabled)
            {
                logger.Debug("node=" + node);
                logger.Debug("type=" + type);
                logger.Debug("ouType=" + ouType);
            }
            bool isRoot = false;

            // 判断当前用户可选的权限范围
            IList ouInfoLists = new ArrayList();
            User  userInfo    = TSWEBContext.Current.CurUser;

            if (userInfo.HasPrivilege(Constants.DP_ALL))    // 用户拥有查看所有单位结构的权限
            {
                if (node == "-1" || node == "root" || node == "")
                {
                    isRoot      = true;
                    ouInfoLists = this.ouInfoService.FindChilds("", OUInfo.OT_UNIT);// 所有单位信息
                }
                else
                {
                    ouInfoLists = getChildOUInfos(node, type, ouType);
                }
                if (logger.IsDebugEnabled)
                {
                    logger.Debug("Constants.DP_ALL");
                    logger.Debug("Count1=" + ouInfoLists.Count.ToString());
                }
            }
            else if (userInfo.HasPrivilege(Constants.DP_LOCALANDCHILD)) // 用户拥有查看本级单位结构的权限
            {
                if (node == "-1" || node == "root" || node == "")
                {
                    isRoot = true;
                    OUInfo ouInfo = this.ouInfoService.Load(userInfo.UnitUnid);// 当前用户所在单位
                    if (null != ouInfo)
                    {
                        ouInfoLists.Add(ouInfo);
                    }
                }
                else
                {
                    ouInfoLists = getChildOUInfos(node, type, ouType);
                }
                if (logger.IsDebugEnabled)
                {
                    logger.Debug("Constants.DP_LOCALANDCHILD");
                }
            }
            else                                                    // 用户只拥有查看本单位结构的权限
            {
                if (node == "-1" || node == "root" || node == "")
                {
                    isRoot = true;
                    OUInfo ouInfo = this.ouInfoService.Load(userInfo.UnitUnid);// 当前用户所在单位
                    if (null != ouInfo)
                    {
                        ouInfoLists.Add(ouInfo);
                    }
                }
                else
                {
                    if (!OUInfo.OT_UNIT.Equals(ouType, StringComparison.OrdinalIgnoreCase))
                    {
                        ouInfoLists = this.ouInfoService.FindChilds(node, OUInfo.OT_DEPARTMENT);// ou下的所有子部门
                    }
                }
                if (logger.IsDebugEnabled)
                {
                    logger.Debug("Constants.DP_LOCAL");
                }
            }

            // 获取是否需要产生链接(不推荐使用)
            string link   = RequestUtils.GetStringParameter(httpContext, "link", "N");
            bool   isLink = false;

            if (link.Equals(Constants.YESNO_YES, StringComparison.OrdinalIgnoreCase))
            {
                isLink = true;
            }

            bool singleClickExpand = RequestUtils.GetBoolParameter(httpContext, "singleClickExpand", false);
            // 组合返回的信息
            JavaScriptArray jsonArray = createOUInfosJsonArray(ouInfoLists, isLink, singleClickExpand);

            if (logger.IsDebugEnabled)
            {
                logger.Debug("Count2=" + ouInfoLists.Count.ToString());
            }

            // 如果是加载根节点的子节点,则同时预加载第一个子节点的下一级子节点
            if (isRoot && ouInfoLists.Count > 0)
            {
                OUInfo          ouInfo         = (OUInfo)ouInfoLists[0];
                IList           ouInfos2       = getChildOUInfos(ouInfo.Unid, type, ouType);
                JavaScriptArray childJsonArray = createOUInfosJsonArray(ouInfos2, isLink, singleClickExpand);
                ((JavaScriptObject)jsonArray[0]).Add("children", childJsonArray);
                if (logger.IsDebugEnabled)
                {
                    logger.Debug("firstNode.children.Count=" + ouInfos2.Count.ToString());
                }
            }

            string jsonStr = JavaScriptConvert.SerializeObject(jsonArray);

            if (logger.IsDebugEnabled)
            {
                logger.Debug("isRoot=" + isRoot.ToString());
                logger.Debug("json=" + jsonStr);
            }
            httpContext.Response.Write(jsonStr);
            return(null);
        }