示例#1
0
        private async void Save_clicked(object sender, XLabs.EventArgs <bool> e)
        {
            if (string.IsNullOrEmpty(_StationInformation.IATACode))
            {
                IATACodeLbl.TextColor = Color.Red;
                IATACodeEntry.Focus();
                return;
            }
            else
            {
                IATACodeLbl.TextColor = Color.Black;
            }

            _StationInformation.ReportType  = null;
            _StationInformation.DateOfEvent = null;
            DataContracts.StationInformationSp spData = null;
            try
            {
                spData = jsonInitObj.getStationInformationJson(_StationInformation);
            }
            catch (Exception ex)
            {
                await DisplayAlert("Please fill valid data", ex.Message, "Ok");

                return;
            }
            CreateItems(spData);
        }
示例#2
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()));
            }
        }
示例#3
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)
            {
            }
        }