Ejemplo n.º 1
0
        private async void lstStationInfo_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            System.Reflection.PropertyInfo pi = e.Item.GetType().GetProperty("Id");
            if (pi != null)
            {
                ToggleBusy(true);

                int id = (int)(pi.GetValue(e.Item, null));
                DataContracts.StationInformationSp sInfo = await SPUtility.GetStationInfoItem(id);

                ToggleBusy(false);
                await Navigation.PushAsync(new StationInformation(sInfo.GetModel()));
            }
        }
Ejemplo n.º 2
0
        private async Task BindStationInfoByIATA(string IATACode)
        {
            var client = await OAuthHelper.GetHTTPClientAsync();

            if (client == null)
            {
                return;
            }

            string url = ClientConfiguration.Default.ActiveDirectoryResource + string.Format("SSQServices/_api/Web/lists/GetByTitle('(Ops) Line Station Information')/items?$select=IATA_x0020_Code,Title,City_x0020_Name,Id,Country,Airport_x0020_Type&$filter=IATA_x0020_Code eq '{0}'&Status eq '{1}'", IATACode, "Open");

            try
            {
                var response = await client.GetStringAsync(url);

                if (response != null)
                {
                    var spData = JsonConvert.DeserializeObject <SPData>(response,
                                                                        new JsonSerializerSettings {
                        DateParseHandling = DateParseHandling.None, NullValueHandling = NullValueHandling.Ignore
                    });

                    if (spData.d.results.Count > 0)
                    {
                        int id = Convert.ToInt32(spData.d.results[0].Id);
                        DataContracts.StationInformationSp sInfo = await SPUtility.GetStationInfoItem(id);

                        ToggleBusy(false);
                        await Navigation.PushAsync(new StationInformation(sInfo.GetModel()));
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }