示例#1
0
        private void GetGQName(string orgID)
        {
            IList <Hashtable> listOrg = new List <Hashtable>();

            listOrg = _wd.GetPeriod(orgID);

            IList <Hashtable> list = new List <Hashtable>();
            int a = 0;

            //string _treePt_Info = "";
            if (listOrg != null)
            {
                if (listOrg[0]["T_PERIODDESC"].ToString().Equals("全部"))
                {
                    a = 1;
                }
                //_ht = listOrg[0];
            }
            list = _pd.GetUnitByOrgId(orgID);

            string _treeBg_Info = "";
            string _treePt_Info = "";

            if (list != null)
            {
                _treeBg_Info += "{id:'0',pId:'00',name:'标杆风机',t:'标杆风机', open:true},";
                _treePt_Info += "{id:'0',pId:'00',name:'普通风机',t:'普通风机', open:true},";
                foreach (Hashtable ht in list)
                {
                    if (ht["I_FLAG"].ToString() == "1")
                    {
                        _treeBg_Info += "{id:'" + ht["T_UNITID"] + "',pId:'0',name:'" + ht["T_UNITDESC"] + "',t:'" + ht["T_UNITDESC"] + "'},";
                    }
                    else if (ht["I_FLAG"].ToString() == "0")
                    {
                        _treePt_Info += "{id:'" + ht["T_UNITID"] + "',pId:'0',name:'" + ht["T_UNITDESC"] + "',t:'" + ht["T_UNITDESC"] + "'},";
                    }
                }

                if (_treeBg_Info.Length > 0)
                {
                    _treeBg_Info = _treeBg_Info.Substring(0, _treeBg_Info.Length - 1);
                    _treeBg_Info = "[" + _treeBg_Info + "]";
                }

                if (_treePt_Info.Length > 0)
                {
                    _treePt_Info = _treePt_Info.Substring(0, _treePt_Info.Length - 1);
                    _treePt_Info = "[" + _treePt_Info + "]";
                }
            }
            object obj = new
            {
                list1     = listOrg,
                intNumber = a,
                list2     = _treePt_Info,
                infoBg    = _treeBg_Info,
                infoPt    = _treePt_Info
            };

            result = JsonConvert.SerializeObject(obj);
            Response.Write(result);
            Response.End();
        }