コード例 #1
0
        private void BindPageData()
        {
            OpenDataServiceClient serviceClient = new OpenDataServiceClient();
            var json = serviceClient.GetBusRouteList(PageNo, PageSize);
            var jobj = json.JObjParse();

            if (jobj["Code"].Value <int>() == 1)
            {
                Repeater1.DataSource                                                           = from jitem in jobj["Message"]
                                                              let line                         = jitem["Line"].Value <string>()
                                                                                     let index = line.IndexOf("站点:", StringComparison.Ordinal)
                                                                                                 let included = line.Substring(0, 20).Contains("单向")
                                                                                                                select new
                {
                    Name   = jitem["Name"],
                    Line   = line.Substring(index + 3),
                    Single = included ? "单向" : "双向"
                };
                Repeater1.DataBind();
            }
        }