示例#1
0
        protected void GetInit()
        {
            DataTable _dtCompany = _wd.dtGetCompany();

            IList <Hashtable> _company = new List <Hashtable>(); //公司
            IList <Hashtable> _fgs     = new List <Hashtable>(); //分公司
            IList <Hashtable> _fc      = new List <Hashtable>(); //风场
            int a = 0;

            if (_dtCompany.Rows.Count > 0)
            {
                for (int i = 0; i < _dtCompany.Rows.Count; i++)
                {
                    _ht = new Hashtable();
                    _ht.Add("ID", _dtCompany.Rows[i]["T_COMID"].ToString());     //公司编码
                    _ht.Add("NAME", _dtCompany.Rows[i]["T_COMDESC"].ToString()); //公司名称
                    _company.Add(_ht);
                }

                string _companyId = _dtCompany.Rows[0]["T_COMID"].ToString();
                _fc = _pd.GetPeriod(_companyId);
                DataTable _dtOrg = _wd.GetOrg(_companyId);
                if (_dtOrg.Rows.Count > 0)
                {
                    for (int j = 0; j < _dtOrg.Rows.Count; j++)
                    {
                        _ht = new Hashtable();
                        _ht.Add("ID", _dtOrg.Rows[j]["T_ORGID"].ToString());     //风场编码
                        _ht.Add("NAME", _dtOrg.Rows[j]["T_ORGDESC"].ToString()); //风场名称
                        _fgs.Add(_ht);
                    }
                    string _orgid = _dtOrg.Rows[0]["T_ORGID"].ToString();
                    _fc = _wd.GetPeriod(_orgid);
                }

                //if (_fc != null)
                //{
                //    _ht = new Hashtable();
                //    _ht = _fc[0];

                //    string _pname = _ht["T_PERIODDESC"].ToString();
                //    if (_pname.Equals("全部"))
                //    {
                //        a = 1;
                //    }

                //    string _pid = _ht["T_PERIODID"].ToString();

                //}
            }


            object obj = new
            {
                Company     = _company,
                WindStation = _fgs
            };

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