コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string tourName = "未知路线";
            if (Request.Params["tour"] != null)
            {
                tourName = Request.Params["tour"].ToString();
            }
            string exhibitions = "";
            if (Request.Params["exhibits"] != null)
            {
                exhibitions = Request.Params["exhibits"].ToString();
            }


            if (string.IsNullOrEmpty(exhibitions))
            {
                return;
            }

            string[] exhibits = exhibitions.Split(',');

            if (!string.IsNullOrEmpty(tourName))
            {
                for (int i = 0; i < exhibits.Length; i++)
                {
                    RoamingPlace place = new RoamingPlace();
                    place.placeName = exhibits[i];// tourName;
                    config.places.Add(place);
                    RoamingSence sence = GetRoamingList(exhibits[i]);
                    place.sences.Add(sence);
                }
            }
            roamingClass.roamingConfig = config;
            string responseStr = Newtonsoft.Json.JsonConvert.SerializeObject(roamingClass);

            HttpContext.Current.Response.Write(responseStr);
            HttpContext.Current.Response.End();
        }
    }
コード例 #2
0
    private RoamingSence GetRoamingList(string exhibition)
    {
        RoamingSence sence = new RoamingSence();

        sence.senceName = exhibition;

        foreach (KeyValuePair <string, string> str in StaticData.DicPlaceData)
        {
            tb_place placedata = Newtonsoft.Json.JsonConvert.DeserializeObject <tb_place>(str.Value);
            if (!string.IsNullOrEmpty(placedata.tb_place_desc) && !string.IsNullOrEmpty(placedata.tb_place_number) && placedata.tb_place_desc.Equals(exhibition))
            {
                RoamingPoint point = new RoamingPoint();
                point.placeid = (placedata.tb_place_id);
                point.panoid  = placedata.tb_pano_id;
                sence.panos.Add(point);
            }
        }
        sence.panos.Sort(ComparePlaceDataByPlaceid);

        return(sence);


        //return Newtonsoft.Json.JsonConvert.SerializeObject(halls);
    }