示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string json  = _openDataServiceClient.GetElectricNoticeCount();
                int    count = json.JobjMessageConvert <int>();
                if (json.JObjCodeTrue() && count > 0)
                {
                    string jsonResult = _openDataServiceClient.GetElectricNotice(1, 1);
                    var    result     = jsonResult.JObjMessageToken().FirstOrDefault();
                    if (result != null)
                    {
                        Notice1 = new ElectricNotic
                        {
                            Time        = result.Value <string>("BLACKOUT"),
                            Range       = result.Value <string>("RANGE1"),
                            Line        = result.Value <string>("LINE"),
                            ReleaseTime = DateTime.Parse(result.Value <string>("RELEASE_TIME"))
                        };
                    }
                }

                json  = _openDataServiceClient.GetWaterNoticeCount();
                count = json.JobjMessageConvert <int>();
                if (json.JObjCodeTrue() && count > 0)
                {
                    string jsonResult = _openDataServiceClient.GetWaterNotice(1, 1);
                    var    result     = jsonResult.JObjMessageToken().FirstOrDefault();
                    if (result != null)
                    {
                        Notice2 = new WaterNotice
                        {
                            Time =
                                string.Format("{0} — {1}",
                                              result.Value <string>("StartTime"), result.Value <string>("EndTime")),
                            Range       = result.Value <string>("Range"),
                            Reason      = result.Value <string>("Reason"),
                            ReleaseTime = DateTime.Parse(result.Value <string>("ReleaseTime"))
                        };
                    }
                }

                PostBinding();
            }
        }