示例#1
0
 private string getAllSelectTypeJsonString()
 {
     Newtonsoft.Json.JavaScriptArray  jsonArray = new Newtonsoft.Json.JavaScriptArray();
     Newtonsoft.Json.JavaScriptObject json;
     TSCommon.Core.HtmlOption[]       options = this.optionItemService.GetTypeOptions();
     if (options != null)
     {
         foreach (TSCommon.Core.HtmlOption option in options)
         {
             json = new Newtonsoft.Json.JavaScriptObject();
             json.Add("Name", option.OptionName);
             json.Add("Value", option.OptionValue);
             jsonArray.Add(json);
         }
     }
     return(Newtonsoft.Json.JavaScriptConvert.SerializeObject(jsonArray));
 }
示例#2
0
        public virtual Forward GetUnitTree(ActionContext actionContext, HttpContext httpContext)
        {
            string node     = httpContext.Request.Params["node"];
            IList  unitTree = null;
            User   curUser  = TSWEBContext.Current.CurUser;

            if (TSWEBContext.Current.IsHasPrivilege(Constants.ADMIN_ALL))
            {
                unitTree = this.ouInfoService.GetUnitTree(curUser, Constants.OT_ALL);
            }
            else if (TSWEBContext.Current.IsHasPrivilege(Constants.ADMIN_LOCALANDCHILD))
            {
                unitTree = this.ouInfoService.GetUnitTree(curUser, Constants.OT_LOCALANDCHILD);
            }
            else if (TSWEBContext.Current.IsHasPrivilege(Constants.ADMIN_LOCAL))
            {
                unitTree = this.ouInfoService.GetUnitTree(curUser, Constants.OT_LOCAL);
            }

            Newtonsoft.Json.JavaScriptArray jsonArray = new Newtonsoft.Json.JavaScriptArray();
            if (!(string.IsNullOrEmpty(node) || unitTree == null))
            {
                foreach (object obj in unitTree)
                {
                    string[] nodeInfo = obj as string[];
                    if (node.Equals(nodeInfo[1], StringComparison.OrdinalIgnoreCase))
                    {
                        Newtonsoft.Json.JavaScriptObject jsonObject = new Newtonsoft.Json.JavaScriptObject();
                        jsonObject.Add("id", nodeInfo[0]);
                        jsonObject.Add("text", nodeInfo[2]);
                        jsonArray.Add(jsonObject);
                    }
                }
            }

            AjaxForwardUtils.InitResponse(httpContext.Response);
            httpContext.Response.Write(Newtonsoft.Json.JavaScriptConvert.SerializeObject(jsonArray));
            return(null);
        }